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/mpeg_player.cpp | 7 ++++--- graphics/thumbnail.cpp | 11 +++-------- 2 files changed, 7 insertions(+), 11 deletions(-) (limited to 'graphics') diff --git a/graphics/mpeg_player.cpp b/graphics/mpeg_player.cpp index 3c0fd08cb3..7432887360 100644 --- a/graphics/mpeg_player.cpp +++ b/graphics/mpeg_player.cpp @@ -389,10 +389,11 @@ void BaseAnimationState::buildLookup() { } // Set up entries 0-255 in rgb-to-pixel value tables. + Graphics::PixelFormat format = _sys->getOverlayFormat(); for (i = 0; i < 256; i++) { - r_2_pix_alloc[i + 256] = _sys->RGBToColor(i, 0, 0); - g_2_pix_alloc[i + 256] = _sys->RGBToColor(0, i, 0); - b_2_pix_alloc[i + 256] = _sys->RGBToColor(0, 0, i); + r_2_pix_alloc[i + 256] = Graphics::RGBToColor(i, 0, 0, format); + g_2_pix_alloc[i + 256] = Graphics::RGBToColor(0, i, 0, format); + b_2_pix_alloc[i + 256] = Graphics::RGBToColor(0, 0, i, format); } // Spread out the values we have to the rest of the array so that we do 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