[Scummvm-git-logs] scummvm master -> 2f574b8988801348b16b719be7d8155cb3fdbb8b

ysj1173886760 42030331+ysj1173886760 at users.noreply.github.com
Thu Jul 8 09:48:20 UTC 2021


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:
2f574b8988 DIRECTOR: constrain offset of BITD decoder to either 1 or 0.


Commit: 2f574b8988801348b16b719be7d8155cb3fdbb8b
    https://github.com/scummvm/scummvm/commit/2f574b8988801348b16b719be7d8155cb3fdbb8b
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-08T17:48:00+08:00

Commit Message:
DIRECTOR: constrain offset of BITD decoder to either 1 or 0.

Changed paths:
    engines/director/images.cpp


diff --git a/engines/director/images.cpp b/engines/director/images.cpp
index 19be183ad1..807b3d1102 100644
--- a/engines/director/images.cpp
+++ b/engines/director/images.cpp
@@ -220,7 +220,7 @@ bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
 		int tail = (_surface->w * _surface->h * _bitsPerPixel / 8) - pixels.size();
 
 		warning("BITDDecoder::loadStream(): premature end of stream (%d of %d pixels)",
-			pixels.size(), pixels.size() + tail);
+				pixels.size(), pixels.size() + tail);
 
 		for (int i = 0; i < tail; i++)
 			pixels.push_back(0);
@@ -229,6 +229,10 @@ bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
 	int offset = 0;
 	if (_surface->w < (int)(pixels.size() / _surface->h))
 		offset = (pixels.size() / _surface->h) - _surface->w;
+	// looks like the data want to round up to 2, so we either got offset 1 or 0.
+	// but we may met situation when the pixel size is exactly equals to w * h, thus we add a check here.
+	if (offset)
+		offset = _surface->w % 2;
 
 	uint32 color;
 	bool paletted = (g_director->_pixelformat.bytesPerPixel == 1);




More information about the Scummvm-git-logs mailing list