[Scummvm-cvs-logs] SF.net SVN: scummvm:[39133] scummvm/branches/branch-0-13-0/engines/gob/ coktelvideo.cpp

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Thu Mar 5 19:34:13 CET 2009


Revision: 39133
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39133&view=rev
Author:   drmccoy
Date:     2009-03-05 18:34:13 +0000 (Thu, 05 Mar 2009)

Log Message:
-----------
Clipping the rendering to the output surface.
This should fix the crash in the Italian version of Woodruff (#1981031 - "Crash after dancing at Puh-Let Party!!")
[backport]

Modified Paths:
--------------
    scummvm/branches/branch-0-13-0/engines/gob/coktelvideo.cpp

Modified: scummvm/branches/branch-0-13-0/engines/gob/coktelvideo.cpp
===================================================================
--- scummvm/branches/branch-0-13-0/engines/gob/coktelvideo.cpp	2009-03-05 12:04:58 UTC (rev 39132)
+++ scummvm/branches/branch-0-13-0/engines/gob/coktelvideo.cpp	2009-03-05 18:34:13 UTC (rev 39133)
@@ -1388,6 +1388,7 @@
 	int16 width = right - left + 1;
 	int16 height = bottom - top + 1;
 	int16 sW = _vidMemWidth;
+	int16 sH = _vidMemHeight;
 	uint32 dataLen = _frameDataLen;
 	byte *dataPtr = _frameData;
 	byte *imdVidMem = _vidMem + sW * top + left;
@@ -1427,6 +1428,7 @@
 			dest = _vidMemBuffer + postScaleX(_width) * (top - _y) + postScaleX((left - _x));
 			imdVidMem = _vidMem + _vidMemWidth * top + preScaleX(left);
 			sW = postScaleX(_width);
+			sH = _height;
 		}
 
 		if (type & 0x80) { // Frame data is compressed
@@ -1468,11 +1470,15 @@
 			dest = destBak;
 		}
 	} else if (type == 2) { // Whole block
-		for (int i = 0; i < height; i++) {
-			memcpy(dest, srcPtr, postScaleX(width));
+		int16 w = MIN<int32>(postScaleX(width), sW);
+		int16 h = MIN(height, sH);
+
+		for (int i = 0; i < h; i++) {
+			memcpy(dest, srcPtr, w);
 			srcPtr += postScaleX(width);
 			dest += sW;
 		}
+
 	} else if (type == 3) { // RLE block
 		for (int i = 0; i < height; i++) {
 			destBak = dest;


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