aboutsummaryrefslogtreecommitdiff
path: root/image/codecs
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
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')
-rw-r--r--image/codecs/codec.cpp2
-rw-r--r--image/codecs/indeo/indeo.cpp21
-rw-r--r--image/codecs/indeo/indeo.h2
-rw-r--r--image/codecs/indeo4.cpp3
-rw-r--r--image/codecs/indeo4.h2
-rw-r--r--image/codecs/indeo5.cpp3
-rw-r--r--image/codecs/indeo5.h2
7 files changed, 25 insertions, 10 deletions
diff --git a/image/codecs/codec.cpp b/image/codecs/codec.cpp
index 913b7afab3..d631a052bb 100644
--- a/image/codecs/codec.cpp
+++ b/image/codecs/codec.cpp
@@ -213,7 +213,7 @@ Codec *createBitmapCodec(uint32 tag, int width, int height, int bitsPerPixel) {
return new Indeo3Decoder(width, height);
case MKTAG('I', 'V', '4', '1'):
case MKTAG('I', 'V', '4', '2'):
- return new Indeo4Decoder(width, height);
+ return new Indeo4Decoder(width, height, bitsPerPixel);
case MKTAG('I', 'V', '5', '0'):
return new Indeo5Decoder(width, height);
#ifdef IMAGE_CODECS_TRUEMOTION1_H
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();
};
diff --git a/image/codecs/indeo4.cpp b/image/codecs/indeo4.cpp
index ebe2f6f7b4..62b5cae271 100644
--- a/image/codecs/indeo4.cpp
+++ b/image/codecs/indeo4.cpp
@@ -37,7 +37,8 @@ namespace Image {
#define IVI4_PIC_SIZE_ESC 7
-Indeo4Decoder::Indeo4Decoder(uint16 width, uint16 height) : IndeoDecoderBase(width, height) {
+Indeo4Decoder::Indeo4Decoder(uint16 width, uint16 height, uint bytesPerPixel) :
+ IndeoDecoderBase(width, height, bytesPerPixel) {
_ctx._isIndeo4 = true;
_ctx._refBuf = 1;
_ctx._bRefBuf = 3;
diff --git a/image/codecs/indeo4.h b/image/codecs/indeo4.h
index 4a6279db37..9fb6435ed5 100644
--- a/image/codecs/indeo4.h
+++ b/image/codecs/indeo4.h
@@ -52,7 +52,7 @@ class Indeo4Decoder : public IndeoDecoderBase {
bool _is2dTrans;
};
public:
- Indeo4Decoder(uint16 width, uint16 height);
+ Indeo4Decoder(uint16 width, uint16 height, uint bytesPerPixel = 2);
virtual ~Indeo4Decoder() {}
virtual const Graphics::Surface *decodeFrame(Common::SeekableReadStream &stream);
diff --git a/image/codecs/indeo5.cpp b/image/codecs/indeo5.cpp
index 7c16a3a6de..c2a4656cea 100644
--- a/image/codecs/indeo5.cpp
+++ b/image/codecs/indeo5.cpp
@@ -48,7 +48,8 @@ enum {
#define IVI5_PIC_SIZE_ESC 15
-Indeo5Decoder::Indeo5Decoder(uint16 width, uint16 height) : IndeoDecoderBase(width, height) {
+Indeo5Decoder::Indeo5Decoder(uint16 width, uint16 height, uint bytesPerPixel) :
+ IndeoDecoderBase(width, height, bytesPerPixel) {
_ctx._isIndeo4 = false;
_ctx._refBuf = 1;
_ctx._bRefBuf = 3;
diff --git a/image/codecs/indeo5.h b/image/codecs/indeo5.h
index 704bda5e4b..4ce9d30b92 100644
--- a/image/codecs/indeo5.h
+++ b/image/codecs/indeo5.h
@@ -52,7 +52,7 @@ class Indeo5Decoder : public IndeoDecoderBase {
int is_2d_trans;
};
public:
- Indeo5Decoder(uint16 width, uint16 height);
+ Indeo5Decoder(uint16 width, uint16 height, uint bytesPerPixel = 2);
virtual ~Indeo5Decoder() {}
virtual const Graphics::Surface *decodeFrame(Common::SeekableReadStream &stream);