aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/gfx
diff options
context:
space:
mode:
authorEugene Sandulenko2010-08-21 21:44:44 +0000
committerEugene Sandulenko2010-10-12 23:12:41 +0000
commit4d11cf941e75eecb5682ca74cf92f631d3555671 (patch)
treec7ba56cb4bbef9d1a35348f0cf2b8e8173670569 /engines/sword25/gfx
parente9d6fa094eb53b23132093fb9cc46cac7b958a38 (diff)
downloadscummvm-rg350-4d11cf941e75eecb5682ca74cf92f631d3555671.tar.gz
scummvm-rg350-4d11cf941e75eecb5682ca74cf92f631d3555671.tar.bz2
scummvm-rg350-4d11cf941e75eecb5682ca74cf92f631d3555671.zip
SWORD25: Another attempt to implement alpha blending. Looks a bit better.
svn-id: r53275
Diffstat (limited to 'engines/sword25/gfx')
-rw-r--r--engines/sword25/gfx/opengl/glimage.cpp31
1 files changed, 17 insertions, 14 deletions
diff --git a/engines/sword25/gfx/opengl/glimage.cpp b/engines/sword25/gfx/opengl/glimage.cpp
index 9029a09054..97cd5be8a0 100644
--- a/engines/sword25/gfx/opengl/glimage.cpp
+++ b/engines/sword25/gfx/opengl/glimage.cpp
@@ -214,26 +214,29 @@ bool GLImage::Blit(int PosX, int PosY, int Flipping, Common::Rect *pPartRect, un
out = outo;
in = ino;
for (int j = 0; j < w; j++) {
- switch (*in) {
+ int r = *in++;
+ int g = *in++;
+ int b = *in++;
+ int a = *in++;
+ switch (a) {
case 0: // Full transparency
- in += 4;
out += 4;
break;
case 255: // Full opacity
- default:
- *out++ = *in++;
- *out++ = *in++;
- *out++ = *in++;
- *out++ = *in++;
+ *out++ = r;
+ *out++ = g;
+ *out++ = b;
+ *out++ = a;
break;
-#if 0
default: // alpha blending
- *out++ = 255;
- int alpha = *in++;
- for (int c = 0; c < 3; c++, out++, in++) {
- *out = (byte)((int)(*out - *in) * alpha + *in);
- }
-#endif
+ *out = (byte)((((int)(*out - r) * a + r) >> 8) & 0xff);
+ out++;
+ *out = (byte)((((int)(*out - g) * a + g) >> 8) & 0xff);
+ out++;
+ *out = (byte)((((int)(*out - b) * a + b) >> 8) & 0xff);
+ out++;
+ *out = 255;
+ out++;
}
}
outo += _backSurface->pitch;