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

sev at users.sourceforge.net sev at users.sourceforge.net
Wed Oct 13 01:16:44 CEST 2010


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

Log Message:
-----------
SWORD25: Implement image tinting.

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:16:23 UTC (rev 53285)
+++ scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp	2010-10-12 23:16:44 UTC (rev 53286)
@@ -169,9 +169,12 @@
 		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 @@
 				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++;


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