aboutsummaryrefslogtreecommitdiff
path: root/graphics/scaler
diff options
context:
space:
mode:
authorJody Northup2009-08-29 07:23:49 +0000
committerJody Northup2009-08-29 07:23:49 +0000
commit21e6438a502ef5f5c1e5379dddc03e4b1c47e40c (patch)
tree839b2222785a6f5bdb347b16e0566833df8e2241 /graphics/scaler
parent174311e325b88323b4cbefe956d6627c9e3ce221 (diff)
downloadscummvm-rg350-21e6438a502ef5f5c1e5379dddc03e4b1c47e40c.tar.gz
scummvm-rg350-21e6438a502ef5f5c1e5379dddc03e4b1c47e40c.tar.bz2
scummvm-rg350-21e6438a502ef5f5c1e5379dddc03e4b1c47e40c.zip
changes to graphics/scaler/thumbnail_intern.cpp that escaped earlier 16-bit merge.
svn-id: r43788
Diffstat (limited to 'graphics/scaler')
-rw-r--r--graphics/scaler/thumbnail_intern.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/graphics/scaler/thumbnail_intern.cpp b/graphics/scaler/thumbnail_intern.cpp
index fabe07b031..ad9ca7c3d7 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,8 @@ static bool grabScreen565(Graphics::Surface *surf) {
if (!screen)
return false;
- assert(screen->bytesPerPixel == 1 && screen->pixels != 0);
+ assert(screen->bytesPerPixel == 1 || screen->bytesPerPixel == 2);
+ assert(screen->pixels != 0);
byte palette[256 * 4];
g_system->grabPalette(&palette[0], 0, 256);
@@ -107,11 +109,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_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);
}
}