From 64cba2878ac9c10f344af98a6683cc4bfd47b707 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Mon, 19 Apr 2010 20:37:20 +0000 Subject: Do not call OSystem::grabPalette() for 16bit modes, when the result is not used anyway for those modes. svn-id: r48733 --- graphics/scaler/thumbnail_intern.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'graphics/scaler') 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; } -- cgit v1.2.3