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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Jul 30 19:52:44 CEST 2009


Revision: 42938
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42938&view=rev
Author:   fingolfin
Date:     2009-07-30 17:52:44 +0000 (Thu, 30 Jul 2009)

Log Message:
-----------
minor cleanup to scale2x, to avoid confusing the compiler about potential pointer aliasing (only the tip of the iceberg, of course... ;)

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

Modified: scummvm/trunk/engines/scumm/gfx.cpp
===================================================================
--- scummvm/trunk/engines/scumm/gfx.cpp	2009-07-30 17:48:03 UTC (rev 42937)
+++ scummvm/trunk/engines/scumm/gfx.cpp	2009-07-30 17:52:44 UTC (rev 42938)
@@ -758,18 +758,18 @@
 }
 
 void scale2x(byte *dst, int dstPitch, const byte *src, int srcPitch, int w, int h) {
-	byte *dstL1 = dst;
-	byte *dstL2 = dst + dstPitch;
+	uint16 *dstL1 = (uint16 *)dst;
+	uint16 *dstL2 = (uint16 *)(dst + dstPitch);
 
-	int dstAdd = dstPitch * 2 - w * 2;
-	int srcAdd = srcPitch - w;
+	const int dstAdd = dstPitch - w;
+	const int srcAdd = srcPitch - w;
 
 	while (h--) {
-		for (int x = 0; x < w; ++x, dstL1 += 2, dstL2 += 2) {
+		for (int x = 0; x < w; ++x) {
 			uint16 col = *src++;
 			col |= col << 8;
-			*(uint16*)(dstL1) = col;
-			*(uint16*)(dstL2) = col;
+			*dstL1++ = col;
+			*dstL2++ = col;
 		}
 		dstL1 += dstAdd; dstL2 += dstAdd;
 		src += srcAdd;


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