aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25
diff options
context:
space:
mode:
authorEugene Sandulenko2010-08-23 08:40:30 +0000
committerEugene Sandulenko2010-10-12 23:16:44 +0000
commita6d909c07f8a99e826f4a102111736e8198a5925 (patch)
tree1f1fa697e0fc40fbdc28db8c007e6a05c7abe0e7 /engines/sword25
parent18e2534b63c4dc6e77f36a5091bd2ff9d3b48900 (diff)
downloadscummvm-rg350-a6d909c07f8a99e826f4a102111736e8198a5925.tar.gz
scummvm-rg350-a6d909c07f8a99e826f4a102111736e8198a5925.tar.bz2
scummvm-rg350-a6d909c07f8a99e826f4a102111736e8198a5925.zip
SWORD25: Implement image tinting.
svn-id: r53286
Diffstat (limited to 'engines/sword25')
-rw-r--r--engines/sword25/gfx/opengl/glimage.cpp40
1 files changed, 32 insertions, 8 deletions
diff --git a/engines/sword25/gfx/opengl/glimage.cpp b/engines/sword25/gfx/opengl/glimage.cpp
index dac31ce709..abc961c22e 100644
--- a/engines/sword25/gfx/opengl/glimage.cpp
+++ b/engines/sword25/gfx/opengl/glimage.cpp
@@ -169,9 +169,12 @@ bool GLImage::Blit(int PosX, int PosY, int Flipping, Common::Rect *pPartRect, un
Height = m_Height;
ScaleY = (float) Height / (float) m_Height;
- if (Color != 0xffffffff) {
- warning("STUB: Image bg color: %x", Color);
+ if (Color & 0xff000000 != 0xff000000) {
+ warning("STUB: Image transparent bg color: %x", Color);
}
+ int cr = (Color >> 16) & 0xff;
+ int cg = (Color >> 8) & 0xff;
+ int cb = (Color >> 0) & 0xff;
if (ScaleX != 1.0 || ScaleY != 1.0) {
warning("STUB: Sprite scaling (%f x %f)", ScaleX, ScaleY);
@@ -223,17 +226,38 @@ bool GLImage::Blit(int PosX, int PosY, int Flipping, Common::Rect *pPartRect, un
out += 4;
break;
case 255: // Full opacity
- *out++ = r;
- *out++ = g;
- *out++ = b;
+ if (cr != 255)
+ *out++ = (r * cr) >> 8;
+ else
+ *out++ = r;
+
+ if (cg != 255)
+ *out++ = (g * cg) >> 8;
+ else
+ *out++ = g;
+
+ if (cb != 255)
+ *out++ = (b * cb) >> 8;
+ else
+ *out++ = b;
+
*out++ = a;
break;
default: // alpha blending
- *out += (byte)(((r - *out) * a) >> 8);
+ if (cr != 255)
+ *out += ((r - *out) * a * cr) >> 16;
+ else
+ *out += ((r - *out) * a) >> 8;
out++;
- *out += (byte)(((g - *out) * a) >> 8);
+ if (cg != 255)
+ *out += ((g - *out) * a * cg) >> 16;
+ else
+ *out += ((g - *out) * a) >> 8;
out++;
- *out += (byte)(((b - *out) * a) >> 8);
+ if (cb != 255)
+ *out += ((b - *out) * a * cb) >> 16;
+ else
+ *out += ((b - *out) * a) >> 8;
out++;
*out = 255;
out++;