diff options
author | Travis Howell | 2009-06-03 00:01:07 +0000 |
---|---|---|
committer | Travis Howell | 2009-06-03 00:01:07 +0000 |
commit | f82df1d1c44fb9ae7bb3bad21c972b95ae689621 (patch) | |
tree | 53f39c5657d793ab51a56efaccf24811516c2bef /graphics | |
parent | 2ce6cca98b2b92d84f7956ecf78042ee566fe392 (diff) | |
download | scummvm-rg350-f82df1d1c44fb9ae7bb3bad21c972b95ae689621.tar.gz scummvm-rg350-f82df1d1c44fb9ae7bb3bad21c972b95ae689621.tar.bz2 scummvm-rg350-f82df1d1c44fb9ae7bb3bad21c972b95ae689621.zip |
Update thumbnail code to capture RGB565 screen.
svn-id: r41130
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/scaler/thumbnail_intern.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/graphics/scaler/thumbnail_intern.cpp b/graphics/scaler/thumbnail_intern.cpp index fabe07b031..6e78c71bfd 100644 --- a/graphics/scaler/thumbnail_intern.cpp +++ b/graphics/scaler/thumbnail_intern.cpp @@ -23,6 +23,7 @@ * */ +#include "common/endian.h" #include "common/scummsys.h" #include "common/system.h" @@ -98,7 +99,7 @@ static bool grabScreen565(Graphics::Surface *surf) { if (!screen) return false; - assert(screen->bytesPerPixel == 1 && screen->pixels != 0); + assert(screen->pixels != 0); byte palette[256 * 4]; g_system->grabPalette(&palette[0], 0, 256); @@ -107,11 +108,17 @@ static bool grabScreen565(Graphics::Surface *surf) { for (uint y = 0; y < screen->h; ++y) { for (uint x = 0; x < screen->w; ++x) { - byte r, g, b; - r = palette[((uint8*)screen->pixels)[y * screen->pitch + x] * 4]; - g = palette[((uint8*)screen->pixels)[y * screen->pitch + x] * 4 + 1]; - b = palette[((uint8*)screen->pixels)[y * screen->pitch + x] * 4 + 2]; - + byte r, g, b; + if (screen->bytesPerPixel == 2) { + uint16 col = READ_LE_UINT16(screen->getBasePtr(x, y)); + r = ((col >> 10) & 0x1F) << 3; + g = ((col >> 5) & 0x1F) << 3; + b = ((col >> 0) & 0x1F) << 3; + } else { + r = palette[((uint8*)screen->pixels)[y * screen->pitch + x] * 4]; + g = palette[((uint8*)screen->pixels)[y * screen->pitch + x] * 4 + 1]; + b = palette[((uint8*)screen->pixels)[y * screen->pitch + x] * 4 + 2]; + } ((uint16*)surf->pixels)[y * surf->w + x] = Graphics::RGBToColor<Graphics::ColorMasks<565> >(r, g, b); } } |