[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.325,2.326 gfx.h,1.80,1.81

Travis Howell kirben at users.sourceforge.net
Sat Sep 25 04:24:15 CEST 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24375/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.325
retrieving revision 2.326
diff -u -d -r2.325 -r2.326
--- gfx.cpp	24 Sep 2004 23:29:46 -0000	2.325
+++ gfx.cpp	25 Sep 2004 11:17:22 -0000	2.326
@@ -1384,12 +1384,12 @@
 	// TODO: The following few lines more or less duplicate decompressBitmap(), only
 	// for an area spanning multiple strips. In particular, the codecs 13 & 14
 	// in decompressBitmap call drawStripHE(), which use the same algorithm as
-	// decompressBMAPbg() does...
+	// drawStripHE() does...
 	if ((code >= 134 && code <= 138) || (code >= 144 && code <= 148)) {
 		_decomp_shr = code % 10;
 		_decomp_mask = 0xFF >> (8 - _decomp_shr);
 
-		decompressBMAPbg((byte *)vs->backBuf, width, vs->w, vs->h, bmap_ptr);
+		drawStripHE((byte *)vs->backBuf, width, bmap_ptr, vs->w, vs->h, false);
 	}
 	copyVirtScreenBuffers(Common::Rect(0, 0, vs->w - 1, vs->h - 1));
 
@@ -2080,12 +2080,12 @@
 			break;
 	
 		case 13:
-			drawStripHE(dst, dstPitch, src, numLinesToProcess, false);
+			drawStripHE(dst, dstPitch, src, 8, numLinesToProcess, false);
 			break;
 	
 		case 14:
 			useOrDecompress = true;
-			drawStripHE(dst, dstPitch, src, numLinesToProcess, true);
+			drawStripHE(dst, dstPitch, src, 8, numLinesToProcess, true);
 			break;
 	
 		default:
@@ -2155,9 +2155,7 @@
 		}                             \
 	} while (0)
 
-
-// NOTE: decompressBMAPbg is actually very similar to drawStripComplex
-void Gdi::decompressBMAPbg(byte *dst, int dstPitch, int w, int height, const byte *src) const {
+void Gdi::drawStripHE(byte *dst, int dstPitch, const byte *src, int w, int height, const bool transpCheck) const {
 	uint32 dataBit, data, shift;
 	byte color;
 	int32 iteration;
@@ -2170,45 +2168,6 @@
 
 	while (height) {
 		for (iteration = 0; iteration < w; iteration++) {
-			*dst++ = color;
-			FILL_BITS;
-			
-			if (READ_BIT) {
-				if (!READ_BIT) {
-					color = data & _decomp_mask;
-					shift -= _decomp_shr;
-					data >>= _decomp_shr;
-				} else {
-					dataBit = data & 7;
-					shift -= 3;
-					data >>= 3;
-					// map (0, 1, 2, 3, 4, 5, 6, 7) to (-4, -3, -2, -1, 1, 2, 3, 4)
-					if (dataBit >= 4)
-						color += dataBit - 3;
-					else
-						color += dataBit - 4;
-				}
-			}
-		}
-		dst += dstPitch - w;
-		height--;
-	}
-}
-
-// FIXME/TODO: drawStripHE and decompressBMAPbg are essentially identical!
-void Gdi::drawStripHE(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const {
-	uint32 dataBit, data, shift, iteration;
-	byte color;
-	const uint w = 8;
-
-	color = *src;
-	src++;
-	data = READ_LE_UINT24(src);
-	src += 3;
-	shift = 24;
-
-	while (height) {
-		for (iteration = 0; iteration < w; iteration++) {
 			if (!transpCheck || color != _transparentColor)
 				*dst = _roomPalette[color];
 			dst++;

Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.h,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- gfx.h	24 Sep 2004 23:33:32 -0000	1.80
+++ gfx.h	25 Sep 2004 11:17:23 -0000	1.81
@@ -250,7 +250,8 @@
 	void unkDecode10(byte *dst, int dstPitch, const byte *src, int height) const;
 	void unkDecode11(byte *dst, int dstPitch, const byte *src, int height) const;
 	void drawStrip3DO(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const;
-	void drawStripHE(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const;
+
+	void drawStripHE(byte *dst, int dstPitch, const byte *src, int w, int height, const bool transpCheck) const;
 
 	/* Mask decompressors */
 	void drawStripC64Mask(byte *dst, int stripnr, int width, int height) const;
@@ -265,8 +266,6 @@
 	
 	int getZPlanes(const byte *smap_ptr, const byte *zplane_list[9]) const;
 
-	void decompressBMAPbg(byte *dst, int dstPitch, int w, int h, const byte *ptr) const;
-
 	void drawBitmapV2Helper(const byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height, 
 	                int stripnr, int numstrip, StripTable *table);
 





More information about the Scummvm-git-logs mailing list