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

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Sat May 20 01:07:07 CEST 2006


Revision: 22539
Author:   eriktorbjorn
Date:     2006-05-20 01:06:21 -0700 (Sat, 20 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22539&view=rev

Log Message:
-----------
Our GUI uses the "cursor palette" feature, but the SDL backend did not use the
cursor palette in overlay mode. Now it does, which fixes bug #1476666. The
reason it worked at all before was that blitCursor() was called while still not
in overlay mode.

This, of course, means that the GUI can corrupt the in-game cursor palette. I
don't have any game that uses this feature, so I don't know if it's properly
restored again afterwards. But if it isn't, that should be fairly easy to fix.

Modified Paths:
--------------
    scummvm/trunk/backends/sdl/graphics.cpp
Modified: scummvm/trunk/backends/sdl/graphics.cpp
===================================================================
--- scummvm/trunk/backends/sdl/graphics.cpp	2006-05-20 07:31:03 UTC (rev 22538)
+++ scummvm/trunk/backends/sdl/graphics.cpp	2006-05-20 08:06:21 UTC (rev 22539)
@@ -1062,8 +1062,7 @@
 	_cursorHasOwnPalette = true;
 	_cursorPaletteDisabled = false;
 
-	if (!_overlayVisible)
-		blitCursor();
+	blitCursor();
 }
 
 void OSystem_SDL::setShakePos(int shake_pos) {
@@ -1332,18 +1331,19 @@
 	// Draw from [1,1] since AdvMame2x adds artefact at 0,0
 	dstPtr = (byte *)_mouseOrigSurface->pixels + _mouseOrigSurface->pitch + 2;
 
+	SDL_Color *palette;
+
+	if (_cursorHasOwnPalette && !_cursorPaletteDisabled)
+		palette = _cursorPalette;
+	else
+		palette = _currentPalette;
+	
 	for (i = 0; i < h; i++) {
 		for (j = 0; j < w; j++) {
 			color = *srcPtr;
 			if (color != _mouseKeyColor) {	// transparent, don't draw
-				if (_cursorHasOwnPalette && !_overlayVisible && !_cursorPaletteDisabled)
-					*(uint16 *)dstPtr = SDL_MapRGB(_mouseOrigSurface->format,
-								   _cursorPalette[color].r, _cursorPalette[color].g,
-															   _cursorPalette[color].b);
-				else
-					*(uint16 *)dstPtr = SDL_MapRGB(_mouseOrigSurface->format,
-								   _currentPalette[color].r, _currentPalette[color].g,
-												   				_currentPalette[color].b);
+				*(uint16 *)dstPtr = SDL_MapRGB(_mouseOrigSurface->format,
+					palette[color].r, palette[color].g, palette[color].b);
 			}
 			dstPtr += 2;
 			srcPtr++;


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