aboutsummaryrefslogtreecommitdiff
path: root/graphics/scaler.cpp
diff options
context:
space:
mode:
authorMax Horn2009-01-23 02:29:32 +0000
committerMax Horn2009-01-23 02:29:32 +0000
commit6f10ef21507946f2ca3687aae7b00963786cf429 (patch)
tree403dc2c55525352fae533d8cdfd9027b0220bb8c /graphics/scaler.cpp
parent94bfe1aa6fc71872214784128461709a6e421eac (diff)
downloadscummvm-rg350-6f10ef21507946f2ca3687aae7b00963786cf429.tar.gz
scummvm-rg350-6f10ef21507946f2ca3687aae7b00963786cf429.tar.bz2
scummvm-rg350-6f10ef21507946f2ca3687aae7b00963786cf429.zip
Made InitLUT use a PixelFormat instead of a ColorMask
svn-id: r36008
Diffstat (limited to 'graphics/scaler.cpp')
-rw-r--r--graphics/scaler.cpp15
1 files changed, 6 insertions, 9 deletions
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<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 @@ 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<Graphics::ColorMasks<555> >();
+ InitLUT(Graphics::createPixelFormat<555>());
if (gBitFormat == 565)
- InitLUT<Graphics::ColorMasks<565> >();
+ InitLUT(Graphics::createPixelFormat<565>());
#endif
}