From edf9f249260b1fd4364f6727fa622991e81e8cf3 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 6 Nov 2008 15:02:50 +0000 Subject: Got rid of OSystem::colorToRGB and RGBToColor; added implementations for OSystem::getOverlayFormat to several ports (pending testing by the porters) svn-id: r34912 --- graphics/thumbnail.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'graphics/thumbnail.cpp') diff --git a/graphics/thumbnail.cpp b/graphics/thumbnail.cpp index 905fea3d93..709ba9ea54 100644 --- a/graphics/thumbnail.cpp +++ b/graphics/thumbnail.cpp @@ -42,12 +42,6 @@ struct ThumbnailHeader { #define ThumbnailHeaderSize (4+4+1+2+2+1) -inline void colorToRGB(uint16 color, uint8 &r, uint8 &g, uint8 &b) { - r = (((color >> 11) & 0x1F) << 3); - g = (((color >> 5) & 0x3F) << 2); - b = ((color&0x1F) << 3); -} - bool loadHeader(Common::SeekableReadStream &in, ThumbnailHeader &header, bool outputWarnings) { header.type = in.readUint32BE(); // We also accept the bad 'BMHT' header here, for the sake of compatibility @@ -114,13 +108,14 @@ bool loadThumbnail(Common::SeekableReadStream &in, Graphics::Surface &to) { to.create(header.width, header.height, sizeof(OverlayColor)); 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; - colorToRGB(in.readUint16BE(), r, g, b); + colorToRGB >(in.readUint16BE(), r, g, b); // converting to current OSystem Color - *pixels++ = g_system->RGBToColor(r, g, b); + *pixels++ = Graphics::RGBToColor(r, g, b, format); } } -- cgit v1.2.3