diff options
author | Matthew Hoops | 2011-06-30 08:16:19 -0400 |
---|---|---|
committer | Johannes Schickel | 2012-03-20 01:06:47 +0100 |
commit | 426c81a7a7a4d6f47b73db1a75908b548d250e4e (patch) | |
tree | d9a5be538bbf1cda43196765b7fc1204324bd47f /gui | |
parent | 29f7cc33fb66ded97a8261beb8d16dd951bdec59 (diff) | |
download | scummvm-rg350-426c81a7a7a4d6f47b73db1a75908b548d250e4e.tar.gz scummvm-rg350-426c81a7a7a4d6f47b73db1a75908b548d250e4e.tar.bz2 scummvm-rg350-426c81a7a7a4d6f47b73db1a75908b548d250e4e.zip |
GRAPHICS: Rewrite ImageDecoder to have an improved API
The new bitmap decoder class is based off the Mohawk one, and now has 8bpp decoding capability.
Diffstat (limited to 'gui')
-rw-r--r-- | gui/ThemeEngine.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 2cb1635e20..bcfd41e05b 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -30,11 +30,11 @@ #include "graphics/cursorman.h" #include "graphics/fontman.h" -#include "graphics/imagedec.h" #include "graphics/surface.h" #include "graphics/VectorRenderer.h" #include "graphics/fonts/bdf.h" #include "graphics/fonts/ttf.h" +#include "graphics/decoders/bmp.h" #include "gui/widget.h" #include "gui/ThemeEngine.h" @@ -620,20 +620,25 @@ bool ThemeEngine::addBitmap(const Common::String &filename) { if (surf) return true; - // If not, try to load the bitmap via the ImageDecoder class. + // If not, try to load the bitmap via the BitmapDecoder class. + Graphics::BitmapDecoder bitmapDecoder; + const Graphics::Surface *srcSurface = 0; Common::ArchiveMemberList members; _themeFiles.listMatchingMembers(members, filename); for (Common::ArchiveMemberList::const_iterator i = members.begin(), end = members.end(); i != end; ++i) { Common::SeekableReadStream *stream = (*i)->createReadStream(); if (stream) { - surf = Graphics::ImageDecoder::loadFile(*stream, _overlayFormat); + bitmapDecoder.loadStream(*stream); + srcSurface = bitmapDecoder.getSurface(); delete stream; - - if (surf) + if (srcSurface) break; } } + if (srcSurface && srcSurface->format.bytesPerPixel != 1) + surf = srcSurface->convertTo(_overlayFormat); + // Store the surface into our hashmap (attention, may store NULL entries!) _bitmaps[filename] = surf; |