aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Heider2010-04-19 20:37:20 +0000
committerAndre Heider2010-04-19 20:37:20 +0000
commit64cba2878ac9c10f344af98a6683cc4bfd47b707 (patch)
treecc42b304ebd7a282403c68faec8c945743443d95
parent001bca2d6cf6c211f1d1640a74c9f19d1ef7cca5 (diff)
downloadscummvm-rg350-64cba2878ac9c10f344af98a6683cc4bfd47b707.tar.gz
scummvm-rg350-64cba2878ac9c10f344af98a6683cc4bfd47b707.tar.bz2
scummvm-rg350-64cba2878ac9c10f344af98a6683cc4bfd47b707.zip
Do not call OSystem::grabPalette() for 16bit modes, when the result is not used anyway for those modes.
svn-id: r48733
-rw-r--r--graphics/scaler/thumbnail_intern.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/graphics/scaler/thumbnail_intern.cpp b/graphics/scaler/thumbnail_intern.cpp
index 66b275fcb2..9a3665abaa 100644
--- a/graphics/scaler/thumbnail_intern.cpp
+++ b/graphics/scaler/thumbnail_intern.cpp
@@ -102,12 +102,16 @@ static bool grabScreen565(Graphics::Surface *surf) {
assert(screen->bytesPerPixel == 1 || screen->bytesPerPixel == 2);
assert(screen->pixels != 0);
- byte palette[256 * 4];
- g_system->grabPalette(&palette[0], 0, 256);
+ Graphics::PixelFormat screenFormat = g_system->getScreenFormat();
surf->create(screen->w, screen->h, 2);
- Graphics::PixelFormat screenFormat = g_system->getScreenFormat();
+ byte *palette = 0;
+ if (screenFormat.bytesPerPixel == 1) {
+ palette = new byte[256 * 4];
+ assert(palette);
+ g_system->grabPalette(&palette[0], 0, 256);
+ }
for (uint y = 0; y < screen->h; ++y) {
for (uint x = 0; x < screen->w; ++x) {
@@ -126,6 +130,8 @@ static bool grabScreen565(Graphics::Surface *surf) {
}
}
+ delete[] palette;
+
g_system->unlockScreen();
return true;
}