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

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Sun May 1 10:40:26 CEST 2005


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

Modified Files:
	graphics.cpp 
Log Message:
Always check for _numDirtyRects overflow in addDirtyRect(). The 'mouseRect'
case didn't. This fixes bug #1193344.


Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/graphics.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- graphics.cpp	27 Apr 2005 14:47:19 -0000	1.43
+++ graphics.cpp	1 May 2005 17:39:38 -0000	1.44
@@ -811,8 +811,14 @@
 	if (_forceFull)
 		return;
 
+	if (_numDirtyRects == NUM_DIRTY_RECT) {
+		_forceFull = true;
+		return;
+	}
+
+	SDL_Rect *r = &_dirtyRectList[_numDirtyRects++];
+
 	if (mouseRect) {
-		SDL_Rect *r = &_dirtyRectList[_numDirtyRects++];
 		r->x = x;
 		r->y = y;
 		r->w = w;
@@ -830,50 +836,46 @@
 		height = _overlayHeight;
 	}
 
-	if (_numDirtyRects == NUM_DIRTY_RECT)
-		_forceFull = true;
-	else {
-		SDL_Rect *r = &_dirtyRectList[_numDirtyRects++];
-		// Extend the dirty region by 1 pixel for scalers
-		// that "smear" the screen, e.g. 2xSAI
-		if (_modeFlags & DF_UPDATE_EXPAND_1_PIXEL) {
-			x--;
-			y--;
-			w+=2;
-			h+=2;
-		}
+	// Extend the dirty region by 1 pixel for scalers
+	// that "smear" the screen, e.g. 2xSAI
+	if (_modeFlags & DF_UPDATE_EXPAND_1_PIXEL) {
+		x--;
+		y--;
+		w+=2;
+		h+=2;
+	}
 
-		// clip
-		if (x < 0) {
-			w += x; x = 0;
-		}
+	// clip
+	if (x < 0) {
+		w += x;
+		x = 0;
+	}
 
-		if (y < 0) {
-			h += y;
-			y=0;
-		}
+	if (y < 0) {
+		h += y;
+		y=0;
+	}
 
-		if (w > width - x) {
-			w = width - x;
-		}
+	if (w > width - x) {
+		w = width - x;
+	}
 
-		if (h > height - y) {
-			h = height - y;
-		}
+	if (h > height - y) {
+		h = height - y;
+	}
 
-		if (_adjustAspectRatio) {
-			makeRectStretchable(x, y, w, h);
-			if (_scaleFactor == 3 && _overlayScale == 2 && _overlayVisible) {
-				if (y % 2)
-					y++;
-			}
+	if (_adjustAspectRatio) {
+		makeRectStretchable(x, y, w, h);
+		if (_scaleFactor == 3 && _overlayScale == 2 && _overlayVisible) {
+			if (y % 2)
+				y++;
 		}
-	
-		r->x = x;
-		r->y = y;
-		r->w = w;
-		r->h = h;
 	}
+	
+	r->x = x;
+	r->y = y;
+	r->w = w;
+	r->h = h;
 }
 
 





More information about the Scummvm-git-logs mailing list