aboutsummaryrefslogtreecommitdiff
path: root/image/bmp.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2014-02-27 21:27:25 -0500
committerMatthew Hoops2014-02-28 00:32:06 -0500
commit05e9ff136ae059622a0262380be7bc6460d204f0 (patch)
treedc91928bfbb8f00038ea63234fe64402d1efbd5a /image/bmp.cpp
parent231a02c759169a5c927018699e1533d267ea8372 (diff)
downloadscummvm-rg350-05e9ff136ae059622a0262380be7bc6460d204f0.tar.gz
scummvm-rg350-05e9ff136ae059622a0262380be7bc6460d204f0.tar.bz2
scummvm-rg350-05e9ff136ae059622a0262380be7bc6460d204f0.zip
IMAGE: Share the same pool of codecs between bitmap and AVI
Diffstat (limited to 'image/bmp.cpp')
-rw-r--r--image/bmp.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/image/bmp.cpp b/image/bmp.cpp
index eb8e300daf..cdf6e4097d 100644
--- a/image/bmp.cpp
+++ b/image/bmp.cpp
@@ -27,7 +27,7 @@
#include "common/textconsole.h"
#include "graphics/pixelformat.h"
#include "graphics/surface.h"
-#include "image/codecs/bmp_raw.h"
+#include "image/codecs/codec.h"
namespace Image {
@@ -93,13 +93,7 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
return false;
}
- uint32 compression = stream.readUint32LE();
-
- if (compression != 0) {
- warning("Compressed bitmaps not supported");
- return false;
- }
-
+ uint32 compression = stream.readUint32BE();
uint32 imageSize = stream.readUint32LE();
/* uint32 pixelsPerMeterX = */ stream.readUint32LE();
/* uint32 pixelsPerMeterY = */ stream.readUint32LE();
@@ -120,11 +114,15 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
}
}
+ // Create the codec (it will warn about unhandled compression)
+ _codec = createBitmapCodec(compression, width, height, bitsPerPixel);
+ if (!_codec)
+ return false;
+
// Grab the frame data
Common::SeekableSubReadStream subStream(&stream, imageOffset, imageOffset + imageSize);
// We only support raw bitmaps for now
- _codec = new BitmapRawDecoder(width, height, bitsPerPixel);
_surface = _codec->decodeFrame(subStream);
return true;