aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2010-09-01 09:52:51 +0000
committerEugene Sandulenko2010-10-12 23:24:52 +0000
commita5d895473cd6d5c95ed1d17c885ce45e46c2873f (patch)
tree5f58cbce6f01ea7cd801ac46458d5027134737af
parent2b2330ce65783a5dd86bc882481e383df501f460 (diff)
downloadscummvm-rg350-a5d895473cd6d5c95ed1d17c885ce45e46c2873f.tar.gz
scummvm-rg350-a5d895473cd6d5c95ed1d17c885ce45e46c2873f.tar.bz2
scummvm-rg350-a5d895473cd6d5c95ed1d17c885ce45e46c2873f.zip
SWORD25: Implement image filpping
svn-id: r53304
-rw-r--r--engines/sword25/gfx/opengl/glimage.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/engines/sword25/gfx/opengl/glimage.cpp b/engines/sword25/gfx/opengl/glimage.cpp
index 7c1b95be3f..53b7c7b7b8 100644
--- a/engines/sword25/gfx/opengl/glimage.cpp
+++ b/engines/sword25/gfx/opengl/glimage.cpp
@@ -182,10 +182,6 @@ bool GLImage::Blit(int PosX, int PosY, int Flipping, Common::Rect *pPartRect, un
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 @@ bool GLImage::Blit(int PosX, int PosY, int Flipping, Common::Rect *pPartRect, un
// weiterzuführen. Bei Gelegenheit ist dieses aber zu ändern.
// 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 @@ bool GLImage::Blit(int PosX, int PosY, int Flipping, Common::Rect *pPartRect, un
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 @@ bool GLImage::Blit(int PosX, int PosY, int Flipping, Common::Rect *pPartRect, un
}
}
outo += _backSurface->pitch;
- ino += m_Width * 4;
+ ino += inoStep;
}
g_system->copyRectToScreen((byte *)_backSurface->getBasePtr(PosX, PosY), _backSurface->pitch, PosX, PosY, w, h);