[Scummvm-cvs-logs] SF.net SVN: scummvm:[33814] scummvm/branches/branch-0-12-0/engines/cine/gfx .cpp

buddha_ at users.sourceforge.net buddha_ at users.sourceforge.net
Wed Aug 13 02:21:49 CEST 2008


Revision: 33814
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33814&view=rev
Author:   buddha_
Date:     2008-08-13 00:21:49 +0000 (Wed, 13 Aug 2008)

Log Message:
-----------
Fix drawPlainBox's boundary checking similarly as in r33811 (Although without the Operation Stealth related stuff).

Modified Paths:
--------------
    scummvm/branches/branch-0-12-0/engines/cine/gfx.cpp

Modified: scummvm/branches/branch-0-12-0/engines/cine/gfx.cpp
===================================================================
--- scummvm/branches/branch-0-12-0/engines/cine/gfx.cpp	2008-08-13 00:10:00 UTC (rev 33813)
+++ scummvm/branches/branch-0-12-0/engines/cine/gfx.cpp	2008-08-13 00:21:49 UTC (rev 33814)
@@ -281,9 +281,6 @@
  * \param color Fill color
  */
 void FWRenderer::drawPlainBox(int x, int y, int width, int height, byte color) {
-	int i;
-	byte *dest = _backBuffer + y * 320 + x;
-
 	if (width < 0) {
 		x += width;
 		width = -width;
@@ -294,8 +291,14 @@
 		height = -height;
 	}
 
-	for (i = 0; i < height; i++) {
-		memset(dest + i * 320, color, width);
+	// Clip the rectangle to screen dimensions
+	Common::Rect boxRect(x, y, x + width, y + height);
+	Common::Rect screenRect(320, 200);
+	boxRect.clip(screenRect);
+
+	byte *dest = _backBuffer + boxRect.top * 320 + boxRect.left;
+	for (int i = 0; i < boxRect.height(); i++) {
+		memset(dest + i * 320, color, boxRect.width());
 	}
 }
 


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