[Scummvm-git-logs] scummvm master -> 1b5f986df9b779035265f3a65250b0796cde07b3

ysj1173886760 42030331+ysj1173886760 at users.noreply.github.com
Thu Aug 5 09:43:31 UTC 2021


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

Summary:
adfa11e684 IMAGE: flip 8bpp images when we are decoding QuickTimeVideo
8bc3b3c1f1 DIRECTOR: reset the _stopTime when we are not playing video.
dc6211dac0 DIRECTOR: fix the condition of resetting stopTime
1b5f986df9 IMAGE: change the type of rleCode to int to prevent overflow.


Commit: adfa11e6846c81406f38624541d8d2776ce3a0b6
    https://github.com/scummvm/scummvm/commit/adfa11e6846c81406f38624541d8d2776ce3a0b6
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-08-05T15:06:14+08:00

Commit Message:
IMAGE: flip 8bpp images when we are decoding QuickTimeVideo

Changed paths:
    image/codecs/bmp_raw.cpp
    image/codecs/bmp_raw.h
    image/codecs/codec.cpp


diff --git a/image/codecs/bmp_raw.cpp b/image/codecs/bmp_raw.cpp
index 257fa02b82..fa04c91e65 100644
--- a/image/codecs/bmp_raw.cpp
+++ b/image/codecs/bmp_raw.cpp
@@ -28,8 +28,8 @@
 
 namespace Image {
 
-BitmapRawDecoder::BitmapRawDecoder(int width, int height, int bitsPerPixel) : Codec(),
-		_width(width), _height(height), _bitsPerPixel(bitsPerPixel) {
+BitmapRawDecoder::BitmapRawDecoder(int width, int height, int bitsPerPixel, bool isQT) : Codec(),
+		_width(width), _height(height), _bitsPerPixel(bitsPerPixel), _isQT(isQT) {
 	_surface.create(_width, _height, getPixelFormat());
 }
 
@@ -82,10 +82,11 @@ const Graphics::Surface *BitmapRawDecoder::decodeFrame(Common::SeekableReadStrea
 			stream.skip(extraDataLength);
 		}
 	} else if (_bitsPerPixel == 8) {
+		// flip the 8bpp images when we are decoding QTvideo
 		byte *dst = (byte *)_surface.getPixels();
 
 		for (int i = 0; i < _height; i++) {
-			stream.read(dst + (_height - i - 1) * _width, _width);
+			stream.read(dst + (_isQT ? i : _height - i - 1) * _width, _width);
 			stream.skip(extraDataLength);
 		}
 	} else if (_bitsPerPixel == 24) {
diff --git a/image/codecs/bmp_raw.h b/image/codecs/bmp_raw.h
index 8ec79e7230..808fc35f11 100644
--- a/image/codecs/bmp_raw.h
+++ b/image/codecs/bmp_raw.h
@@ -34,7 +34,7 @@ namespace Image {
  */
 class BitmapRawDecoder : public Codec {
 public:
-	BitmapRawDecoder(int width, int height, int bitsPerPixel);
+	BitmapRawDecoder(int width, int height, int bitsPerPixel, bool isQT = false);
 	~BitmapRawDecoder();
 
 	const Graphics::Surface *decodeFrame(Common::SeekableReadStream &stream);
@@ -44,6 +44,10 @@ private:
 	Graphics::Surface _surface;
 	int _width, _height;
 	int _bitsPerPixel;
+
+	// this flag indicates whether bitmapRawDecoder is created to decode QTvideo or raw images.
+	// because we need to flip the image when we are dealing with QTvideo
+	bool _isQT;
 };
 
 } // End of namespace Image
diff --git a/image/codecs/codec.cpp b/image/codecs/codec.cpp
index 4e161428d2..e083a2f3fb 100644
--- a/image/codecs/codec.cpp
+++ b/image/codecs/codec.cpp
@@ -278,7 +278,7 @@ Codec *createQuickTimeCodec(uint32 tag, int width, int height, int bitsPerPixel)
 		return new CDToonsDecoder(width, height);
 	case MKTAG('r','a','w',' '):
 		// Used my L-Zone-mac (Director game)
-		return new BitmapRawDecoder(width, height, bitsPerPixel);
+		return new BitmapRawDecoder(width, height, bitsPerPixel, true);
 	default:
 		warning("Unsupported QuickTime codec \'%s\'", tag2str(tag));
 	}


Commit: 8bc3b3c1f13de38d690cced7cf95c034375c7282
    https://github.com/scummvm/scummvm/commit/8bc3b3c1f13de38d690cced7cf95c034375c7282
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-08-05T17:00:35+08:00

Commit Message:
DIRECTOR: reset the _stopTime when we are not playing video.

Changed paths:
    engines/director/channel.cpp


diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp
index b91906c33d..06fc429e39 100644
--- a/engines/director/channel.cpp
+++ b/engines/director/channel.cpp
@@ -356,6 +356,10 @@ void Channel::setClean(Sprite *nextSprite, int spriteId, bool partial) {
 	updateTextCast();
 	updateGlobalAttr();
 
+	// reset the stop time when we are not playing video
+	if (_stopTime && _sprite->_cast && _sprite->_cast->_type != kCastDigitalVideo)
+		_stopTime = 0;
+
 	_dirty = false;
 }
 


Commit: dc6211dac023b15e0596829a0569bb7c92cc60d5
    https://github.com/scummvm/scummvm/commit/dc6211dac023b15e0596829a0569bb7c92cc60d5
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-08-05T17:10:52+08:00

Commit Message:
DIRECTOR: fix the condition of resetting stopTime

Changed paths:
    engines/director/channel.cpp


diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp
index 06fc429e39..4ddee7cfbd 100644
--- a/engines/director/channel.cpp
+++ b/engines/director/channel.cpp
@@ -357,7 +357,7 @@ void Channel::setClean(Sprite *nextSprite, int spriteId, bool partial) {
 	updateGlobalAttr();
 
 	// reset the stop time when we are not playing video
-	if (_stopTime && _sprite->_cast && _sprite->_cast->_type != kCastDigitalVideo)
+	if (_stopTime && (!_sprite->_cast || (_sprite->_cast && _sprite->_cast->_type != kCastDigitalVideo)))
 		_stopTime = 0;
 
 	_dirty = false;


Commit: 1b5f986df9b779035265f3a65250b0796cde07b3
    https://github.com/scummvm/scummvm/commit/1b5f986df9b779035265f3a65250b0796cde07b3
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-08-05T17:42:10+08:00

Commit Message:
IMAGE: change the type of rleCode to int to prevent overflow.

Changed paths:
    image/codecs/qtrle.cpp


diff --git a/image/codecs/qtrle.cpp b/image/codecs/qtrle.cpp
index 23ef8bfb5f..818572ab84 100644
--- a/image/codecs/qtrle.cpp
+++ b/image/codecs/qtrle.cpp
@@ -83,7 +83,7 @@ void QTRLEDecoder::decode1(Common::SeekableReadStream &stream, uint32 rowPtr, ui
 	while (linesToChange) {
 		CHECK_STREAM_PTR(2);
 		byte skip = stream.readByte();
-		int8 rleCode = stream.readSByte();
+		int rleCode = stream.readSByte();
 
 		if (rleCode == 0)
 			break;
@@ -129,7 +129,7 @@ void QTRLEDecoder::decode2_4(Common::SeekableReadStream &stream, uint32 rowPtr,
 		CHECK_STREAM_PTR(2);
 		pixelPtr = rowPtr + (numPixels * (stream.readByte() - 1));
 
-		for (int8 rleCode = stream.readSByte(); rleCode != -1; rleCode = stream.readSByte()) {
+		for (int rleCode = stream.readSByte(); rleCode != -1; rleCode = stream.readSByte()) {
 			if (rleCode == 0) {
 				// there's another skip code in the stream
 				CHECK_STREAM_PTR(1);
@@ -188,7 +188,7 @@ void QTRLEDecoder::decode8(Common::SeekableReadStream &stream, uint32 rowPtr, ui
 		CHECK_STREAM_PTR(2);
 		pixelPtr = rowPtr + 4 * (stream.readByte() - 1);
 
-		for (int8 rleCode = stream.readSByte(); rleCode != -1; rleCode = stream.readSByte()) {
+		for (int rleCode = stream.readSByte(); rleCode != -1; rleCode = stream.readSByte()) {
 			if (rleCode == 0) {
 				// there's another skip code in the stream
 				CHECK_STREAM_PTR(1);
@@ -233,7 +233,7 @@ void QTRLEDecoder::decode16(Common::SeekableReadStream &stream, uint32 rowPtr, u
 		CHECK_STREAM_PTR(2);
 		pixelPtr = rowPtr + stream.readByte() - 1;
 
-		for (int8 rleCode = stream.readSByte(); rleCode != -1; rleCode = stream.readSByte()) {
+		for (int rleCode = stream.readSByte(); rleCode != -1; rleCode = stream.readSByte()) {
 			if (rleCode == 0) {
 				// there's another skip code in the stream
 				CHECK_STREAM_PTR(1);
@@ -271,7 +271,7 @@ void QTRLEDecoder::decode24(Common::SeekableReadStream &stream, uint32 rowPtr, u
 		CHECK_STREAM_PTR(2);
 		pixelPtr = rowPtr + stream.readByte() - 1;
 
-		for (int8 rleCode = stream.readSByte(); rleCode != -1; rleCode = stream.readSByte()) {
+		for (int rleCode = stream.readSByte(); rleCode != -1; rleCode = stream.readSByte()) {
 			if (rleCode == 0) {
 				// there's another skip code in the stream
 				CHECK_STREAM_PTR(1);
@@ -338,7 +338,7 @@ void QTRLEDecoder::dither24(Common::SeekableReadStream &stream, uint32 rowPtr, u
 		pixelPtr = rowPtr + rowOffset;
 		uint16 colorTableOffset = colorTableOffsets[curColorTableOffset] + (rowOffset << 14);
 
-		for (int8 rleCode = stream.readSByte(); rleCode != -1; rleCode = stream.readSByte()) {
+		for (int rleCode = stream.readSByte(); rleCode != -1; rleCode = stream.readSByte()) {
 			if (rleCode == 0) {
 				// there's another skip code in the stream
 				CHECK_STREAM_PTR(1);
@@ -382,7 +382,7 @@ void QTRLEDecoder::decode32(Common::SeekableReadStream &stream, uint32 rowPtr, u
 		CHECK_STREAM_PTR(2);
 		pixelPtr = rowPtr + stream.readByte() - 1;
 
-		for (int8 rleCode = stream.readSByte(); rleCode != -1; rleCode = stream.readSByte()) {
+		for (int rleCode = stream.readSByte(); rleCode != -1; rleCode = stream.readSByte()) {
 			if (rleCode == 0) {
 				// there's another skip code in the stream
 				CHECK_STREAM_PTR(1);




More information about the Scummvm-git-logs mailing list