[Scummvm-git-logs] scummvm master -> 7f4d93ed935583fb0692f8a9cf92f51be5d4bc32

dreammaster dreammaster at scummvm.org
Sat Nov 19 02:55:55 CET 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7f4d93ed93 IMAGE: Respect specified bytesPerPixel in Indeo decoders


Commit: 7f4d93ed935583fb0692f8a9cf92f51be5d4bc32
    https://github.com/scummvm/scummvm/commit/7f4d93ed935583fb0692f8a9cf92f51be5d4bc32
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-11-18T20:55:37-05:00

Commit Message:
IMAGE: Respect specified bytesPerPixel in Indeo decoders

Changed paths:
    image/codecs/codec.cpp
    image/codecs/indeo/indeo.cpp
    image/codecs/indeo/indeo.h
    image/codecs/indeo4.cpp
    image/codecs/indeo4.h
    image/codecs/indeo5.cpp
    image/codecs/indeo5.h



diff --git a/image/codecs/codec.cpp b/image/codecs/codec.cpp
index 913b7af..d631a05 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 7d8a3ce..f0be924 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 336685f..114f0a1 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 ebe2f6f..62b5cae 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 4a6279d..9fb6435 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 7c16a3a..c2a4656 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 704bda5..4ce9d30 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);





More information about the Scummvm-git-logs mailing list