[Scummvm-cvs-logs] SF.net SVN: scummvm:[41964] scummvm/trunk/engines/kyra/screen.cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Mon Jun 29 22:17:10 CEST 2009


Revision: 41964
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41964&view=rev
Author:   lordhoto
Date:     2009-06-29 20:17:10 +0000 (Mon, 29 Jun 2009)

Log Message:
-----------
Fix bug in drawShape.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/screen.cpp

Modified: scummvm/trunk/engines/kyra/screen.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen.cpp	2009-06-29 20:16:59 UTC (rev 41963)
+++ scummvm/trunk/engines/kyra/screen.cpp	2009-06-29 20:17:10 UTC (rev 41964)
@@ -1407,8 +1407,6 @@
 
 	int t = (flags & 2) ? y2 - y - shapeHeight : y - y1;
 
-	const uint8 *s = src;
-
 	if (t < 0) {
 		shapeHeight += t;
 		if (shapeHeight <= 0) {
@@ -1417,23 +1415,29 @@
 		}
 
 		t *= -1;
-		uint8 *tmp = dst;
+		const uint8 *srcBackUp = 0;
 
 		do {
 			_dsOffscreenScaleVal1 = 0;
+			srcBackUp = src;
 			_dsTmpWidth = shapeWidth;
+
 			int cnt = shapeWidth;
-			(this->*_dsScaleSkip)(tmp, s, cnt);
+			(this->*_dsScaleSkip)(dst, src, cnt);
+
 			scaleCounterV += _dsScaleH;
-			if (!(scaleCounterV & 0xff00))
-				continue;
-			uint8 r = scaleCounterV >> 8;
-			scaleCounterV &= 0xff;
-			t -= r;
-		} while (t > 0);
 
-		if (t < 0)
+			if (scaleCounterV & 0xFF00) {
+				uint8 r = scaleCounterV >> 8;
+				scaleCounterV &= 0xFF;
+				t -= r;
+			}
+		} while (!(scaleCounterV & 0xFF00) && (t > 0));
+
+		if (t < 0) {
+			src = srcBackUp;
 			scaleCounterV += (-t << 8);
+		}
 
 		if (!(flags & 2))
 			y = y1;
@@ -1514,28 +1518,28 @@
 			if (!(scaleCounterV & 0xFF00)) {
 				_dsTmpWidth = shapeWidth;
 				int cnt = shapeWidth;
-				(this->*_dsScaleSkip)(d, s, cnt);
+				(this->*_dsScaleSkip)(d, src, cnt);
 			}
 		}
 
-		const uint8 *b_src = s;
+		const uint8 *b_src = src;
 
 		do {
-			s = b_src;
+			src = b_src;
 			_dsTmpWidth = shapeWidth;
 			int cnt = _dsOffscreenLeft;
-			int scaleState = (this->*_dsProcessMargin)(d, s, cnt);
+			int scaleState = (this->*_dsProcessMargin)(d, src, cnt);
 			if (_dsTmpWidth) {
 				cnt += shpWidthScaled1;
 				if (cnt > 0) {
 					if (flags & 0x800)
 						normalPlot = (curY > _maskMinY && curY < _maskMaxY);
 					_dsPlot = normalPlot ? dsPlot2 : dsPlot3;
-					(this->*_dsProcessLine)(d, s, cnt, scaleState);
+					(this->*_dsProcessLine)(d, src, cnt, scaleState);
 				}
 				cnt += _dsOffscreenRight;
 				if (cnt)
-					(this->*_dsScaleSkip)(d, s, cnt);
+					(this->*_dsScaleSkip)(d, src, cnt);
 			}
 			dst += dsPitch;
 			d = dst;


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