From 4172334b51a33c0b68ad81ceba2aaf1a6e70d8f2 Mon Sep 17 00:00:00 2001
From: RichieSams
Date: Tue, 1 Oct 2013 17:44:29 -0500
Subject: ZVISION: Remove global const variables

Instead, use ColorMasks
---
 engines/zvision/rlf_animation.cpp | 19 +++++++++----------
 engines/zvision/rlf_animation.h   |  3 ---
 2 files changed, 9 insertions(+), 13 deletions(-)

(limited to 'engines')

diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp
index d932fa7698..008a246267 100644
--- a/engines/zvision/rlf_animation.cpp
+++ b/engines/zvision/rlf_animation.cpp
@@ -28,14 +28,13 @@
 #include "common/debug.h"
 #include "common/endian.h"
 
+#include "graphics/colormasks.h"
+
 #include "zvision/rlf_animation.h"
 
 
 namespace ZVision {
 
-const Graphics::PixelFormat RlfAnimation::_pixelFormat555 = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
-const Graphics::PixelFormat RlfAnimation::_pixelFormat565 = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
-
 RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream) 
 		: _stream(stream),
 		  _lastFrameRead(0),
@@ -56,7 +55,7 @@ RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream)
 		return;
 	}
 
-	_currentFrameBuffer.create(_width, _height, _pixelFormat565);
+	_currentFrameBuffer.create(_width, _height, Graphics::createPixelFormat<565>());
 	_frameBufferByteSize = _width * _height * sizeof(uint16);
 
 	if (!stream) {
@@ -247,8 +246,8 @@ void RlfAnimation::decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint3
 				}
 
 				byte r, g, b;
-				_pixelFormat555.colorToRGB(READ_LE_UINT16(source + sourceOffset), r, g, b);
-				uint16 destColor = _pixelFormat565.RGBToColor(r, g, b);
+				Graphics::colorToRGB<Graphics::ColorMasks<555>>(READ_LE_UINT16(source + sourceOffset), r, g, b);
+				uint16 destColor = Graphics::RGBToColor<Graphics::ColorMasks<565>>(r, g, b);
 				WRITE_UINT16(dest + destOffset, destColor);
 
 				sourceOffset += 2;
@@ -293,8 +292,8 @@ void RlfAnimation::decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint3
 				}
 
 				byte r, g, b;
-				_pixelFormat555.colorToRGB(READ_LE_UINT16(source + sourceOffset), r, g, b);
-				uint16 destColor = _pixelFormat565.RGBToColor(r, g, b);
+				Graphics::colorToRGB<Graphics::ColorMasks<555>>(READ_LE_UINT16(source + sourceOffset), r, g, b);
+				uint16 destColor = Graphics::RGBToColor<Graphics::ColorMasks<565>>(r, g, b);
 				WRITE_UINT16(dest + destOffset, destColor);
 
 				sourceOffset += 2;
@@ -310,8 +309,8 @@ void RlfAnimation::decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint3
 			}
 
 			byte r, g, b;
-			_pixelFormat555.colorToRGB(READ_LE_UINT16(source + sourceOffset), r, g, b);
-			uint16 sampleColor = _pixelFormat565.RGBToColor(r, g, b);
+			Graphics::colorToRGB<Graphics::ColorMasks<555>>(READ_LE_UINT16(source + sourceOffset), r, g, b);
+			uint16 sampleColor = Graphics::RGBToColor<Graphics::ColorMasks<565>>(r, g, b);
 			sourceOffset += 2;
 
 			numberOfSamples += 2;
diff --git a/engines/zvision/rlf_animation.h b/engines/zvision/rlf_animation.h
index 3f205d9666..ca9004f8b6 100644
--- a/engines/zvision/rlf_animation.h
+++ b/engines/zvision/rlf_animation.h
@@ -52,9 +52,6 @@ private:
 		uint32 encodedSize;
 	};
 
-	const static Graphics::PixelFormat _pixelFormat555;
-	const static Graphics::PixelFormat _pixelFormat565;
-
 private:
 	Common::File _file;
 	bool _stream;
-- 
cgit v1.2.3