[Scummvm-cvs-logs] SF.net SVN: scummvm: [23573] scummvm/trunk/backends/platform/sdl/graphics.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Sun Jul 23 08:50:53 CEST 2006


Revision: 23573
Author:   eriktorbjorn
Date:     2006-07-22 23:50:49 -0700 (Sat, 22 Jul 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=23573&view=rev

Log Message:
-----------
Warn if copyRectToScreen() is called before _screen is created, since it's
almost certainly a programming error. (Used to be silently ignored.)

Warn if setPalette() is called before _screen is created, but allow it (for
now) since we don't actually set the palette until later. It could still be a
programming error, though.

Don't crash if updateScreen() is called with a "dirty" palette before _screen
is created.

Modified Paths:
--------------
    scummvm/trunk/backends/platform/sdl/graphics.cpp
Modified: scummvm/trunk/backends/platform/sdl/graphics.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/graphics.cpp	2006-07-23 02:20:49 UTC (rev 23572)
+++ scummvm/trunk/backends/platform/sdl/graphics.cpp	2006-07-23 06:50:49 UTC (rev 23573)
@@ -539,7 +539,7 @@
 
 	// Check whether the palette was changed in the meantime and update the
 	// screen surface accordingly.
-	if (_paletteDirtyEnd != 0) {
+	if (_screen && _paletteDirtyEnd != 0) {
 		SDL_SetColors(_screen, _currentPalette + _paletteDirtyStart,
 			_paletteDirtyStart,
 			_paletteDirtyEnd - _paletteDirtyStart);
@@ -779,8 +779,10 @@
 	assert (_transactionMode == kTransactionNone);
 	assert(src);
 
-	if (_screen == NULL)
+	if (_screen == NULL) {
+		warning("OSystem_SDL::copyRectToScreen: _screen == NULL");
 		return;
+	}
 
 	Common::StackLock lock(_graphicsMutex);	// Lock the mutex until this function ends
 
@@ -1025,6 +1027,14 @@
 
 void OSystem_SDL::setPalette(const byte *colors, uint start, uint num) {
 	assert(colors);
+
+	// Setting the palette before _screen is created is allowed - for now -
+	// since we don't actually set the palette until the screen is updated.
+	// But it could indicate a programming error, so let's warn about it.
+
+	if (!_screen)
+		warning("OSystem_SDL::setPalette: _screen == NULL");
+
 	const byte *b = colors;
 	uint i;
 	SDL_Color *base = _currentPalette + start;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list