[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.327,2.328 gfx.h,1.81,1.82

Travis Howell kirben at users.sourceforge.net
Sat Sep 25 06:40:03 CEST 2004


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

Modified Files:
	gfx.cpp gfx.h 
Log Message:

Cleanup to reduce code duplication.


Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.327
retrieving revision 2.328
diff -u -d -r2.327 -r2.328
--- gfx.cpp	25 Sep 2004 11:20:38 -0000	2.327
+++ gfx.cpp	25 Sep 2004 11:33:50 -0000	2.328
@@ -2070,13 +2070,13 @@
 			// FIXME: Ugly workaround for bug #901462
 			if (_vm->_version == 8 && code == 10)
 				useOrDecompress = true;
-			drawStripComplex(dst, dstPitch, src, numLinesToProcess);
+			drawStripComplex(dst, dstPitch, src, numLinesToProcess, false);
 			break;
 	
 		case 8:
 		case 12:
 			useOrDecompress = true;
-			drawStripComplex_trans(dst, dstPitch, src, numLinesToProcess);
+			drawStripComplex(dst, dstPitch, src, numLinesToProcess, true);
 			break;
 	
 		case 13:
@@ -2268,55 +2268,7 @@
 		}                           \
 	} while (0)
 
-void Gdi::drawStripComplex(byte *dst, int dstPitch, const byte *src, int height) const {
-	byte color = *src++;
-	uint bits = *src++;
-	byte cl = 8;
-	byte bit;
-	byte incm, reps;
-
-	do {
-		int x = 8;
-		do {
-			FILL_BITS;
-			*dst++ = _roomPalette[color];
-
-		againPos:
-			if (!READ_BIT) {
-			} else if (!READ_BIT) {
-				FILL_BITS;
-				color = bits & _decomp_mask;
-				bits >>= _decomp_shr;
-				cl -= _decomp_shr;
-			} else {
-				incm = (bits & 7) - 4;
-				cl -= 3;
-				bits >>= 3;
-				if (incm) {
-					color += incm;
-				} else {
-					FILL_BITS;
-					reps = bits & 0xFF;
-					do {
-						if (!--x) {
-							x = 8;
-							dst += dstPitch - 8;
-							if (!--height)
-								return;
-						}
-						*dst++ = _roomPalette[color];
-					} while (--reps);
-					bits >>= 8;
-					bits |= (*src++) << (cl - 8);
-					goto againPos;
-				}
-			}
-		} while (--x);
-		dst += dstPitch - 8;
-	} while (--height);
-}
-
-void Gdi::drawStripComplex_trans(byte *dst, int dstPitch, const byte *src, int height) const {
+void Gdi::drawStripComplex(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const {
 	byte color = *src++;
 	uint bits = *src++;
 	byte cl = 8;
@@ -2327,7 +2279,7 @@
 		int x = 8;
 		do {
 			FILL_BITS;
-			if (color != _transparentColor)
+			if (!transpCheck || color != _transparentColor)
 				*dst = _roomPalette[color];
 			dst++;
 
@@ -2354,7 +2306,7 @@
 							if (!--height)
 								return;
 						}
-						if (color != _transparentColor)
+						if (!transpCheck || color != _transparentColor)
 							*dst = _roomPalette[color];
 						dst++;
 					} while (--reps);

Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.h,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- gfx.h	25 Sep 2004 11:17:23 -0000	1.81
+++ gfx.h	25 Sep 2004 11:33:50 -0000	1.82
@@ -237,8 +237,7 @@
 	void drawStripC64Object(byte *dst, int dstPitch, int stripnr, int width, int height);
 	void drawStripC64Background(byte *dst, int dstPitch, int stripnr, int height);
 
-	void drawStripComplex(byte *dst, int dstPitch, const byte *src, int height) const;
-	void drawStripComplex_trans(byte *dst, int dstPitch, const byte *src, int height) const;
+	void drawStripComplex(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const;
 	void drawStripBasicH(byte *dst, int dstPitch, const byte *src, int height) const;
 	void drawStripBasicH_trans(byte *dst, int dstPitch, const byte *src, int height) const;
 	void drawStripBasicV(byte *dst, int dstPitch, const byte *src, int height) const;





More information about the Scummvm-git-logs mailing list