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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Jan 23 03:29:32 CET 2009


Revision: 36008
          http://scummvm.svn.sourceforge.net/scummvm/?rev=36008&view=rev
Author:   fingolfin
Date:     2009-01-23 02:29:32 +0000 (Fri, 23 Jan 2009)

Log Message:
-----------
Made InitLUT use a PixelFormat instead of a ColorMask

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

Modified: scummvm/trunk/graphics/scaler.cpp
===================================================================
--- scummvm/trunk/graphics/scaler.cpp	2009-01-22 23:14:16 UTC (rev 36007)
+++ scummvm/trunk/graphics/scaler.cpp	2009-01-23 02:29:32 UTC (rev 36008)
@@ -87,12 +87,11 @@
 uint32 *LUT16to32 = 0;
 }
 
-template<class T>
-void InitLUT() {
-	int r, g, b;
+void InitLUT(Graphics::PixelFormat format) {
+	uint8 r, g, b;
 	int Y, u, v;
 
-	assert(T::kBytesPerPixel == 2);
+	assert(format.bytesPerPixel == 2);
 
 	// Allocate the YUV/LUT buffers on the fly if needed.
 	if (RGBtoYUV == 0)
@@ -101,9 +100,7 @@
 		LUT16to32 = (uint32 *)malloc(65536 * sizeof(uint32));
 
 	for (int color = 0; color < 65536; ++color) {
-		r = ((color & T::kRedMask) >> T::kRedShift) << (8 - T::kRedBits);
-		g = ((color & T::kGreenMask) >> T::kGreenShift) << (8 - T::kGreenBits);
-		b = ((color & T::kBlueMask) >> T::kBlueShift) << (8 - T::kBlueBits);
+		format.colorToRGB(color, r, g, b);
 		LUT16to32[color] = (r << 16) | (g << 8) | b;
 
 		Y = (r + g + b) >> 2;
@@ -119,9 +116,9 @@
 	gBitFormat = BitFormat;
 #ifndef DISABLE_HQ_SCALERS
 	if (gBitFormat == 555)
-		InitLUT<Graphics::ColorMasks<555> >();
+		InitLUT(Graphics::createPixelFormat<555>());
 	if (gBitFormat == 565)
-		InitLUT<Graphics::ColorMasks<565> >();
+		InitLUT(Graphics::createPixelFormat<565>());
 #endif
 }
 


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