[Scummvm-cvs-logs] scummvm master -> e5f9cb3cbbc047a1359354475c1128454491f331

wjp wjp at usecode.org
Mon Aug 26 23:28:40 CEST 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e5f9cb3cbb WINTERMUTE: Fix and clean up BaseSurfaceOSystem::finishLoad()


Commit: e5f9cb3cbbc047a1359354475c1128454491f331
    https://github.com/scummvm/scummvm/commit/e5f9cb3cbbc047a1359354475c1128454491f331
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2013-08-26T14:25:27-07:00

Commit Message:
WINTERMUTE: Fix and clean up BaseSurfaceOSystem::finishLoad()

This fixes a couple of cases which fell through the cracks of the
previous chain of conditions, including 16bpp images and 32bpp images
without alpha. The latter partially fixes bug #3600667.

Changed paths:
    engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp



diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
index df8cabd..a5b3505 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
@@ -149,33 +149,30 @@ bool BaseSurfaceOSystem::finishLoad() {
 		// FIBITMAP *newImg = FreeImage_ConvertToGreyscale(img); TODO
 	}
 
-	// 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));*/
-
-	// 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.
 	_surface->free();
 	delete _surface;
 
 	bool needsColorKey = false;
 	bool replaceAlpha = true;
-	if (_filename.hasSuffix(".bmp") && image->getSurface()->format.bytesPerPixel == 4) {
-		_surface = image->getSurface()->convertTo(g_system->getScreenFormat(), image->getPalette());
-		needsColorKey = true;
-		replaceAlpha = false;
-	} else if (image->getSurface()->format.bytesPerPixel == 1 && image->getPalette()) {
+	if (image->getSurface()->format.bytesPerPixel == 1) {
+		if (!image->getPalette()) {
+			error("Missing palette while loading 8bit image %s", _filename.c_str());
+		}
 		_surface = image->getSurface()->convertTo(g_system->getScreenFormat(), image->getPalette());
 		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) {
-			needsColorKey = true;
-		}
 	} else {
-		_surface = new Graphics::Surface();
-		_surface->copyFrom(*image->getSurface());
-		if (_surface->format.aBits() == 0) {
+		if (image->getSurface()->format != g_system->getScreenFormat()) {
+			_surface = image->getSurface()->convertTo(g_system->getScreenFormat());
+		} else {
+			_surface = new Graphics::Surface();
+			_surface->copyFrom(*image->getSurface());
+		}
+
+		if (_filename.hasSuffix(".bmp") && image->getSurface()->format.bytesPerPixel == 4) {
+			// 32 bpp BMPs have nothing useful in their alpha-channel -> color-key
+			needsColorKey = true;
+			replaceAlpha = false;
+		} else if (image->getSurface()->format.aBits() == 0) {
 			needsColorKey = true;
 		}
 	}






More information about the Scummvm-git-logs mailing list