[Scummvm-cvs-logs] SF.net SVN: scummvm:[43796] scummvm/trunk/graphics/scaler/thumbnail_intern. cpp
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sat Aug 29 10:02:41 CEST 2009
Revision: 43796
http://scummvm.svn.sourceforge.net/scummvm/?rev=43796&view=rev
Author: lordhoto
Date: 2009-08-29 08:02:40 +0000 (Sat, 29 Aug 2009)
Log Message:
-----------
Fix bug for non 8bpp indexed game screens in grabScreen565.
Modified Paths:
--------------
scummvm/trunk/graphics/scaler/thumbnail_intern.cpp
Modified: scummvm/trunk/graphics/scaler/thumbnail_intern.cpp
===================================================================
--- scummvm/trunk/graphics/scaler/thumbnail_intern.cpp 2009-08-29 07:53:06 UTC (rev 43795)
+++ scummvm/trunk/graphics/scaler/thumbnail_intern.cpp 2009-08-29 08:02:40 UTC (rev 43796)
@@ -107,20 +107,22 @@
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);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list