From 6f10ef21507946f2ca3687aae7b00963786cf429 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 23 Jan 2009 02:29:32 +0000 Subject: Made InitLUT use a PixelFormat instead of a ColorMask svn-id: r36008 --- graphics/scaler.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'graphics/scaler.cpp') diff --git a/graphics/scaler.cpp b/graphics/scaler.cpp index edfb114ef7..08fbcf6d04 100644 --- a/graphics/scaler.cpp +++ b/graphics/scaler.cpp @@ -87,12 +87,11 @@ uint32 *RGBtoYUV = 0; uint32 *LUT16to32 = 0; } -template -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 @@ void InitLUT() { 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 @@ void InitScalers(uint32 BitFormat) { gBitFormat = BitFormat; #ifndef DISABLE_HQ_SCALERS if (gBitFormat == 555) - InitLUT >(); + InitLUT(Graphics::createPixelFormat<555>()); if (gBitFormat == 565) - InitLUT >(); + InitLUT(Graphics::createPixelFormat<565>()); #endif } -- cgit v1.2.3