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

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Sat May 27 05:56:02 CEST 2006


Revision: 22681
Author:   eriktorbjorn
Date:     2006-05-27 05:55:28 -0700 (Sat, 27 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22681&view=rev

Log Message:
-----------
The dirty rect produced by drawMouse() is updated without going through any
scaling or aspect-ratio correction, so it has to be added using real surface
coordinates. So I had to re-introduce the extra parameter to addDirtyRect().

Modified Paths:
--------------
    scummvm/trunk/backends/sdl/graphics.cpp
    scummvm/trunk/backends/sdl/sdl-common.h
Modified: scummvm/trunk/backends/sdl/graphics.cpp
===================================================================
--- scummvm/trunk/backends/sdl/graphics.cpp	2006-05-27 12:48:31 UTC (rev 22680)
+++ scummvm/trunk/backends/sdl/graphics.cpp	2006-05-27 12:55:28 UTC (rev 22681)
@@ -854,7 +854,7 @@
 	return true;
 }
 
-void OSystem_SDL::addDirtyRect(int x, int y, int w, int h) {
+void OSystem_SDL::addDirtyRect(int x, int y, int w, int h, bool realCoordinates) {
 	if (_forceFull)
 		return;
 
@@ -865,7 +865,7 @@
 
 	int height, width;
 
-	if (!_overlayVisible) {
+	if (!_overlayVisible && !realCoordinates) {
 		width = _screenWidth;
 		height = _screenHeight;
 	} else {
@@ -875,7 +875,7 @@
 
 	// Extend the dirty region by 1 pixel for scalers
 	// that "smear" the screen, e.g. 2xSAI
-	if (_modeFlags & DF_UPDATE_EXPAND_1_PIXEL) {
+	if ((_modeFlags & DF_UPDATE_EXPAND_1_PIXEL) && !realCoordinates) {
 		x--;
 		y--;
 		w+=2;
@@ -902,7 +902,7 @@
 	}
 
 #ifndef DISABLE_SCALERS
-	if (_adjustAspectRatio && !_overlayVisible) {
+	if (_adjustAspectRatio && !_overlayVisible && !realCoordinates) {
 		makeRectStretchable(x, y, w, h);
 	}
 #endif
@@ -1479,7 +1479,7 @@
 		_mouseBackup.x = _mouseBackup.y = _mouseBackup.w = _mouseBackup.h = 0;
   		return;
 	}
-  
+
 	SDL_Rect dst;
 	int scale;
 	int width, height;
@@ -1502,15 +1502,14 @@
 		dst.h = _mouseCurState.hH;
 	}
 
-	// Note that addDirtyRect() will perform any necessary clipping
+	// The mouse is undrawn using virtual coordinates, i.e. they may be
+	// scaled and aspect-ratio corrected.
 
 	_mouseBackup.x = dst.x;
 	_mouseBackup.y = dst.y;
 	_mouseBackup.w = dst.w;
 	_mouseBackup.h = dst.h;
 
-	addDirtyRect(_mouseBackup.x, _mouseBackup.y, _mouseBackup.w, _mouseBackup.h);
-
 	// We draw the pre-scaled cursor image, so now we need to adjust for
 	// scaling, shake position and aspect ratio correction manually.
 
@@ -1526,10 +1525,16 @@
 	dst.w = _mouseCurState.hW;
 	dst.h = _mouseCurState.hH;
 
-	// Note that SDL_BlitSurface() will perform any clipping necessary
+	// Note that SDL_BlitSurface() and addDirtyRect() will both perform any
+	// clipping necessary
 
 	if (SDL_BlitSurface(_mouseSurface, NULL, _hwscreen, &dst) != 0)
 		error("SDL_BlitSurface failed: %s", SDL_GetError());
+
+	// The screen will be updated using real surface coordinates, i.e.
+	// they will not be scaled or aspect-ratio corrected.
+
+	addDirtyRect(dst.x, dst.y, dst.w, dst.h, true);
 }
 
 #pragma mark -

Modified: scummvm/trunk/backends/sdl/sdl-common.h
===================================================================
--- scummvm/trunk/backends/sdl/sdl-common.h	2006-05-27 12:48:31 UTC (rev 22680)
+++ scummvm/trunk/backends/sdl/sdl-common.h	2006-05-27 12:55:28 UTC (rev 22681)
@@ -339,7 +339,7 @@
 	void addDirtyRgnAuto(const byte *buf);
 	void makeChecksums(const byte *buf);
 
-	virtual void addDirtyRect(int x, int y, int w, int h); // overloaded by CE backend
+	virtual void addDirtyRect(int x, int y, int w, int h, bool realCoordinates = false); // overloaded by CE backend
 
 	virtual void drawMouse(); // overloaded by CE backend
 	virtual void undrawMouse(); // overloaded by CE backend (FIXME)


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