aboutsummaryrefslogtreecommitdiff
path: root/graphics/thumbnail.cpp
diff options
context:
space:
mode:
authorMax Horn2008-11-06 15:02:50 +0000
committerMax Horn2008-11-06 15:02:50 +0000
commitedf9f249260b1fd4364f6727fa622991e81e8cf3 (patch)
tree2b034d5daf7b69212957d8d51ab839974f51f2c5 /graphics/thumbnail.cpp
parentf238a12b27ebfa9847814b9972fdb5789e484533 (diff)
downloadscummvm-rg350-edf9f249260b1fd4364f6727fa622991e81e8cf3.tar.gz
scummvm-rg350-edf9f249260b1fd4364f6727fa622991e81e8cf3.tar.bz2
scummvm-rg350-edf9f249260b1fd4364f6727fa622991e81e8cf3.zip
Got rid of OSystem::colorToRGB and RGBToColor; added implementations for OSystem::getOverlayFormat to several ports (pending testing by the porters)
svn-id: r34912
Diffstat (limited to 'graphics/thumbnail.cpp')
-rw-r--r--graphics/thumbnail.cpp11
1 files changed, 3 insertions, 8 deletions
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<ColorMasks<565> >(in.readUint16BE(), r, g, b);
// converting to current OSystem Color
- *pixels++ = g_system->RGBToColor(r, g, b);
+ *pixels++ = Graphics::RGBToColor(r, g, b, format);
}
}