[Scummvm-cvs-logs] CVS: scummvm/common scaler.cpp,1.11,1.11.2.1 scaler.h,1.7,1.7.2.1

Max Horn fingolfin at users.sourceforge.net
Sun May 25 05:13:03 CEST 2003


Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1:/tmp/cvs-serv19896/common

Modified Files:
      Tag: branch-0-4-0
	scaler.cpp scaler.h 
Log Message:
synced scalers, sdl & GP32 backend with trunk

Index: scaler.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/scaler.cpp,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -u -d -r1.11 -r1.11.2.1
--- scaler.cpp	25 Apr 2003 20:02:57 -0000	1.11
+++ scaler.cpp	25 May 2003 12:12:32 -0000	1.11.2.1
@@ -155,8 +155,8 @@
 #define RED_MASK555 0x7C007C00
 #define GREEN_MASK555 0x03E003E0
 
-void Super2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
-	uint16 *bP;
+void Super2xSaI(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
+	const uint16 *bP;
 	uint8 *dP;
 	uint32 inc_bP;
 
@@ -165,7 +165,7 @@
 		inc_bP = 1;
 
 		while (height--) {
-			bP = (uint16 *)srcPtr;
+			bP = (const uint16 *)srcPtr;
 			dP = (uint8 *)dstPtr;
 
 			for (uint32 finish = width; finish; finish -= inc_bP) {
@@ -271,9 +271,9 @@
 	}
 }
 
-void SuperEagle(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
+void SuperEagle(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
 	uint8 *dP;
-	uint16 *bP;
+	const uint16 *bP;
 	uint32 inc_bP;
 
 	{
@@ -282,7 +282,7 @@
 		uint32 Nextline = srcPitch >> 1;
 
 		while (height--) {
-			bP = (uint16 *)srcPtr;
+			bP = (const uint16 *)srcPtr;
 			dP = dstPtr;
 			for (uint32 finish = width; finish; finish -= inc_bP) {
 				uint32 color4, color5, color6;
@@ -388,9 +388,9 @@
 	}
 }
 
-void _2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
+void _2xSaI(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
 	uint8 *dP;
-	uint16 *bP;
+	const uint16 *bP;
 	uint32 inc_bP;
 
 	{
@@ -399,7 +399,7 @@
 		uint32 Nextline = srcPitch >> 1;
 
 		while (height--) {
-			bP = (uint16 *)srcPtr;
+			bP = (const uint16 *)srcPtr;
 			dP = dstPtr;
 
 			for (uint32 finish = width; finish; finish -= inc_bP) {
@@ -582,10 +582,10 @@
 // FIXME: Scale_2xSaI is not used anywhere; however, contrary to the _2xSaI function,
 // it seems to allow for arbitrary scale factors, not just 2x... hence I leave this in
 // for now, as that seems to be a very useful feature
-void Scale_2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
+void Scale_2xSaI(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
 								 uint32 dstWidth, uint32 dstHeight, int width, int height) {
 	uint8 *dP;
-	uint16 *bP;
+	const uint16 *bP;
 
 	uint32 w;
 	uint32 h;
@@ -605,7 +605,7 @@
 		uint32 y1, y2;
 
 		y1 = h & 0xffff;						// fraction part of fixed point
-		bP = (uint16 *)(srcPtr + ((h >> 16) * srcPitch));
+		bP = (const uint16 *)(srcPtr + ((h >> 16) * srcPitch));
 		dP = dstPtr;
 		y2 = 0x10000 - y1;
 
@@ -713,10 +713,10 @@
 	}
 }
 
-void AdvMame2x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
+void AdvMame2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
 							 int width, int height) {
 	unsigned int nextlineSrc = srcPitch / sizeof(uint16);
-	uint16 *p = (uint16 *)srcPtr;
+	const uint16 *p = (const uint16 *)srcPtr;
 
 	unsigned int nextlineDst = dstPitch / sizeof(uint16);
 	uint16 *q = (uint16 *)dstPtr;
@@ -726,9 +726,12 @@
 	uint16 G, H, I;
 
 	while (height--) {
-		B = C = *(p - nextlineSrc);
-		E = F = *(p);
-		H = I = *(p + nextlineSrc);
+		B = *(p - 1 - nextlineSrc);
+		E = *(p - 1);
+		H = *(p - 1 + nextlineSrc);
+		C = *(p - nextlineSrc);
+		F = *(p);
+		I = *(p + nextlineSrc);
 		for (int i = 0; i < width; ++i) {
 			p++;
 			A = B; B = C; C = *(p - nextlineSrc);
@@ -746,7 +749,48 @@
 	}
 }
 
-void Normal1x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
+void AdvMame3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
+							 int width, int height) {
+	unsigned int nextlineSrc = srcPitch / sizeof(uint16);
+	const uint16 *p = (const uint16 *)srcPtr;
+
+	unsigned int nextlineDst = dstPitch / sizeof(uint16);
+	uint16 *q = (uint16 *)dstPtr;
+	
+	uint16 A, B, C;
+	uint16 D, E, F;
+	uint16 G, H, I;
+
+	while (height--) {
+		B = *(p - 1 - nextlineSrc);
+		E = *(p - 1);
+		H = *(p - 1 + nextlineSrc);
+		C = *(p - nextlineSrc);
+		F = *(p);
+		I = *(p + nextlineSrc);
+		for (int i = 0; i < width; ++i) {
+			p++;
+			A = B; B = C; C = *(p - nextlineSrc);
+			D = E; E = F; F = *(p);
+			G = H; H = I; I = *(p + nextlineSrc);
+
+			*(q) = D == B && B != F && D != H ? D : E;
+			*(q + 1) = E;
+			*(q + 2) = B == F && B != D && F != H ? F : E;
+			*(q + nextlineDst) = E;
+			*(q + nextlineDst + 1) = E;
+			*(q + nextlineDst + 2) = E;
+			*(q + 2 * nextlineDst) = D == H && D != B && H != F ? D : E;
+			*(q + 2 * nextlineDst + 1) = E;
+			*(q + 2 * nextlineDst + 2) = H == F && D != H && B != F ? F : E;
+			q += 3;
+		}
+		p += nextlineSrc - width;
+		q += (nextlineDst - width) * 3;
+	}
+}
+
+void Normal1x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
 							int width, int height) {
 	while (height--) {
 		memcpy(dstPtr, srcPtr, 2 * width);
@@ -755,14 +799,14 @@
 	}
 }
 
-void Normal2x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
+void Normal2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
 							int width, int height) {
 	uint8 *r;
 
 	while (height--) {
 		r = dstPtr;
 		for (int i = 0; i < width; ++i, r += 4) {
-			uint16 color = *(((uint16 *)srcPtr) + i);
+			uint16 color = *(((const uint16 *)srcPtr) + i);
 
 			*(uint16 *)(r + 0) = color;
 			*(uint16 *)(r + 2) = color;
@@ -774,7 +818,7 @@
 	}
 }
 
-void Normal3x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
+void Normal3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
 							int width, int height) {
 	uint8 *r;
 	uint32 dstPitch2 = dstPitch * 2;
@@ -783,7 +827,7 @@
 	while (height--) {
 		r = dstPtr;
 		for (int i = 0; i < width; ++i, r += 6) {
-			uint16 color = *(((uint16 *)srcPtr) + i);
+			uint16 color = *(((const uint16 *)srcPtr) + i);
 
 			*(uint16 *)(r + 0) = color;
 			*(uint16 *)(r + 2) = color;
@@ -800,10 +844,10 @@
 	}
 }
 
-void TV2x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, 
+void TV2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, 
 					int width, int height) {
 	unsigned int nextlineSrc = srcPitch / sizeof(uint16);
-	uint16 *p = (uint16 *)srcPtr;
+	const uint16 *p = (const uint16 *)srcPtr;
 
 	unsigned int nextlineDst = dstPitch / sizeof(uint16);
 	uint16 *q = (uint16 *)dstPtr;
@@ -830,11 +874,11 @@
   return c - ((c >> 2) & *(dotmatrix + ((j & 3) << 2) + (i & 3)));
 }
 
-void DotMatrix(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
+void DotMatrix(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
 					int width, int height)
 {
 	unsigned int nextlineSrc = srcPitch / sizeof(uint16);
-	uint16 *p = (uint16 *)srcPtr;
+	const uint16 *p = (const uint16 *)srcPtr;
 
 	unsigned int nextlineDst = dstPitch / sizeof(uint16);
 	uint16 *q = (uint16 *)dstPtr;

Index: scaler.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/scaler.h,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -d -r1.7 -r1.7.2.1
--- scaler.h	2 May 2003 09:08:18 -0000	1.7
+++ scaler.h	25 May 2003 12:12:32 -0000	1.7.2.1
@@ -23,14 +23,18 @@
 
 extern int Init_2xSaI (uint32 BitFormat);
 
+typedef void ScalerProc(const uint8 *srcPtr, uint32 srcPitch,
+							uint8 *dstPtr, uint32 dstPitch, int width, int height);
+
 #define DECLARE_SCALER(x)	\
-	extern void x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, \
+	extern void x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, \
 					uint32 dstPitch, int width, int height)
 
 DECLARE_SCALER(_2xSaI);
 DECLARE_SCALER(Super2xSaI);
 DECLARE_SCALER(SuperEagle);
 DECLARE_SCALER(AdvMame2x);
+DECLARE_SCALER(AdvMame3x);
 DECLARE_SCALER(Normal1x);
 DECLARE_SCALER(Normal2x);
 DECLARE_SCALER(Normal3x);
@@ -46,8 +50,9 @@
 	GFX_SUPER2XSAI = 4,
 	GFX_SUPEREAGLE = 5,
 	GFX_ADVMAME2X = 6,
-	GFX_TV2X = 7,
-	GFX_DOTMATRIX = 8,
+	GFX_ADVMAME3X = 7,
+	GFX_TV2X = 8,
+	GFX_DOTMATRIX = 9,
 	
 	GFX_FLIPPING = 100,	// Palmos
 	GFX_DOUBLEBUFFER = 101	// Palmos





More information about the Scummvm-git-logs mailing list