[Scummvm-cvs-logs] SF.net SVN: scummvm:[53275] scummvm/trunk/engines/sword25/gfx/opengl/ glimage.cpp
sev at users.sourceforge.net
sev at users.sourceforge.net
Wed Oct 13 01:12:41 CEST 2010
Revision: 53275
http://scummvm.svn.sourceforge.net/scummvm/?rev=53275&view=rev
Author: sev
Date: 2010-10-12 23:12:41 +0000 (Tue, 12 Oct 2010)
Log Message:
-----------
SWORD25: Another attempt to implement alpha blending. Looks a bit better.
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:12:20 UTC (rev 53274)
+++ scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp 2010-10-12 23:12:41 UTC (rev 53275)
@@ -214,26 +214,29 @@
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;
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