[Scummvm-cvs-logs] CVS: scummvm/saga gfx.cpp,1.26,1.27

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Wed Oct 20 23:51:34 CEST 2004


Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2927

Modified Files:
	gfx.cpp 
Log Message:
Fixed some clipping problems. I think there are more still in there, but I
am sorely tempted to rewrite so that we use the Rect datatype consistently
with how most of the rest of ScummVM does. (E.g. a rectangle covering the
entire ITE screen would have right and bottom as 320 and 200 respectively,
not 319 and 199 like I think we do now.)


Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- gfx.cpp	8 Oct 2004 19:58:49 -0000	1.26
+++ gfx.cpp	21 Oct 2004 06:47:21 -0000	1.27
@@ -118,6 +118,9 @@
 	return R_SUCCESS;
 }
 
+// TODO: I've fixed at least one clipping bug here, but I have a feeling there
+//       are several more. 
+
 // * Copies a rectangle from a raw 8 bit pixel buffer to the specified surface.
 // The buffer is of width 'src_w' and height 'src_h'. The rectangle to be 
 // copied is defined by 'src_rect'.  
@@ -225,18 +228,18 @@
 	}
 
 	if ((d_x + src_draw_w - 1) > clip.right) {
-		src_draw_w -= (clip.right - (d_x + src_draw_w - 1));
+		src_draw_w = clip.right - d_x + 1;
 	}
 
 	// Clip to bottom edge
 
-	if (d_x > clip.bottom) {
+	if (d_y > clip.bottom) {
 		// dst rect completely off bottom edge
 		return R_SUCCESS;
 	}
 
 	if ((d_y + src_draw_h - 1) > clip.bottom) {
-		src_draw_h -= (clip.bottom - (d_y + src_draw_h - 1));
+		src_draw_h = clip.bottom - d_y + 1;
 	}
 
 	// Transfer buffer data to surface
@@ -350,7 +353,7 @@
 
 	// Clip to bottom edge
 
-	if (d_x > clip.bottom) {
+	if (d_y > clip.bottom) {
 		// dst rect completely off bottom edge
 		return R_SUCCESS;
 	}





More information about the Scummvm-git-logs mailing list