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

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Wed Jun 3 02:01:07 CEST 2009


Revision: 41130
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41130&view=rev
Author:   Kirben
Date:     2009-06-03 00:01:07 +0000 (Wed, 03 Jun 2009)

Log Message:
-----------
Update thumbnail code to capture RGB565 screen.

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-06-02 23:29:58 UTC (rev 41129)
+++ scummvm/trunk/graphics/scaler/thumbnail_intern.cpp	2009-06-03 00:01:07 UTC (rev 41130)
@@ -23,6 +23,7 @@
  *
  */
 
+#include "common/endian.h"
 #include "common/scummsys.h"
 #include "common/system.h"
 
@@ -98,7 +99,7 @@
 	if (!screen)
 		return false;
 
-	assert(screen->bytesPerPixel == 1 && screen->pixels != 0);
+	assert(screen->pixels != 0);
 
 	byte palette[256 * 4];
 	g_system->grabPalette(&palette[0], 0, 256);
@@ -107,11 +108,17 @@
 
 	for (uint y = 0; y < screen->h; ++y) {
 		for (uint x = 0; x < screen->w; ++x) {
-			byte r, g, b;
-			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];
-
+				byte r, g, b;
+			if (screen->bytesPerPixel == 2) {
+				uint16 col = READ_LE_UINT16(screen->getBasePtr(x, y));
+				r = ((col >> 10) & 0x1F) << 3;
+				g = ((col >>  5) & 0x1F) << 3;
+				b = ((col >>  0) & 0x1F) << 3;
+			} else {
+				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];
+			}
 			((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