[Scummvm-cvs-logs] scummvm master -> 426dda70e1d83d32d5c70ff761f1301bbc4c51ed

somaen einarjohants at gmail.com
Thu Jan 24 17:16:06 CET 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:
426dda70e1 WINTERMUTE: Don't scale 2Bpp images with code aimed at 4Bpp


Commit: 426dda70e1d83d32d5c70ff761f1301bbc4c51ed
    https://github.com/scummvm/scummvm/commit/426dda70e1d83d32d5c70ff761f1301bbc4c51ed
Author: Einar Johan Trøan Sømåen (einarjohants at gmail.com)
Date: 2013-01-24T08:14:51-08:00

Commit Message:
WINTERMUTE: Don't scale 2Bpp images with code aimed at 4Bpp

Changed paths:
    engines/wintermute/base/base_persistence_manager.cpp
    engines/wintermute/graphics/transparent_surface.cpp



diff --git a/engines/wintermute/base/base_persistence_manager.cpp b/engines/wintermute/base/base_persistence_manager.cpp
index 1e2c06e..accb0a8 100644
--- a/engines/wintermute/base/base_persistence_manager.cpp
+++ b/engines/wintermute/base/base_persistence_manager.cpp
@@ -166,16 +166,17 @@ void BasePersistenceManager::getSaveStateDesc(int slot, SaveStateDescriptor &des
 	}
 
 	if (thumbSize > 0) {
-		Common::MemoryReadStream thumbStream(thumbData, thumbSize);
+		Common::MemoryReadStream thumbStream(thumbData, thumbSize, DisposeAfterUse::NO);
 		Graphics::BitmapDecoder bmpDecoder;
 		if (bmpDecoder.loadStream(thumbStream)) {
-			Graphics::Surface *surf = NULL;
-			surf = bmpDecoder.getSurface()->convertTo(g_system->getOverlayFormat());
-			TransparentSurface *scaleableSurface = new TransparentSurface(*surf, false);
+			const Graphics::Surface *bmpSurface = bmpDecoder.getSurface();
+			TransparentSurface *scaleableSurface = new TransparentSurface(*bmpSurface, false);
 			Graphics::Surface *scaled = scaleableSurface->scale(kThumbnailWidth, kThumbnailHeight2);
-			desc.setThumbnail(scaled);
+			Graphics::Surface *thumb = scaled->convertTo(g_system->getOverlayFormat());
+			desc.setThumbnail(thumb);
 			delete scaleableSurface;
-			delete surf;
+			scaled->free();
+			delete scaled;
 		}
 	}
 
diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp
index e019b77..0f2279c 100644
--- a/engines/wintermute/graphics/transparent_surface.cpp
+++ b/engines/wintermute/graphics/transparent_surface.cpp
@@ -394,6 +394,8 @@ TransparentSurface *TransparentSurface::scale(const Common::Rect &srcRect, const
 	// dstRect(x, y) = srcRect(x * srcW / dstW, y * srcH / dstH);
 	TransparentSurface *target = new TransparentSurface();
 
+	assert(format.bytesPerPixel == 4);
+
 	int srcW = srcRect.width();
 	int srcH = srcRect.height();
 	int dstW = dstRect.width();






More information about the Scummvm-git-logs mailing list