[Scummvm-cvs-logs] SF.net SVN: scummvm:[39477] scummvm/trunk/engines/sword1/screen.cpp

Hkz at users.sourceforge.net Hkz at users.sourceforge.net
Tue Mar 17 09:03:29 CET 2009


Revision: 39477
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39477&view=rev
Author:   Hkz
Date:     2009-03-17 08:03:29 +0000 (Tue, 17 Mar 2009)

Log Message:
-----------
sword1: optimize drawing routine for screen 54

Modified Paths:
--------------
    scummvm/trunk/engines/sword1/screen.cpp

Modified: scummvm/trunk/engines/sword1/screen.cpp
===================================================================
--- scummvm/trunk/engines/sword1/screen.cpp	2009-03-17 07:57:02 UTC (rev 39476)
+++ scummvm/trunk/engines/sword1/screen.cpp	2009-03-17 08:03:29 UTC (rev 39477)
@@ -376,18 +376,29 @@
 		if(SwordEngine::isPsx()) {
 			if (!_psxCache.decodedBackground)
 				_psxCache.decodedBackground = psxShrinkedBackgroundToIndexed(_layerBlocks[0], _scrnSizeX, _scrnSizeY);
-			src = _psxCache.decodedBackground;
-		}
-
+			memcpy(_screenBuf, _psxCache.decodedBackground, _scrnSizeX * _scrnSizeY);
+		} else {
+#if 0
 		for (uint16 cnty = 0; cnty < _scrnSizeY; cnty++)
 			for (uint16 cntx = 0; cntx < _scrnSizeX; cntx++) {
-				if (*src)
+				if (*(src + cnty * _scrnSizeX + cntx))
 					if (!(SwordEngine::isMac()) || *src != 255) // see bug #1701058
-						*dest = *src;
-				dest++;
-				src++;
+						*(dest + cnty * _scrnSizeX + cntx) = *(src + cnty * _scrnSizeX + cntx);
 			}
+#endif
 
+			uint16 scrnScrlY = MIN((uint32)_oldScrollY, Logic::_scriptVars[SCROLL_OFFSET_Y]);
+			uint16 scrnHeight = SCREEN_DEPTH + ABS((int32)_oldScrollY - (int32)Logic::_scriptVars[SCROLL_OFFSET_Y]);
+
+			// In this background to create transparency we have to iterate through all pixels, avoid checking those out of screen
+			for (uint16 cnty = scrnScrlY; (cnty < _scrnSizeY) && (cnty < scrnHeight + scrnScrlY); cnty++)
+				for (uint16 cntx = 0; cntx < _scrnSizeX; cntx++) {
+					if (*(src + cnty * _scrnSizeX + cntx))
+						if (!(SwordEngine::isMac()) || *src != 255) // see bug #1701058
+							*(dest + cnty * _scrnSizeX + cntx) = *(src + cnty * _scrnSizeX + cntx);
+				}
+	}
+
 	} else if (!(SwordEngine::isPsx())) {
 		memcpy(_screenBuf, _layerBlocks[0], _scrnSizeX * _scrnSizeY);
 	} else { //We are using PSX version


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list