[Scummvm-cvs-logs] CVS: scummvm/sky screen.cpp,1.20,1.21

Robert G?ffringmann lavosspawn at users.sourceforge.net
Sun Jun 1 17:54:13 CEST 2003


Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv29594/sky

Modified Files:
	screen.cpp 
Log Message:
screen combine rectangles now. even a bit less cpu usage.

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/screen.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- screen.cpp	1 Jun 2003 22:53:44 -0000	1.20
+++ screen.cpp	2 Jun 2003 00:53:31 -0000	1.21
@@ -179,10 +179,14 @@
 	// drawMouseToBackScreen();
 	uint8 *screenPos = _currentScreen;
 	uint8 *backPos = _backScreen;
+	uint32 copyX, copyWidth;
 	for (uint8 cnty = 0; cnty < GRID_Y; cnty++) {
+		copyWidth = 0;
 		for (uint8 cntx = 0; cntx < GRID_X; cntx++) {
 			if (_gameGrid[cnty * GRID_X + cntx] & 1) {
 				_gameGrid[cnty * GRID_X + cntx] &= ~1;
+				if (!copyWidth) copyX = cntx * GRID_W;
+				copyWidth += GRID_W;
 				uint8 *copySrc = backPos;
 				uint8 *copyDest = screenPos;
 				for (uint8 gridLineCnt = 0; gridLineCnt < GRID_H; gridLineCnt++) {
@@ -190,10 +194,16 @@
 					copySrc += GAME_SCREEN_WIDTH;
 					copyDest += GAME_SCREEN_WIDTH;
 				}
-				_system->copy_rect(screenPos, GAME_SCREEN_WIDTH, cntx * GRID_W, cnty * GRID_H, GRID_W, GRID_H);
+			} else if (copyWidth) {
+				_system->copy_rect(_currentScreen + cnty * GRID_H * GAME_SCREEN_WIDTH + copyX, GAME_SCREEN_WIDTH, copyX, cnty * GRID_H, copyWidth, GRID_H);
+				copyWidth = 0;
 			}
 			backPos += GRID_W;
 			screenPos += GRID_W;
+		}
+		if (copyWidth) {
+			_system->copy_rect(_currentScreen + cnty * GRID_H * GAME_SCREEN_WIDTH + copyX, GAME_SCREEN_WIDTH, copyX, cnty * GRID_H, copyWidth, GRID_H);
+			copyWidth = 0;
 		}
 		screenPos += (GRID_H - 1) * GAME_SCREEN_WIDTH;
 		backPos += (GRID_H - 1) * GAME_SCREEN_WIDTH;





More information about the Scummvm-git-logs mailing list