[Scummvm-cvs-logs] SF.net SVN: scummvm:[33167] scummvm/trunk/engines/agos/gfx.cpp

tramboi at users.sourceforge.net tramboi at users.sourceforge.net
Mon Jul 21 12:14:14 CEST 2008


Revision: 33167
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33167&view=rev
Author:   tramboi
Date:     2008-07-21 10:13:44 +0000 (Mon, 21 Jul 2008)

Log Message:
-----------
Avoid branching in the inner loop of AGOS drawVertImageCompressed

Modified Paths:
--------------
    scummvm/trunk/engines/agos/gfx.cpp

Modified: scummvm/trunk/engines/agos/gfx.cpp
===================================================================
--- scummvm/trunk/engines/agos/gfx.cpp	2008-07-21 09:53:06 UTC (rev 33166)
+++ scummvm/trunk/engines/agos/gfx.cpp	2008-07-21 10:13:44 UTC (rev 33167)
@@ -8,7 +8,7 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
-
+d
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -806,7 +806,6 @@
 void AGOSEngine::drawVertImageCompressed(VC10_state *state) {
 	assert (state->flags & kDFCompressed) ;
 	uint w, h;
-	byte *src, *dst, *dstPtr;
 
 	state->x_skip *= 4;				/* reached */
 
@@ -815,7 +814,7 @@
 
 	vc10_skip_cols(state);
 
-	dstPtr = state->surf_addr;
+	byte *dstPtr = state->surf_addr;
 	if (!(state->flags & kDFNonTrans) && (state->flags & 0x40)) { /* reached */
 		dstPtr += vcReadVar(252);
 	}
@@ -823,20 +822,34 @@
 	do {
 		byte color;
 
-		src = vc10_depackColumn(state);
-		dst = dstPtr;
+		const byte *src = vc10_depackColumn(state);
+		byte *dst = dstPtr;
 
 		h = 0;
-		do {
-			color = (*src / 16);
-			if ((state->flags & kDFNonTrans) || color != 0)
+		if (state->flags & kDFNonTrans)  {
+			do {
+				byte colors = *src;
+				color = (colors / 16);
 				dst[0] = color | state->palette;
-			color = (*src & 15);
-			if ((state->flags & kDFNonTrans) || color != 0)
+				color = (colors & 15);
 				dst[1] = color | state->palette;
-			dst += state->surf_pitch;
-			src++;
-		} while (++h != state->draw_height);
+				dst += state->surf_pitch;
+				src++;
+			} while (++h != state->draw_height);
+		}
+		else {
+			do {
+				byte colors = *src;
+				color = (colors / 16);
+				if (color != 0)
+					dst[0] = color | state->palette;
+				color = (colors & 15);
+				if (color != 0)
+					dst[1] = color | state->palette;
+				dst += state->surf_pitch;
+				src++;
+			} while (++h != state->draw_height);
+		}
 		dstPtr += 2;
 	} while (++w != state->draw_width);
 }


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