[Scummvm-cvs-logs] scummvm master -> 8d6aa77769d2d914fc05464435d6558b734bd4c1

lordhoto lordhoto at gmail.com
Thu Jul 4 15:45:25 CEST 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
8d6aa77769 GUI: Cleanup EventRecorder::getSurface.


Commit: 8d6aa77769d2d914fc05464435d6558b734bd4c1
    https://github.com/scummvm/scummvm/commit/8d6aa77769d2d914fc05464435d6558b734bd4c1
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2013-07-04T06:43:17-07:00

Commit Message:
GUI: Cleanup EventRecorder::getSurface.

Formerly the function created a SDL_Surface by hand. Instead now it uses
SDL_CreateRGBSurface (which is used in the SDL backend anyway and yields
the same results).

This should fix PS3 port compilation.

Changed paths:
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    gui/EventRecorder.cpp



diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index f66f43e..1ebd019 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -878,12 +878,7 @@ void SurfaceSdlGraphicsManager::unloadGFXMode() {
 	}
 
 	if (_hwscreen) {
-		if (_displayDisabled) {
-			delete _hwscreen;
-		} else {
-			SDL_FreeSurface(_hwscreen);
-		}
-
+		SDL_FreeSurface(_hwscreen);
 		_hwscreen = NULL;
 	}
 
diff --git a/gui/EventRecorder.cpp b/gui/EventRecorder.cpp
index 94b955c..47358a0 100644
--- a/gui/EventRecorder.cpp
+++ b/gui/EventRecorder.cpp
@@ -599,42 +599,8 @@ void EventRecorder::setFileHeader() {
 }
 
 SDL_Surface *EventRecorder::getSurface(int width, int height) {
-	SDL_Surface *surface = new SDL_Surface();
-	surface->format = new SDL_PixelFormat();
-	surface->flags = 0;
-	surface->format->palette = NULL;
-	surface->format->BitsPerPixel = 16;
-	surface->format->BytesPerPixel = 2;
-	surface->format->Rloss = 3;
-	surface->format->Gloss = 2;
-	surface->format->Bloss = 3;
-	surface->format->Aloss = 8;
-	surface->format->Rshift = 11;
-	surface->format->Gshift = 5;
-	surface->format->Bshift = 0;
-	surface->format->Ashift = 0;
-	surface->format->Rmask = 63488;
-	surface->format->Gmask = 2016;
-	surface->format->Bmask = 31;
-	surface->format->Amask = 0;
-	surface->format->colorkey = 0;
-	surface->format->alpha = 255;
-	surface->w = width;
-	surface->h = height;
-	surface->pitch = width * 2;
-	surface->pixels = (char *)malloc(surface->pitch * surface->h);
-	surface->offset = 0;
-	surface->hwdata = NULL;
-	surface->clip_rect.x = 0;
-	surface->clip_rect.y = 0;
-	surface->clip_rect.w = width;
-	surface->clip_rect.h = height;
-	surface->unused1 = 0;
-	surface->locked = 0;
-	surface->map = NULL;
-	surface->format_version = 4;
-	surface->refcount = 1;
-	return surface;
+	// Create a RGB565 surface of the requested dimensions.
+	return SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 16, 0xF800, 0x07E0, 0x001F, 0x0000);
 }
 
 bool EventRecorder::switchMode() {






More information about the Scummvm-git-logs mailing list