[Scummvm-cvs-logs] CVS: scummvm/sword2/driver sprite.cpp,1.53,1.54

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Tue Dec 20 00:57:13 CET 2005


Update of /cvsroot/scummvm/scummvm/sword2/driver
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32528/driver

Modified Files:
	sprite.cpp 
Log Message:
If drawSurface() is called with no clip rect, clip to the screen size. This
prevents the subtitles-only cutscenes fallback from drawing outside the
screen.


Index: sprite.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/sprite.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- sprite.cpp	18 Oct 2005 01:30:25 -0000	1.53
+++ sprite.cpp	20 Dec 2005 08:56:48 -0000	1.54
@@ -286,29 +286,33 @@
 	rd.top = s->y;
 	rd.bottom = rd.top + rs.bottom;
 
-	if (clipRect) {
-		if (clipRect->left > rd.left) {
-			rs.left += (clipRect->left - rd.left);
-			rd.left = clipRect->left;
-		}
+	Common::Rect defClipRect(0, 0, _screenWide, _screenDeep);
 
-		if (clipRect->top > rd.top) {
-			rs.top += (clipRect->top - rd.top);
-			rd.top = clipRect->top;
-		}
+	if (!clipRect) {
+		clipRect = &defClipRect;
+	}
 
-		if (clipRect->right < rd.right) {
-			rd.right = clipRect->right;
-		}
+	if (clipRect->left > rd.left) {
+		rs.left += (clipRect->left - rd.left);
+		rd.left = clipRect->left;
+	}
 
-		if (clipRect->bottom < rd.bottom) {
-			rd.bottom = clipRect->bottom;
-		}
+	if (clipRect->top > rd.top) {
+		rs.top += (clipRect->top - rd.top);
+		rd.top = clipRect->top;
+	}
 
-		if (rd.width() <= 0 || rd.height() <= 0)
-			return;
+	if (clipRect->right < rd.right) {
+		rd.right = clipRect->right;
 	}
 
+	if (clipRect->bottom < rd.bottom) {
+		rd.bottom = clipRect->bottom;
+	}
+
+	if (rd.width() <= 0 || rd.height() <= 0)
+		return;
+
 	src = surface + rs.top * s->w + rs.left;
 	dst = _buffer + _screenWide * rd.top + rd.left;
 





More information about the Scummvm-git-logs mailing list