aboutsummaryrefslogtreecommitdiff
path: root/graphics/decoders/bmp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/decoders/bmp.cpp')
-rw-r--r--graphics/decoders/bmp.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/graphics/decoders/bmp.cpp b/graphics/decoders/bmp.cpp
index f15d4e2519..bcfd0abbda 100644
--- a/graphics/decoders/bmp.cpp
+++ b/graphics/decoders/bmp.cpp
@@ -100,10 +100,10 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
_paletteColorCount = stream.readUint32LE();
/* uint32 colorsImportant = */ stream.readUint32LE();
- if (_paletteColorCount == 0)
- _paletteColorCount = 256;
-
if (bitsPerPixel == 8) {
+ if (_paletteColorCount == 0)
+ _paletteColorCount = 256;
+
// Read the palette
_palette = new byte[_paletteColorCount * 3];
for (uint16 i = 0; i < _paletteColorCount; i++) {
@@ -155,7 +155,7 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
}
} else { // 32 bpp
byte *dst = (byte *)_surface->pixels + (height - 1) * _surface->pitch;
-
+
for (int32 i = 0; i < height; i++) {
for (uint32 j = 0; j < width; j++) {
byte b = stream.readByte();
@@ -166,11 +166,11 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
// ref: http://msdn.microsoft.com/en-us/library/windows/desktop/dd183376%28v=vs.85%29.aspx
stream.readByte();
uint32 color = format.RGBToColor(r, g, b);
-
+
*((uint32 *)dst) = color;
dst += format.bytesPerPixel;
}
-
+
stream.skip(extraDataLength);
dst -= _surface->pitch * 2;
}