[Scummvm-cvs-logs] CVS: scummvm/backends/sdl graphics.cpp,1.2,1.3

Max Horn fingolfin at users.sourceforge.net
Mon Mar 1 03:40:01 CET 2004


Update of /cvsroot/scummvm/scummvm/backends/sdl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12732

Modified Files:
	graphics.cpp 
Log Message:
Fix for bug #907280: Mouse glitches and crashes (Regression)

Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/graphics.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- graphics.cpp	1 Mar 2004 01:41:22 -0000	1.2
+++ graphics.cpp	1 Mar 2004 11:20:32 -0000	1.3
@@ -1074,12 +1074,32 @@
 	if (SDL_LockSurface(_overlayVisible ? _tmpscreen : _screen) == -1)
 		error("SDL_LockSurface failed: %s", SDL_GetError());
 
-	const int old_mouse_x = _mouseCurState.x;
-	const int old_mouse_y = _mouseCurState.y;
-	const int old_mouse_w = _mouseCurState.w;
-	const int old_mouse_h = _mouseCurState.h;
-	int x, y;
+	int old_mouse_x = _mouseCurState.x - _mouseHotspotX;
+	int old_mouse_y = _mouseCurState.y - _mouseHotspotY;
+	int old_mouse_w = _mouseCurState.w;
+	int old_mouse_h = _mouseCurState.h;
+
+	// clip the mouse rect, and addjust the src pointer accordingly
+	if (old_mouse_x < 0) {
+		old_mouse_w += old_mouse_x;
+		old_mouse_x = 0;
+	}
+	if (old_mouse_y < 0) {
+		old_mouse_h += old_mouse_y;
+		old_mouse_y = 0;
+	}
 
+	if (old_mouse_w > _screenWidth - old_mouse_x)
+		old_mouse_w = _screenWidth - old_mouse_x;
+	if (old_mouse_h > _screenHeight - old_mouse_y)
+		old_mouse_h = _screenHeight - old_mouse_y;
+
+	// Quick check to see if anything has to be drawn at all
+	if (old_mouse_w <= 0 || old_mouse_h <= 0)
+		return;
+
+
+	int x, y;
 	if (!_overlayVisible) {
 		byte *dst, *bak = _mouseBackup;
 





More information about the Scummvm-git-logs mailing list