diff options
author | Andre Heider | 2009-08-30 16:58:55 +0000 |
---|---|---|
committer | Andre Heider | 2009-08-30 16:58:55 +0000 |
commit | 7ae8c8e451deed9dd49beba190a2acb297a55165 (patch) | |
tree | f435ce1b9f6f7b240112ce88b1999d30f385270b /gui/ThemeEngine.cpp | |
parent | 78cbed0cc8748bcefaf891d24bb80e1797bf9d7f (diff) | |
download | scummvm-rg350-7ae8c8e451deed9dd49beba190a2acb297a55165.tar.gz scummvm-rg350-7ae8c8e451deed9dd49beba190a2acb297a55165.tar.bz2 scummvm-rg350-7ae8c8e451deed9dd49beba190a2acb297a55165.zip |
Properly detect the transparent color on lossy pixel formats (like ARGB3444)
svn-id: r43829
Diffstat (limited to 'gui/ThemeEngine.cpp')
-rw-r--r-- | gui/ThemeEngine.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 41447d2a88..0869f880b4 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -1254,6 +1254,9 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int 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 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int for (uint y = 0; y < _cursorHeight; ++y) { for (uint x = 0; x < _cursorWidth; ++x) { byte r, g, b; - _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)) + // Skip transparency + if (src[x] == colTransparent) continue; + _overlayFormat.colorToRGB(src[x], r, g, b); + const int col = (r << 16) | (g << 8) | b; + // If there is no entry yet for this color in the palette: Add one if (!colorToIndex.contains(col)) { const int index = colorsFound++; |