aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2013-02-01 01:55:16 +0100
committerEinar Johan Trøan Sømåen2013-02-01 01:55:16 +0100
commitd12a0e142305d77a3850552a402a0f07343ea34b (patch)
treecb9cf414d48fc800d7940c584b5021973b5d1382 /engines/wintermute
parent0db8a0b3b15bd01ca5e02d4eaff5ce8798824b0a (diff)
downloadscummvm-rg350-d12a0e142305d77a3850552a402a0f07343ea34b.tar.gz
scummvm-rg350-d12a0e142305d77a3850552a402a0f07343ea34b.tar.bz2
scummvm-rg350-d12a0e142305d77a3850552a402a0f07343ea34b.zip
WINTERMUTE: Apply color-key if no alpha-channel is present
(Instead of using the bpp to detect it).
Diffstat (limited to 'engines/wintermute')
-rw-r--r--engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
index e00b347ecc..6e29a1f756 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
@@ -140,23 +140,28 @@ bool BaseSurfaceOSystem::finishLoad() {
// Well, actually, we don't convert via 24-bit as the color-key application overwrites the Alpha-channel anyhow.
_surface->free();
delete _surface;
+
+ bool needsColorKey = false;
if (_filename.hasSuffix(".bmp") && image->getSurface()->format.bytesPerPixel == 4) {
_surface = image->getSurface()->convertTo(g_system->getScreenFormat(), image->getPalette());
- TransparentSurface trans(*_surface);
- trans.applyColorKey(_ckRed, _ckGreen, _ckBlue);
+ needsColorKey = true;
} else if (image->getSurface()->format.bytesPerPixel == 1 && image->getPalette()) {
_surface = image->getSurface()->convertTo(g_system->getScreenFormat(), image->getPalette());
- TransparentSurface trans(*_surface);
- trans.applyColorKey(_ckRed, _ckGreen, _ckBlue, true);
+ needsColorKey = true;
} else if (image->getSurface()->format.bytesPerPixel >= 3 && image->getSurface()->format != g_system->getScreenFormat()) {
_surface = image->getSurface()->convertTo(g_system->getScreenFormat());
- if (image->getSurface()->format.bytesPerPixel == 3) {
- TransparentSurface trans(*_surface);
- trans.applyColorKey(_ckRed, _ckGreen, _ckBlue, true);
- }
+ needsColorKey = true;
} else {
_surface = new Graphics::Surface();
_surface->copyFrom(*image->getSurface());
+ if (_surface->format.aBits() == 0) {
+ needsColorKey = true;
+ }
+ }
+
+ if (needsColorKey) {
+ TransparentSurface trans(*_surface);
+ trans.applyColorKey(_ckRed, _ckGreen, _ckBlue, true);
}
_hasAlpha = hasTransparency(_surface);