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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Feb 24 22:43:07 CET 2009


Revision: 38861
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38861&view=rev
Author:   fingolfin
Date:     2009-02-24 21:43:07 +0000 (Tue, 24 Feb 2009)

Log Message:
-----------
SDL: Tweak the way the mouse is drawn/erased, so that it is not erase and drawn again if nothing changed

Modified Paths:
--------------
    scummvm/trunk/backends/platform/sdl/graphics.cpp
    scummvm/trunk/backends/platform/sdl/sdl.cpp
    scummvm/trunk/backends/platform/sdl/sdl.h

Modified: scummvm/trunk/backends/platform/sdl/graphics.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/graphics.cpp	2009-02-24 21:22:04 UTC (rev 38860)
+++ scummvm/trunk/backends/platform/sdl/graphics.cpp	2009-02-24 21:43:07 UTC (rev 38861)
@@ -652,6 +652,11 @@
 		scale1 = 1;
 	}
 
+	// Add the area covered by the mouse cursor to the list of dirty rects if
+	// we have to redraw the mouse.
+	if (_mouseNeedsRedraw)
+		undrawMouse();
+
 	// Force a full redraw if requested
 	if (_forceFull) {
 		_numDirtyRects = 1;
@@ -659,8 +664,7 @@
 		_dirtyRectList[0].y = 0;
 		_dirtyRectList[0].w = width;
 		_dirtyRectList[0].h = height;
-	} else
-		undrawMouse();
+	}
 
 	// Only draw anything if necessary
 	if (_numDirtyRects > 0) {
@@ -736,14 +740,11 @@
 #endif
 		// Finally, blit all our changes to the screen
 		SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList);
-	} else {
-		drawMouse();
-		if (_numDirtyRects)
-			SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList);
 	}
 
 	_numDirtyRects = 0;
 	_forceFull = false;
+	_mouseNeedsRedraw = false;
 }
 
 bool OSystem_SDL::saveScreenshot(const char *filename) {
@@ -1281,6 +1282,7 @@
 
 void OSystem_SDL::setMousePos(int x, int y) {
 	if (x != _mouseCurState.x || y != _mouseCurState.y) {
+		_mouseNeedsRedraw = true;
 		_mouseCurState.x = x;
 		_mouseCurState.y = y;
 	}
@@ -1313,6 +1315,7 @@
 	if (w == 0 || h == 0)
 		return;
 
+	_mouseNeedsRedraw = true;
 	_mouseCurState.hotX = hotspot_x;
 	_mouseCurState.hotY = hotspot_y;
 

Modified: scummvm/trunk/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/sdl.cpp	2009-02-24 21:22:04 UTC (rev 38860)
+++ scummvm/trunk/backends/platform/sdl/sdl.cpp	2009-02-24 21:43:07 UTC (rev 38861)
@@ -205,7 +205,7 @@
 	_overlayscreen(0), _tmpscreen2(0),
 	_samplesPerSec(0),
 	_cdrom(0), _scalerProc(0), _modeChanged(false), _screenChangeCount(0), _dirtyChecksums(0),
-	_mouseVisible(false), _mouseDrawn(false), _mouseData(0), _mouseSurface(0),
+	_mouseVisible(false), _mouseNeedsRedraw(false), _mouseData(0), _mouseSurface(0),
 	_mouseOrigSurface(0), _cursorTargetScale(1), _cursorPaletteDisabled(true),
 	_joystick(0),
 	_currentShakePos(0), _newShakePos(0),

Modified: scummvm/trunk/backends/platform/sdl/sdl.h
===================================================================
--- scummvm/trunk/backends/platform/sdl/sdl.h	2009-02-24 21:22:04 UTC (rev 38860)
+++ scummvm/trunk/backends/platform/sdl/sdl.h	2009-02-24 21:43:07 UTC (rev 38861)
@@ -341,7 +341,7 @@
 	// mouse
 	KbdMouse _km;
 	bool _mouseVisible;
-	bool _mouseDrawn;
+	bool _mouseNeedsRedraw;
 	byte *_mouseData;
 	SDL_Rect _mouseBackup;
 	MousePos _mouseCurState;


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