diff options
author | Alyssa Milburn | 2013-08-01 21:56:01 +0200 |
---|---|---|
committer | Alyssa Milburn | 2013-08-02 00:01:10 +0200 |
commit | 275c65c2727db483b43819b0df91a93148229808 (patch) | |
tree | 82af38c91ff0b4b3e6b5244ea024e41c114f9e85 /engines | |
parent | 9db17152c1ca47a851aed685c0515f3aebb6c390 (diff) | |
download | scummvm-rg350-275c65c2727db483b43819b0df91a93148229808.tar.gz scummvm-rg350-275c65c2727db483b43819b0df91a93148229808.tar.bz2 scummvm-rg350-275c65c2727db483b43819b0df91a93148229808.zip |
TONY: Simplify thumbnail loading code.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tony/detection.cpp | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/engines/tony/detection.cpp b/engines/tony/detection.cpp index 1094950e2c..2a443c4097 100644 --- a/engines/tony/detection.cpp +++ b/engines/tony/detection.cpp @@ -154,26 +154,16 @@ void TonyMetaEngine::removeSaveState(const char *target, int slot) const { SaveStateDescriptor TonyMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String saveName; byte difficulty; - byte thumbData[160 * 120 * 2]; - - if (Tony::RMOptionScreen::loadThumbnailFromSaveState(slot, thumbData, saveName, difficulty)) { - // Convert the 565 thumbnail data to the needed overlay format - Common::MemoryReadStream thumbStream(thumbData, 160 * 120 * 2); - Graphics::PixelFormat destFormat = g_system->getOverlayFormat(); - Graphics::Surface *to = new Graphics::Surface(); - to->create(160, 120, destFormat); - - OverlayColor *pixels = (OverlayColor *)to->pixels; - for (int y = 0; y < to->h; ++y) { - for (int x = 0; x < to->w; ++x) { - uint8 r, g, b; - Graphics::colorToRGB<Graphics::ColorMasks<555> >(thumbStream.readUint16LE(), r, g, b); - - // converting to current OSystem Color - *pixels++ = destFormat.RGBToColor(r, g, b); - } - } + Graphics::Surface *to = new Graphics::Surface(); + to->create(160, 120, Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)); + + if (Tony::RMOptionScreen::loadThumbnailFromSaveState(slot, (byte *)to->pixels, saveName, difficulty)) { +#ifdef SCUMM_BIG_ENDIAN + uint16 *pixels = (uint16 *)to->pixels; + for (int i = 0; i < to->w * to->h; ++i) + pixels[i] = READ_LE_UINT16(pixels + i); +#endif // Create the return descriptor SaveStateDescriptor desc(slot, saveName); desc.setDeletableFlag(true); @@ -183,6 +173,7 @@ SaveStateDescriptor TonyMetaEngine::querySaveMetaInfos(const char *target, int s return desc; } + delete to; return SaveStateDescriptor(); } |