aboutsummaryrefslogtreecommitdiff
path: root/image/codecs/indeo
diff options
context:
space:
mode:
authorPaul Gilbert2016-11-18 20:55:37 -0500
committerPaul Gilbert2016-11-18 20:55:37 -0500
commit7f4d93ed935583fb0692f8a9cf92f51be5d4bc32 (patch)
tree2fcceb220c9425c275fd07a9420dde1f19f140e1 /image/codecs/indeo
parent5d8b0e478ee513652703253a50d3c3746f16a0b0 (diff)
downloadscummvm-rg350-7f4d93ed935583fb0692f8a9cf92f51be5d4bc32.tar.gz
scummvm-rg350-7f4d93ed935583fb0692f8a9cf92f51be5d4bc32.tar.bz2
scummvm-rg350-7f4d93ed935583fb0692f8a9cf92f51be5d4bc32.zip
IMAGE: Respect specified bytesPerPixel in Indeo decoders
Diffstat (limited to 'image/codecs/indeo')
-rw-r--r--image/codecs/indeo/indeo.cpp21
-rw-r--r--image/codecs/indeo/indeo.h2
2 files changed, 18 insertions, 5 deletions
diff --git a/image/codecs/indeo/indeo.cpp b/image/codecs/indeo/indeo.cpp
index 7d8a3ce114..f0be92483c 100644
--- a/image/codecs/indeo/indeo.cpp
+++ b/image/codecs/indeo/indeo.cpp
@@ -466,12 +466,25 @@ IVI45DecContext::IVI45DecContext() : _gb(nullptr), _frameNum(0), _frameType(0),
/*------------------------------------------------------------------------*/
-IndeoDecoderBase::IndeoDecoderBase(uint16 width, uint16 height) : Codec() {
- _pixelFormat = g_system->getScreenFormat();
- assert(_pixelFormat.bytesPerPixel > 1);
+IndeoDecoderBase::IndeoDecoderBase(uint16 width, uint16 height, uint bytesPerPixel) : Codec() {
+ switch (bytesPerPixel) {
+ case 16:
+ _pixelFormat = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
+ break;
+ case 24:
+ _pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 0, 16, 8, 0, 0);
+ break;
+ case 32:
+ _pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
+ break;
+ default:
+ error("Invalid color depth");
+ break;
+ }
+
_surface = new Graphics::Surface();
_surface->create(width, height, _pixelFormat);
- _surface->fillRect(Common::Rect(0, 0, width, height), 0);
+ _surface->fillRect(Common::Rect(0, 0, width, height), (bytesPerPixel == 4) ? 0xff : 0);
_ctx._bRefBuf = 3; // buffer 2 is used for scalability mode
}
diff --git a/image/codecs/indeo/indeo.h b/image/codecs/indeo/indeo.h
index 336685f625..114f0a10c8 100644
--- a/image/codecs/indeo/indeo.h
+++ b/image/codecs/indeo/indeo.h
@@ -574,7 +574,7 @@ protected:
*/
int scaleMV(int mv, int mvScale);
public:
- IndeoDecoderBase(uint16 width, uint16 height);
+ IndeoDecoderBase(uint16 width, uint16 height, uint bytesPerPixel);
virtual ~IndeoDecoderBase();
};