[Scummvm-cvs-logs] SF.net SVN: scummvm:[48733] scummvm/trunk/graphics/scaler/thumbnail_intern. cpp

dhewg at users.sourceforge.net dhewg at users.sourceforge.net
Mon Apr 19 22:37:20 CEST 2010


Revision: 48733
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48733&view=rev
Author:   dhewg
Date:     2010-04-19 20:37:20 +0000 (Mon, 19 Apr 2010)

Log Message:
-----------
Do not call OSystem::grabPalette() for 16bit modes, when the result is not used anyway for those modes.

Modified Paths:
--------------
    scummvm/trunk/graphics/scaler/thumbnail_intern.cpp

Modified: scummvm/trunk/graphics/scaler/thumbnail_intern.cpp
===================================================================
--- scummvm/trunk/graphics/scaler/thumbnail_intern.cpp	2010-04-19 20:33:38 UTC (rev 48732)
+++ scummvm/trunk/graphics/scaler/thumbnail_intern.cpp	2010-04-19 20:37:20 UTC (rev 48733)
@@ -102,12 +102,16 @@
 	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 @@
 		}
 	}
 
+	delete[] palette;
+
 	g_system->unlockScreen();
 	return true;
 }


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