[Scummvm-cvs-logs] SF.net SVN: scummvm:[53304] scummvm/trunk/engines/sword25/gfx/opengl/ glimage.cpp

sev at users.sourceforge.net sev at users.sourceforge.net
Wed Oct 13 01:24:52 CEST 2010


Revision: 53304
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53304&view=rev
Author:   sev
Date:     2010-10-12 23:24:52 +0000 (Tue, 12 Oct 2010)

Log Message:
-----------
SWORD25: Implement image filpping

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp

Modified: scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp	2010-10-12 23:24:31 UTC (rev 53303)
+++ scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp	2010-10-12 23:24:52 UTC (rev 53304)
@@ -182,10 +182,6 @@
 		warning("STUB: Sprite scaling (%f x %f)", ScaleX, ScaleY);
 	}
 
-	if (Flipping & (Image::FLIP_V | Image::FLIP_H)) {
-		warning("STUB: Sprite flipping");
-	}
-
 	if (PosX < 0) {
 		w -= PosX;
 		x1 = -PosX;
@@ -210,7 +206,18 @@
 	// weiterzuf\xFChren. Bei Gelegenheit ist dieses aber zu \xE4ndern.
 
 	// TODO: scaling
-	// TODO: Flipping
+	int inStep = 4;
+	int inoStep = m_Width * 4;
+	if (Flipping & Image::FLIP_V) {
+		inStep = -inStep;
+		x1 = x1 + w - 1;
+	}
+
+	if (Flipping & Image::FLIP_H) {
+		inoStep = -inoStep;
+		y1 = y1 + h - 1;
+	}
+
 	byte *ino = &_data[y1 * m_Width * 4 + x1 * 4];
 	byte *outo = (byte *)_backSurface->getBasePtr(PosX, PosY);
 	byte *in, *out;
@@ -219,10 +226,12 @@
 		out = outo;
 		in = ino;
 		for (int j = 0; j < w; j++) {
-			int r = *in++;
-			int g = *in++;
-			int b = *in++;
-			int a = *in++;
+			int r = in[0];
+			int g = in[1];
+			int b = in[2];
+			int a = in[3];
+			in += inStep;
+
 			switch (a) {
 			case 0: // Full transparency
 				out += 4;
@@ -266,7 +275,7 @@
 			}
 		}
 		outo += _backSurface->pitch;
-		ino += m_Width * 4;
+		ino += inoStep;
 	}
 
 	g_system->copyRectToScreen((byte *)_backSurface->getBasePtr(PosX, PosY), _backSurface->pitch, PosX, PosY, w, h);


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