[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.138,2.139

Max Horn fingolfin at users.sourceforge.net
Wed Jun 4 17:13:06 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv18649

Modified Files:
	gfx.cpp 
Log Message:
finished my drawBitmap optimisations

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.138
retrieving revision 2.139
diff -u -d -r2.138 -r2.139
--- gfx.cpp	4 Jun 2003 21:45:28 -0000	2.138
+++ gfx.cpp	5 Jun 2003 00:12:23 -0000	2.139
@@ -995,20 +995,22 @@
 		byte dither_table[128];
 		byte *ptr_dither_table;
 		memset(dither_table, 0, sizeof(dither_table));
-		int theX, theY;
+		int theX, theY, maxX;
 		
 		if (table) {
 			src = smap_ptr + table->offsets[stripnr];
 			theX = left;
+			maxX = right;
 		} else {
 			src = smap_ptr;
 			theX = 0;
+			maxX = width;
 		}
 		
 		// Draw image data. To do this, we decode the full RLE graphics data,
 		// but only draw those parts we actually want to display.
 		assert(height <= 128);
-		for (; theX < width; theX++) {
+		for (; theX < maxX; theX++) {
 			ptr_dither_table = dither_table;
 			for (theY = 0; theY < height; theY++) {
 				if (--run == 0) {
@@ -1050,23 +1052,23 @@
 			run = *src++;
 			theX = 0;
 		}
-		while (theX < width) {
+		while (theX < right) {
 			if (run & 0x80) {
 				run &= 0x7f;
 				data = *src++;
 				do {
-					if (left <= theX && theX < right) {
+					if (left <= theX) {
 						*mask_ptr = data;
 						mask_ptr += _numStrips;
 					}
 					theY++;
 					if (theY >= height) {
-						if (left <= theX && theX < right) {
+						if (left <= theX) {
 							mask_ptr -= height * _numStrips - 1;
 						}
 						theY = 0;
 						theX += 8;
-						if (theX >= width)
+						if (theX >= right)
 							break;
 					}
 				} while (--run);
@@ -1074,18 +1076,18 @@
 				do {
 					data = *src++;
 					
-					if (left <= theX && theX < right) {
+					if (left <= theX) {
 						*mask_ptr = data;
 						mask_ptr += _numStrips;
 					}
 					theY++;
 					if (theY >= height) {
-						if (left <= theX && theX < right) {
+						if (left <= theX) {
 							mask_ptr -= _numStrips * height - 1;
 						}
 						theY = 0;
 						theX += 8;
-						if (theX >= width)
+						if (theX >= right)
 							break;
 					}
 				} while (--run);





More information about the Scummvm-git-logs mailing list