diff options
Diffstat (limited to 'graphics/thumbnail.cpp')
-rw-r--r-- | graphics/thumbnail.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/graphics/thumbnail.cpp b/graphics/thumbnail.cpp index b245cfc5fa..32ab04ed24 100644 --- a/graphics/thumbnail.cpp +++ b/graphics/thumbnail.cpp @@ -28,6 +28,7 @@ #include "common/endian.h" #include "common/system.h" #include "common/stream.h" +#include "common/textconsole.h" namespace Graphics { @@ -49,7 +50,7 @@ bool loadHeader(Common::SeekableReadStream &in, ThumbnailHeader &header, bool ou // We also accept the bad 'BMHT' header here, for the sake of compatibility // with some older savegames which were written incorrectly due to a bug in // ScummVM which wrote the thumb header type incorrectly on LE systems. - if (header.type != MKID_BE('THMB') && header.type != MKID_BE('BMHT')) { + if (header.type != MKTAG('T','H','M','B') && header.type != MKTAG('B','M','H','T')) { if (outputWarnings) warning("couldn't find thumbnail header type"); return false; @@ -107,10 +108,10 @@ bool loadThumbnail(Common::SeekableReadStream &in, Graphics::Surface &to) { return false; } - to.create(header.width, header.height, sizeof(OverlayColor)); + Graphics::PixelFormat format = g_system->getOverlayFormat(); + to.create(header.width, header.height, format); OverlayColor *pixels = (OverlayColor *)to.pixels; - Graphics::PixelFormat format = g_system->getOverlayFormat(); for (int y = 0; y < to.h; ++y) { for (int x = 0; x < to.w; ++x) { uint8 r, g, b; @@ -139,18 +140,18 @@ bool saveThumbnail(Common::WriteStream &out) { } bool saveThumbnail(Common::WriteStream &out, const Graphics::Surface &thumb) { - if (thumb.bytesPerPixel != 2) { + if (thumb.format.bytesPerPixel != 2) { warning("trying to save thumbnail with bpp different than 2"); return false; } ThumbnailHeader header; - header.type = MKID_BE('THMB'); - header.size = ThumbnailHeaderSize + thumb.w*thumb.h*thumb.bytesPerPixel; + header.type = MKTAG('T','H','M','B'); + header.size = ThumbnailHeaderSize + thumb.w*thumb.h*thumb.format.bytesPerPixel; header.version = THMB_VERSION; header.width = thumb.w; header.height = thumb.h; - header.bpp = thumb.bytesPerPixel; + header.bpp = thumb.format.bytesPerPixel; out.writeUint32BE(header.type); out.writeUint32BE(header.size); |