[Scummvm-cvs-logs] SF.net SVN: scummvm:[42192] scummvm/branches/gsoc2009-draci/engines/draci

dkasak13 at users.sourceforge.net dkasak13 at users.sourceforge.net
Mon Jul 6 21:41:13 CEST 2009


Revision: 42192
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42192&view=rev
Author:   dkasak13
Date:     2009-07-06 19:41:13 +0000 (Mon, 06 Jul 2009)

Log Message:
-----------
Cache the transparent colour instead of calling a function for every pixel.

Modified Paths:
--------------
    scummvm/branches/gsoc2009-draci/engines/draci/font.cpp
    scummvm/branches/gsoc2009-draci/engines/draci/sprite.cpp

Modified: scummvm/branches/gsoc2009-draci/engines/draci/font.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/font.cpp	2009-07-06 19:26:53 UTC (rev 42191)
+++ scummvm/branches/gsoc2009-draci/engines/draci/font.cpp	2009-07-06 19:41:13 UTC (rev 42192)
@@ -162,6 +162,8 @@
 	int ySpaceLeft = dst->h - ty - 1;	
 	int yPixelsToDraw = (_fontHeight < ySpaceLeft) ? _fontHeight : ySpaceLeft;
 
+	int _transparent = dst->getTransparentColour();
+
 	for (int y = 0; y < yPixelsToDraw; ++y) {
 		for (int x = 0; x <= xPixelsToDraw; ++x) {
 
@@ -189,7 +191,7 @@
 			}
 			
 			// Paint pixel (if not transparent)
-			if (colour != dst->getTransparentColour())			
+			if (colour != _transparent)			
 				ptr[x] = colour;
 		}
 

Modified: scummvm/branches/gsoc2009-draci/engines/draci/sprite.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/sprite.cpp	2009-07-06 19:26:53 UTC (rev 42191)
+++ scummvm/branches/gsoc2009-draci/engines/draci/sprite.cpp	2009-07-06 19:41:13 UTC (rev 42192)
@@ -142,12 +142,14 @@
 	byte *dst = (byte *)surface->getBasePtr(clippedDestRect.left, clippedDestRect.top);
 	byte *src = _data;
 
+	int _transparent = surface->getTransparentColour();
+
 	// Blit the sprite to the surface
 	for (int i = sourceRect.top; i < sourceRect.bottom; ++i) {
 		for (int j = sourceRect.left; j < sourceRect.right; ++j) {
 			
 			// Don't blit if the pixel is transparent on the target surface
-			if (src[i * _width + j] != surface->getTransparentColour())	{
+			if (src[i * _width + j] != _transparent) {
 
 				// Draw the sprite mirrored if the _mirror flag is set						
 				if (_mirror) {


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