diff options
author | Einar Johan Trøan Sømåen | 2013-01-24 17:14:51 +0100 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2013-01-24 17:14:51 +0100 |
commit | 426dda70e1d83d32d5c70ff761f1301bbc4c51ed (patch) | |
tree | baa649cbbb9e06fdda500827137ddc210ae37143 /engines/wintermute | |
parent | a1a63546879927c6316165f86dfe61dfb13cb376 (diff) | |
download | scummvm-rg350-426dda70e1d83d32d5c70ff761f1301bbc4c51ed.tar.gz scummvm-rg350-426dda70e1d83d32d5c70ff761f1301bbc4c51ed.tar.bz2 scummvm-rg350-426dda70e1d83d32d5c70ff761f1301bbc4c51ed.zip |
WINTERMUTE: Don't scale 2Bpp images with code aimed at 4Bpp
Diffstat (limited to 'engines/wintermute')
-rw-r--r-- | engines/wintermute/base/base_persistence_manager.cpp | 13 | ||||
-rw-r--r-- | engines/wintermute/graphics/transparent_surface.cpp | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/engines/wintermute/base/base_persistence_manager.cpp b/engines/wintermute/base/base_persistence_manager.cpp index 1e2c06e5ef..accb0a8fd3 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 e019b77453..0f2279c40e 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(); |