diff options
author | Johannes Schickel | 2009-08-29 08:02:40 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-08-29 08:02:40 +0000 |
commit | 84c1fc6399c541a80e627a6a1970f255cc2d6d54 (patch) | |
tree | a3e342484e9fc0236065bce85a6518b3346aab52 | |
parent | 1b7fef5117925748a87370310a822584fb2fb045 (diff) | |
download | scummvm-rg350-84c1fc6399c541a80e627a6a1970f255cc2d6d54.tar.gz scummvm-rg350-84c1fc6399c541a80e627a6a1970f255cc2d6d54.tar.bz2 scummvm-rg350-84c1fc6399c541a80e627a6a1970f255cc2d6d54.zip |
Fix bug for non 8bpp indexed game screens in grabScreen565.
svn-id: r43796
-rw-r--r-- | graphics/scaler/thumbnail_intern.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/graphics/scaler/thumbnail_intern.cpp b/graphics/scaler/thumbnail_intern.cpp index ad9ca7c3d7..5e0aa519e1 100644 --- a/graphics/scaler/thumbnail_intern.cpp +++ b/graphics/scaler/thumbnail_intern.cpp @@ -107,20 +107,22 @@ static bool grabScreen565(Graphics::Surface *surf) { surf->create(screen->w, screen->h, 2); + Graphics::PixelFormat screenFormat = g_system->getScreenFormat(); + for (uint y = 0; y < screen->h; ++y) { for (uint x = 0; x < screen->w; ++x) { - 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 { + byte r, g, b; + + if (screenFormat.bytesPerPixel == 1) { 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]; + } else if (screenFormat.bytesPerPixel == 2) { + uint16 col = READ_UINT16(screen->getBasePtr(x, y)); + screenFormat.colorToRGB(col, r, g, b); } - ((uint16*)surf->pixels)[y * surf->w + x] = Graphics::RGBToColor<Graphics::ColorMasks<565> >(r, g, b); + + ((uint16 *)surf->pixels)[y * surf->w + x] = Graphics::RGBToColor<Graphics::ColorMasks<565> >(r, g, b); } } |