[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.378,2.379

Gregory Montoir cyx at users.sourceforge.net
Sun Nov 21 13:46:28 CET 2004


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

Modified Files:
	gfx.cpp 
Log Message:
as the comment suggested, I rearranged the 3DO strip decoding function. Please, someone owning the 3DO games, test that this doesn't cause any regressions !

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.378
retrieving revision 2.379
diff -u -d -r2.378 -r2.379
--- gfx.cpp	21 Nov 2004 21:31:26 -0000	2.378
+++ gfx.cpp	21 Nov 2004 21:40:51 -0000	2.379
@@ -2266,62 +2266,39 @@
 
 
 void Gdi::drawStrip3DO(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const {
-	int destbytes, olddestbytes2, olddestbytes1;
-	byte color;
-
-	uint32 dataBit, data;
-
-	olddestbytes1 = 0;
-
-	destbytes = height << 3;
-
-	if (!height)
+	if (height == 0)
 		return;
 
-	// FIXME/TODO: This is a simple RLE encoding; the code could be made
-	// clearer by renaming some vars and/or rearranginge the code.
+	int decSize = height * 8;
+	int curSize = 0;
 
 	do {
-		data = *src++;
-
-		dataBit = data & 1;
-		data >>= 1;
-		data++;
-
-		destbytes -= data;
-		
-		// Clip!
-		if (destbytes < 0)
-			data += destbytes;
+		uint8 data = *src++;
+		uint8 rle = data & 1;
+		int len = (data >> 1) + 1;
 
-		olddestbytes2 = destbytes;
-		destbytes = olddestbytes1;
+		len = MIN(decSize, len);
+		decSize -= len;
 
-		if (!dataBit) {
-			for (; data > 0; data--, src++, dst++) {
+		if (!rle) {
+			for (; len > 0; len--, src++, dst++) {
 				if (!transpCheck || *src != _transparentColor)
 					*dst = _roomPalette[*src];
-			
-				destbytes++;
-				if (!(destbytes & 7))
-					dst += dstPitch - 8;	// Next row
+				curSize++;
+				if (!(curSize & 7))
+					dst += dstPitch - 8; // Next row
 			}
 		} else {
-			color = *src;
-			src++;
-
-			for (; data > 0; data--, dst++) {
+			byte color = *src++;
+			for (; len > 0; len--, dst++) {
 				if (!transpCheck || color != _transparentColor)
 					*dst = _roomPalette[color];
-				destbytes++;
-				if (!(destbytes & 7))
-					dst += dstPitch - 8;	// Next row
+				curSize++;
+				if (!(curSize & 7))
+					dst += dstPitch - 8; // Next row
 			}
 		}
-
-		olddestbytes1 = destbytes;
-		destbytes = olddestbytes2;
-	} while (olddestbytes2 > 0);
+	} while (decSize > 0);
 }
 
 





More information about the Scummvm-git-logs mailing list