diff options
author | Einar Johan Trøan Sømåen | 2012-06-02 13:48:26 +0200 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2012-06-02 13:48:26 +0200 |
commit | e7a802700c3872215049d304fb6898549eef56f5 (patch) | |
tree | 8e96ebd61110e5c085f817808f57b7bd594d5ef0 /engines/wintermute/Base | |
parent | 2db256605539b82ed4ace20d41c6046f50792706 (diff) | |
download | scummvm-rg350-e7a802700c3872215049d304fb6898549eef56f5.tar.gz scummvm-rg350-e7a802700c3872215049d304fb6898549eef56f5.tar.bz2 scummvm-rg350-e7a802700c3872215049d304fb6898549eef56f5.zip |
WINTERMUTE: Add color-keying for BSurfaceSDL BMPs
Diffstat (limited to 'engines/wintermute/Base')
-rw-r--r-- | engines/wintermute/Base/BSurfaceSDL.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/engines/wintermute/Base/BSurfaceSDL.cpp b/engines/wintermute/Base/BSurfaceSDL.cpp index c0157696d6..0b16f3d39b 100644 --- a/engines/wintermute/Base/BSurfaceSDL.cpp +++ b/engines/wintermute/Base/BSurfaceSDL.cpp @@ -137,10 +137,18 @@ HRESULT CBSurfaceSDL::Create(const char *Filename, bool default_ck, byte ck_red, // no alpha, set color key
/* if (surface->format.bytesPerPixel != 4)
SDL_SetColorKey(surf, SDL_TRUE, SDL_MapRGB(surf->format, ck_red, ck_green, ck_blue));*/
- if (surface->format.bytesPerPixel == 1 && palette) {
+
+ // convert 32-bit BMPs to 24-bit or they appear totally transparent (does any app actually write alpha in BMP properly?)
+ // Well, actually, we don't convert via 24-bit as the color-key application overwrites the Alpha-channel anyhow.
+ if (strFileName.hasSuffix(".bmp") && surface->format.bytesPerPixel == 4) {
_surface = surface->convertTo(g_system->getScreenFormat(), palette);
- }
- else if (surface->format.bytesPerPixel == 4 && surface->format != g_system->getScreenFormat()) {
+ TransparentSurface trans(*_surface);
+ trans.applyColorKey(ck_red, ck_green, ck_blue);
+ } else if (surface->format.bytesPerPixel == 1 && palette) {
+ _surface = surface->convertTo(g_system->getScreenFormat(), palette);
+ TransparentSurface trans(*_surface);
+ trans.applyColorKey(ck_red, ck_green, ck_blue, true);
+ } else if (surface->format.bytesPerPixel == 4 && surface->format != g_system->getScreenFormat()) {
_surface = surface->convertTo(g_system->getScreenFormat());
} else {
_surface = new Graphics::Surface();
|