[Scummvm-cvs-logs] CVS: scummvm 2xsai.cpp,1.4,1.5

Max Horn fingolfin at users.sourceforge.net
Fri May 3 17:06:25 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv20724

Modified Files:
	2xsai.cpp 
Log Message:
added some simple (8bit) 1x/2x/3x scalers, could probably be optimized

Index: 2xsai.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/2xsai.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- 2xsai.cpp	27 Apr 2002 07:42:13 -0000	1.4
+++ 2xsai.cpp	4 May 2002 00:05:45 -0000	1.5
@@ -761,3 +761,67 @@
 		q += nextlineDst << 1;
 	}
 }
+
+
+/* Beware! Contrary to the other functions in this file, this blits from 8 to 8 bit! */
+void Normal1x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, int width, int height)
+{
+	uint8* r;
+
+	for(int j = 0; j < height; ++j) {
+		r = dstPtr;
+		for(int i = 0; i < width; ++i, ++r) {
+			uint8 color = *(srcPtr + i );
+
+			*r = color;
+		}
+		srcPtr += srcPitch;
+		dstPtr += dstPitch;
+	}
+}
+
+/* Beware! Contrary to the other functions in this file, this blits from 8 to 8 bit! */
+void Normal2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, int width, int height)
+{
+	uint8* r;
+
+	for(int j = 0; j < height; ++j) {
+		r = dstPtr;
+		for(int i = 0; i < width; ++i, r+=2) {
+			uint8 color = *(srcPtr + i );
+
+			*(r) = color;
+			*(r + 1) = color;
+			*(r + dstPitch) = color;
+			*(r + dstPitch + 1) = color;
+		}
+		srcPtr += srcPitch;
+		dstPtr += dstPitch << 1;
+	}
+}
+
+/* Beware! Contrary to the other functions in this file, this blits from 8 to 8 bit! */
+void Normal3x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, int width, int height)
+{
+	uint8* r;
+	uint32 dstPitch2 = dstPitch << 1;
+
+	for(int j = 0; j < height; ++j) {
+		r = dstPtr;
+		for(int i = 0; i < width; ++i, r+=3) {
+			uint8 color = *(srcPtr + i);
+
+			*(r + 0) = color;
+			*(r + 1) = color;
+			*(r + 2) = color;
+			*(r + 0 + dstPitch) = color;
+			*(r + 1 + dstPitch) = color;
+			*(r + 2 + dstPitch) = color;
+			*(r + 0 + dstPitch2) = color;
+			*(r + 1 + dstPitch2) = color;
+			*(r + 2 + dstPitch2) = color;
+		}
+		srcPtr += srcPitch;
+		dstPtr += dstPitch * 3;
+	}
+}





More information about the Scummvm-git-logs mailing list