[Scummvm-cvs-logs] SF.net SVN: scummvm:[48192] scummvm/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Mar 8 11:31:42 CET 2010


Revision: 48192
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48192&view=rev
Author:   fingolfin
Date:     2010-03-08 10:31:42 +0000 (Mon, 08 Mar 2010)

Log Message:
-----------
Rename PocketPCLandscapeAspect to Normal1xAspect and move it to
graphics/scaler/aspect.cpp

Modified Paths:
--------------
    scummvm/trunk/backends/platform/wince/CEScaler.cpp
    scummvm/trunk/backends/platform/wince/CEScaler.h
    scummvm/trunk/backends/platform/wince/wince-sdl.cpp
    scummvm/trunk/graphics/scaler/aspect.cpp
    scummvm/trunk/graphics/scaler/aspect.h
    scummvm/trunk/graphics/scaler.cpp
    scummvm/trunk/graphics/scaler.h

Modified: scummvm/trunk/backends/platform/wince/CEScaler.cpp
===================================================================
--- scummvm/trunk/backends/platform/wince/CEScaler.cpp	2010-03-08 10:31:09 UTC (rev 48191)
+++ scummvm/trunk/backends/platform/wince/CEScaler.cpp	2010-03-08 10:31:42 UTC (rev 48192)
@@ -25,67 +25,6 @@
 #include "graphics/scaler/intern.h"
 #include "CEScaler.h"
 
-void PocketPCLandscapeAspect(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
-
-	const int redblueMasks[] = { 0x7C1F, 0xF81F };
-	const int greenMasks[] = { 0x03E0, 0x07E0 };
-	const int RBM = redblueMasks[gBitFormat == 565];
-	const int GM = greenMasks[gBitFormat == 565];
-
-	int i,j;
-	unsigned int p1, p2;
-	const uint8 *inbuf, *instart;
-	uint8 *outbuf, *outstart;
-
-#define RB(x) ((x & RBM)<<8)
-#define G(x)  ((x & GM)<<3)
-
-#define P20(x) (((x)>>2)-((x)>>4))
-#define P40(x) (((x)>>1)-((x)>>3))
-#define P60(x) (((x)>>1)+((x)>>3))
-#define P80(x) (((x)>>1)+((x)>>2)+((x)>>4))
-
-#define MAKEPIXEL(rb,g) ((((rb)>>8) & RBM | ((g)>>3) & GM))
-
-	inbuf = (const uint8 *)srcPtr;
-	outbuf = (uint8 *)dstPtr;
-	height /= 5;
-
-	// Various casts below go via (void *) to avoid warning. This is
-	// safe as these are all even addresses.
-	for (i = 0; i < height; i++) {
-		instart = inbuf;
-		outstart = outbuf;
-		for (j=0; j < width; j++) {
-
-			p1 = *(const uint16*)(const void *)inbuf; inbuf += srcPitch;
-			*(uint16*)(void *)outbuf = p1; outbuf += dstPitch;
-
-			p2 = *(const uint16*)(const void *)inbuf; inbuf += srcPitch;
-			*(uint16*)(void *)outbuf = MAKEPIXEL(P20(RB(p1))+P80(RB(p2)),P20(G(p1))+P80(G(p2)));  outbuf += dstPitch;
-
-			p1 = p2;
-			p2 = *(const uint16*)(const void *)inbuf; inbuf += srcPitch;
-			*(uint16*)(void *)outbuf = MAKEPIXEL(P40(RB(p1))+P60(RB(p2)),P40(G(p1))+P60(G(p2)));  outbuf += dstPitch;
-
-			p1 = p2;
-			p2 = *(const uint16*)(const void *)inbuf; inbuf += srcPitch;
-			*(uint16*)(void *)outbuf = MAKEPIXEL(P60(RB(p1))+P40(RB(p2)),P60(G(p1))+P40(G(p2)));  outbuf += dstPitch;
-
-			p1 = p2;
-			p2 = *(const uint16*)(const void *)inbuf;
-			*(uint16*)(void *)outbuf = MAKEPIXEL(P80(RB(p1))+P20(RB(p2)),P80(G(p1))+P20(G(p2)));  outbuf += dstPitch;
-
-			*(uint16*)(void *)outbuf = p2;
-
-			inbuf = inbuf - srcPitch*4 + sizeof(uint16);
-			outbuf = outbuf - dstPitch*5 + sizeof(uint16);
-		}
-		inbuf = instart + srcPitch*5;
-		outbuf = outstart + dstPitch*6;
-	}
-}
-
 #ifdef ARM
 extern "C" {
 	void SmartphoneLandscapeARM(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height, int mask);

Modified: scummvm/trunk/backends/platform/wince/CEScaler.h
===================================================================
--- scummvm/trunk/backends/platform/wince/CEScaler.h	2010-03-08 10:31:09 UTC (rev 48191)
+++ scummvm/trunk/backends/platform/wince/CEScaler.h	2010-03-08 10:31:42 UTC (rev 48192)
@@ -32,16 +32,6 @@
 #include "graphics/scaler/intern.h"
 
 /**
- * This filter (up)scales the source image vertically by a factor of 6/5.
- * For example, a 320x200 image is scaled to 320x240.
- *
- * The main difference to the code in graphics/scaler/aspect.cpp is the
- * out-of-place operation, omitting a straight blit step the sdl backend
- * does. Also, tests show unaligned access errors with the stock aspect scaler.
- */
-DECLARE_SCALER(PocketPCLandscapeAspect);
-
-/**
  * This filter (down)scales the source image horizontally by a factor of 2/3
  * and vertically by 7/8. For example, a 320x200 image is scaled to 213x175.
  *

Modified: scummvm/trunk/backends/platform/wince/wince-sdl.cpp
===================================================================
--- scummvm/trunk/backends/platform/wince/wince-sdl.cpp	2010-03-08 10:31:09 UTC (rev 48191)
+++ scummvm/trunk/backends/platform/wince/wince-sdl.cpp	2010-03-08 10:31:42 UTC (rev 48192)
@@ -1166,7 +1166,7 @@
 				_scaleFactorXd = 1;
 				_scaleFactorYm = 6;
 				_scaleFactorYd = 5;
-				_scalerProc = PocketPCLandscapeAspect;
+				_scalerProc = Normal1xAspect;
 				_modeFlags = 0;
 				_videoMode.aspectRatioCorrection = true;
 			} else {

Modified: scummvm/trunk/graphics/scaler/aspect.cpp
===================================================================
--- scummvm/trunk/graphics/scaler/aspect.cpp	2010-03-08 10:31:09 UTC (rev 48191)
+++ scummvm/trunk/graphics/scaler/aspect.cpp	2010-03-08 10:31:42 UTC (rev 48192)
@@ -183,3 +183,109 @@
 		return stretch200To240<Graphics::ColorMasks<555> >(buf, pitch, width, height, srcX, srcY, origSrcY);
 }
 
+
+void Normal1xAspect(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
+
+	extern int gBitFormat;
+
+	const int redblueMasks[] = { 0x7C1F, 0xF81F };
+	const int greenMasks[] = { 0x03E0, 0x07E0 };
+	const int RBM = redblueMasks[gBitFormat == 565];
+	const int GM = greenMasks[gBitFormat == 565];
+
+	int i,j;
+	unsigned int p1, p2;
+	const uint8 *inbuf, *instart;
+	uint8 *outbuf, *outstart;
+
+#define RB(x) ((x & RBM)<<8)
+#define G(x)  ((x & GM)<<3)
+
+#define P20(x) (((x)>>2)-((x)>>4))
+#define P40(x) (((x)>>1)-((x)>>3))
+#define P60(x) (((x)>>1)+((x)>>3))
+#define P80(x) (((x)>>1)+((x)>>2)+((x)>>4))
+
+#define MAKEPIXEL(rb,g) ((((rb)>>8) & RBM | ((g)>>3) & GM))
+
+	inbuf = (const uint8 *)srcPtr;
+	outbuf = (uint8 *)dstPtr;
+	height /= 5;
+
+	// Various casts below go via (void *) to avoid warning. This is
+	// safe as these are all even addresses.
+	for (i = 0; i < height; i++) {
+		instart = inbuf;
+		outstart = outbuf;
+		for (j=0; j < width; j++) {
+
+			p1 = *(const uint16*)(const void *)inbuf; inbuf += srcPitch;
+			*(uint16*)(void *)outbuf = p1; outbuf += dstPitch;
+
+			p2 = *(const uint16*)(const void *)inbuf; inbuf += srcPitch;
+			*(uint16*)(void *)outbuf = MAKEPIXEL(P20(RB(p1))+P80(RB(p2)),P20(G(p1))+P80(G(p2)));  outbuf += dstPitch;
+
+			p1 = p2;
+			p2 = *(const uint16*)(const void *)inbuf; inbuf += srcPitch;
+			*(uint16*)(void *)outbuf = MAKEPIXEL(P40(RB(p1))+P60(RB(p2)),P40(G(p1))+P60(G(p2)));  outbuf += dstPitch;
+
+			p1 = p2;
+			p2 = *(const uint16*)(const void *)inbuf; inbuf += srcPitch;
+			*(uint16*)(void *)outbuf = MAKEPIXEL(P60(RB(p1))+P40(RB(p2)),P60(G(p1))+P40(G(p2)));  outbuf += dstPitch;
+
+			p1 = p2;
+			p2 = *(const uint16*)(const void *)inbuf;
+			*(uint16*)(void *)outbuf = MAKEPIXEL(P80(RB(p1))+P20(RB(p2)),P80(G(p1))+P20(G(p2)));  outbuf += dstPitch;
+
+			*(uint16*)(void *)outbuf = p2;
+
+			inbuf = inbuf - srcPitch*4 + sizeof(uint16);
+			outbuf = outbuf - dstPitch*5 + sizeof(uint16);
+		}
+		inbuf = instart + srcPitch*5;
+		outbuf = outstart + dstPitch*6;
+	}
+}
+
+
+#ifdef USE_ARM_SCALER_ASM
+extern "C" void Normal2xAspectMask(const uint8  *srcPtr,
+                                         uint32  srcPitch,
+                                         uint8  *dstPtr,
+                                         uint32  dstPitch,
+                                         int     width,
+                                         int     height,
+                                         uint32  mask);
+
+/**
+ * A 2x scaler which also does aspect ratio correction.
+ * This is Normal2x combined with vertical stretching,
+ * so it will scale a 320x200 surface to a 640x480 surface.
+ */
+void Normal2xAspect(const uint8  *srcPtr,
+                          uint32  srcPitch,
+                          uint8  *dstPtr,
+                          uint32  dstPitch,
+                          int     width,
+                          int     height) {
+	if (gBitFormat == 565) {
+		Normal2xAspectMask(srcPtr,
+		                   srcPitch,
+		                   dstPtr,
+		                   dstPitch,
+		                   width,
+		                   height,
+		                   0x07e0F81F);
+	} else {
+		Normal2xAspectMask(srcPtr,
+		                   srcPitch,
+		                   dstPtr,
+		                   dstPitch,
+		                   width,
+		                   height,
+		                   0x03e07C1F);
+	}
+}
+
+#endif	// USE_ARM_SCALER_ASM
+

Modified: scummvm/trunk/graphics/scaler/aspect.h
===================================================================
--- scummvm/trunk/graphics/scaler/aspect.h	2010-03-08 10:31:09 UTC (rev 48191)
+++ scummvm/trunk/graphics/scaler/aspect.h	2010-03-08 10:31:42 UTC (rev 48192)
@@ -26,6 +26,7 @@
 #define GRAPHICS_SCALER_ASPECT_H
 
 #include "common/scummsys.h"
+#include "graphics/scaler.h"
 
 /**
  * TODO: explain
@@ -57,7 +58,19 @@
                     int srcY,
                     int origSrcY);
 
-// TODO: Move Normal2xAspect & PocketPCLandscapeAspect here;
-// also rename the latter to Normal1xAspect
 
+/**
+ * This filter (up)scales the source image vertically by a factor of 6/5.
+ * For example, a 320x200 image is scaled to 320x240.
+ *
+ * The main difference to the code in graphics/scaler/aspect.cpp is the
+ * out-of-place operation, omitting a straight blit step the sdl backend
+ * does. Also, tests show unaligned access errors with the stock aspect scaler.
+ */
+DECLARE_SCALER(Normal1xAspect);
+
+#ifdef USE_ARM_SCALER_ASM
+DECLARE_SCALER(Normal2xAspect);
 #endif
+
+#endif

Modified: scummvm/trunk/graphics/scaler.cpp
===================================================================
--- scummvm/trunk/graphics/scaler.cpp	2010-03-08 10:31:09 UTC (rev 48191)
+++ scummvm/trunk/graphics/scaler.cpp	2010-03-08 10:31:42 UTC (rev 48192)
@@ -178,45 +178,9 @@
 }
 
 #ifndef DISABLE_SCALERS
-#ifdef USE_ARM_SCALER_ASM
-extern "C" void Normal2xAspectMask(const uint8  *srcPtr,
-                                         uint32  srcPitch,
-                                         uint8  *dstPtr,
-                                         uint32  dstPitch,
-                                         int     width,
-                                         int     height,
-                                         uint32  mask);
 
-/**
- * A 2x scaler which also does aspect ratio correction.
- * This is Normal2x combined with vertical stretching,
- * so it will scale a 320x200 surface to a 640x480 surface.
- */
-void Normal2xAspect(const uint8  *srcPtr,
-                          uint32  srcPitch,
-                          uint8  *dstPtr,
-                          uint32  dstPitch,
-                          int     width,
-                          int     height) {
-	if (gBitFormat == 565) {
-		Normal2xAspectMask(srcPtr,
-		                   srcPitch,
-		                   dstPtr,
-		                   dstPitch,
-		                   width,
-		                   height,
-		                   0x07e0F81F);
-	} else {
-		Normal2xAspectMask(srcPtr,
-		                   srcPitch,
-		                   dstPtr,
-		                   dstPitch,
-		                   width,
-		                   height,
-		                   0x03e07C1F);
-	}
-}
 
+#ifdef USE_ARM_SCALER_ASM
 extern "C" void Normal2xARM(const uint8  *srcPtr,
                                   uint32  srcPitch,
                                   uint8  *dstPtr,
@@ -422,4 +386,4 @@
 	}
 }
 
-#endif
+#endif // #ifndef DISABLE_SCALERS

Modified: scummvm/trunk/graphics/scaler.h
===================================================================
--- scummvm/trunk/graphics/scaler.h	2010-03-08 10:31:09 UTC (rev 48191)
+++ scummvm/trunk/graphics/scaler.h	2010-03-08 10:31:42 UTC (rev 48192)
@@ -38,18 +38,22 @@
 	extern void x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, \
 					uint32 dstPitch, int width, int height)
 
+
+DECLARE_SCALER(Normal1x);
+
+#ifndef DISABLE_SCALERS
+
+DECLARE_SCALER(Normal2x);
+DECLARE_SCALER(Normal3x);
+DECLARE_SCALER(Normal1o5x);
+
 DECLARE_SCALER(_2xSaI);
 DECLARE_SCALER(Super2xSaI);
 DECLARE_SCALER(SuperEagle);
+
 DECLARE_SCALER(AdvMame2x);
 DECLARE_SCALER(AdvMame3x);
-DECLARE_SCALER(Normal1x);
-DECLARE_SCALER(Normal2x);
-#ifdef USE_ARM_SCALER_ASM
-DECLARE_SCALER(Normal2xAspect);
-#endif
-DECLARE_SCALER(Normal3x);
-DECLARE_SCALER(Normal1o5x);
+
 DECLARE_SCALER(TV2x);
 DECLARE_SCALER(DotMatrix);
 
@@ -58,6 +62,8 @@
 DECLARE_SCALER(HQ3x);
 #endif
 
+#endif // #ifndef DISABLE_SCALERS
+
 // creates a 160x100 thumbnail for 320x200 games
 // and 160x120 thumbnail for 320x240 and 640x480 games
 // only 565 mode


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