[Scummvm-cvs-logs] SF.net SVN: scummvm:[53515] scummvm/trunk/engines/sci/graphics/view.cpp

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Fri Oct 15 23:12:43 CEST 2010


Revision: 53515
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53515&view=rev
Author:   m_kiewitz
Date:     2010-10-15 21:12:42 +0000 (Fri, 15 Oct 2010)

Log Message:
-----------
SCI: fixing view-undithering for laura bow 1

(cupboards in room 43, just in the room to the left from the start)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/view.cpp

Modified: scummvm/trunk/engines/sci/graphics/view.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/view.cpp	2010-10-15 20:52:29 UTC (rev 53514)
+++ scummvm/trunk/engines/sci/graphics/view.cpp	2010-10-15 21:12:42 UTC (rev 53515)
@@ -525,6 +525,10 @@
 	if (width <= 3)
 		return;
 
+	// We need at least 2 pixel lines
+	if (height < 2)
+		return;
+
 	// If EGA mapping is used for this view, dont do undithering as well
 	if (_EGAmapping)
 		return;
@@ -533,20 +537,27 @@
 	int16 bitmapMemorial[SCI_SCREEN_UNDITHERMEMORIAL_SIZE];
 	byte *curPtr;
 	byte color1, color2;
+	byte nextColor1, nextColor2;
 	int16 y, x;
 
 	memset(&bitmapMemorial, 0, sizeof(bitmapMemorial));
 
 	// Count all seemingly dithered pixel-combinations as soon as at least 4
 	// pixels are adjacent
+	int16 checkHeight = height - 1;
 	curPtr = bitmapPtr;
-	for (y = 0; y < height; y++) {
+	byte *nextPtr = curPtr + width;
+	for (y = 0; y < checkHeight; y++) {
 		color1 = curPtr[0]; color2 = (curPtr[1] << 4) | curPtr[2];
+		nextColor1 = nextPtr[0] << 4; nextColor2 = (nextPtr[2] << 4) | nextPtr[1];
 		curPtr += 3;
+		nextPtr += 3;
 		for (x = 3; x < width; x++) {
 			color1 = (color1 << 4) | (color2 >> 4);
 			color2 = (color2 << 4) | *curPtr++;
-			if (color1 == color2)
+			nextColor1 = (nextColor1 >> 4) | (nextColor2 << 4);
+			nextColor2 = (nextColor2 >> 4) | *nextPtr++ << 4;
+			if ((color1 == color2) && (color1 == nextColor1) && (color1 == nextColor2))
 				bitmapMemorial[color1]++;
 		}
 	}


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