ZVISION: Remove global const variables
Instead, use ColorMasks
This commit is contained in:
parent
ffaffa2bc4
commit
4172334b51
2 changed files with 9 additions and 13 deletions
|
@ -28,14 +28,13 @@
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/endian.h"
|
#include "common/endian.h"
|
||||||
|
|
||||||
|
#include "graphics/colormasks.h"
|
||||||
|
|
||||||
#include "zvision/rlf_animation.h"
|
#include "zvision/rlf_animation.h"
|
||||||
|
|
||||||
|
|
||||||
namespace ZVision {
|
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)
|
RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream)
|
||||||
: _stream(stream),
|
: _stream(stream),
|
||||||
_lastFrameRead(0),
|
_lastFrameRead(0),
|
||||||
|
@ -56,7 +55,7 @@ RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_currentFrameBuffer.create(_width, _height, _pixelFormat565);
|
_currentFrameBuffer.create(_width, _height, Graphics::createPixelFormat<565>());
|
||||||
_frameBufferByteSize = _width * _height * sizeof(uint16);
|
_frameBufferByteSize = _width * _height * sizeof(uint16);
|
||||||
|
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
|
@ -247,8 +246,8 @@ void RlfAnimation::decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint3
|
||||||
}
|
}
|
||||||
|
|
||||||
byte r, g, b;
|
byte r, g, b;
|
||||||
_pixelFormat555.colorToRGB(READ_LE_UINT16(source + sourceOffset), r, g, b);
|
Graphics::colorToRGB<Graphics::ColorMasks<555>>(READ_LE_UINT16(source + sourceOffset), r, g, b);
|
||||||
uint16 destColor = _pixelFormat565.RGBToColor(r, g, b);
|
uint16 destColor = Graphics::RGBToColor<Graphics::ColorMasks<565>>(r, g, b);
|
||||||
WRITE_UINT16(dest + destOffset, destColor);
|
WRITE_UINT16(dest + destOffset, destColor);
|
||||||
|
|
||||||
sourceOffset += 2;
|
sourceOffset += 2;
|
||||||
|
@ -293,8 +292,8 @@ void RlfAnimation::decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint3
|
||||||
}
|
}
|
||||||
|
|
||||||
byte r, g, b;
|
byte r, g, b;
|
||||||
_pixelFormat555.colorToRGB(READ_LE_UINT16(source + sourceOffset), r, g, b);
|
Graphics::colorToRGB<Graphics::ColorMasks<555>>(READ_LE_UINT16(source + sourceOffset), r, g, b);
|
||||||
uint16 destColor = _pixelFormat565.RGBToColor(r, g, b);
|
uint16 destColor = Graphics::RGBToColor<Graphics::ColorMasks<565>>(r, g, b);
|
||||||
WRITE_UINT16(dest + destOffset, destColor);
|
WRITE_UINT16(dest + destOffset, destColor);
|
||||||
|
|
||||||
sourceOffset += 2;
|
sourceOffset += 2;
|
||||||
|
@ -310,8 +309,8 @@ void RlfAnimation::decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint3
|
||||||
}
|
}
|
||||||
|
|
||||||
byte r, g, b;
|
byte r, g, b;
|
||||||
_pixelFormat555.colorToRGB(READ_LE_UINT16(source + sourceOffset), r, g, b);
|
Graphics::colorToRGB<Graphics::ColorMasks<555>>(READ_LE_UINT16(source + sourceOffset), r, g, b);
|
||||||
uint16 sampleColor = _pixelFormat565.RGBToColor(r, g, b);
|
uint16 sampleColor = Graphics::RGBToColor<Graphics::ColorMasks<565>>(r, g, b);
|
||||||
sourceOffset += 2;
|
sourceOffset += 2;
|
||||||
|
|
||||||
numberOfSamples += 2;
|
numberOfSamples += 2;
|
||||||
|
|
|
@ -52,9 +52,6 @@ private:
|
||||||
uint32 encodedSize;
|
uint32 encodedSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
const static Graphics::PixelFormat _pixelFormat555;
|
|
||||||
const static Graphics::PixelFormat _pixelFormat565;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Common::File _file;
|
Common::File _file;
|
||||||
bool _stream;
|
bool _stream;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue