aboutsummaryrefslogtreecommitdiff
path: root/graphics/decoders/bmp.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2012-05-14 00:49:10 -0400
committerMatthew Hoops2012-05-14 09:56:56 -0400
commitd789df894552bf73709628f09a0282b462df797e (patch)
tree221de03284a568a9db5f54a88754bdb0aa3b8241 /graphics/decoders/bmp.cpp
parentc3f0a426fcbe2c8991b29c0e4bda1e7f0c9263b9 (diff)
downloadscummvm-rg350-d789df894552bf73709628f09a0282b462df797e.tar.gz
scummvm-rg350-d789df894552bf73709628f09a0282b462df797e.tar.bz2
scummvm-rg350-d789df894552bf73709628f09a0282b462df797e.zip
GRAPHICS: Add palette start index and color count functions to ImageDecoder
Diffstat (limited to 'graphics/decoders/bmp.cpp')
-rw-r--r--graphics/decoders/bmp.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/graphics/decoders/bmp.cpp b/graphics/decoders/bmp.cpp
index 0d44881d7c..5f764e1bd3 100644
--- a/graphics/decoders/bmp.cpp
+++ b/graphics/decoders/bmp.cpp
@@ -31,6 +31,7 @@ namespace Graphics {
BitmapDecoder::BitmapDecoder() {
_surface = 0;
_palette = 0;
+ _paletteColorCount = 0;
}
BitmapDecoder::~BitmapDecoder() {
@@ -44,6 +45,7 @@ void BitmapDecoder::destroy() {
}
delete[] _palette; _palette = 0;
+ _paletteColorCount = 0;
}
bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
@@ -95,16 +97,16 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
/* uint32 imageSize = */ stream.readUint32LE();
/* uint32 pixelsPerMeterX = */ stream.readUint32LE();
/* uint32 pixelsPerMeterY = */ stream.readUint32LE();
- uint32 colorsUsed = stream.readUint32LE();
+ _paletteColorCount = stream.readUint32LE();
/* uint32 colorsImportant = */ stream.readUint32LE();
- if (colorsUsed == 0)
- colorsUsed = 256;
+ if (_paletteColorCount == 0)
+ _paletteColorCount = 256;
if (bitsPerPixel == 8) {
// Read the palette
- _palette = new byte[colorsUsed * 3];
- for (uint16 i = 0; i < colorsUsed; i++) {
+ _palette = new byte[_paletteColorCount * 3];
+ for (uint16 i = 0; i < _paletteColorCount; i++) {
_palette[i * 3 + 2] = stream.readByte();
_palette[i * 3 + 1] = stream.readByte();
_palette[i * 3 + 0] = stream.readByte();