[Scummvm-cvs-logs] SF.net SVN: scummvm:[43829] scummvm/trunk/gui/ThemeEngine.cpp
dhewg at users.sourceforge.net
dhewg at users.sourceforge.net
Sun Aug 30 18:58:56 CEST 2009
Revision: 43829
http://scummvm.svn.sourceforge.net/scummvm/?rev=43829&view=rev
Author: dhewg
Date: 2009-08-30 16:58:55 +0000 (Sun, 30 Aug 2009)
Log Message:
-----------
Properly detect the transparent color on lossy pixel formats (like ARGB3444)
Modified Paths:
--------------
scummvm/trunk/gui/ThemeEngine.cpp
Modified: scummvm/trunk/gui/ThemeEngine.cpp
===================================================================
--- scummvm/trunk/gui/ThemeEngine.cpp 2009-08-30 16:57:21 UTC (rev 43828)
+++ scummvm/trunk/gui/ThemeEngine.cpp 2009-08-30 16:58:55 UTC (rev 43829)
@@ -1254,6 +1254,9 @@
assert(_cursor);
memset(_cursor, 0xFF, sizeof(byte) * _cursorWidth * _cursorHeight);
+ // the transparent color is 0xFF00FF
+ const int colTransparent = _overlayFormat.RGBToColor(0xFF, 0, 0xFF);
+
// Now, scan the bitmap. We have to convert it from 16 bit color mode
// to 8 bit mode, and have to create a suitable palette on the fly.
uint colorsFound = 0;
@@ -1262,14 +1265,14 @@
for (uint y = 0; y < _cursorHeight; ++y) {
for (uint x = 0; x < _cursorWidth; ++x) {
byte r, g, b;
+
+ // Skip transparency
+ if (src[x] == colTransparent)
+ continue;
+
_overlayFormat.colorToRGB(src[x], r, g, b);
const int col = (r << 16) | (g << 8) | b;
- // Skip transparency (the transparent color actually is 0xFF00FF,
- // but the RGB conversion chops of the lower bits).
- if ((r > 0xF1) && (g < 0x03) && (b > 0xF1))
- continue;
-
// If there is no entry yet for this color in the palette: Add one
if (!colorToIndex.contains(col)) {
const int index = colorsFound++;
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