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

ysj1173886760 42030331+ysj1173886760 at users.noreply.github.com
Tue Aug 3 08:17:25 UTC 2021


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

Summary:
480fd72c2a DIRECTOR: clean code.
5c23fcdcb5 DIRECTOR: skip compression in BITD decoder for D3
1dfd722735 DIRECTOR: supporting inverting QDShape


Commit: 480fd72c2ac119c45a002a6afd7b838ba32bb49f
    https://github.com/scummvm/scummvm/commit/480fd72c2ac119c45a002a6afd7b838ba32bb49f
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-08-03T15:11:12+08:00

Commit Message:
DIRECTOR: clean code.

Changed paths:
    engines/director/images.cpp


diff --git a/engines/director/images.cpp b/engines/director/images.cpp
index 50e8344538..5cd5dc3626 100644
--- a/engines/director/images.cpp
+++ b/engines/director/images.cpp
@@ -211,8 +211,6 @@ bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
 						pixels.push_back(data);
 					}
 				}
-				if (_bitsPerPixel == 32 && pixels.size() % (_surface->w * 3) == 0)
-					stream.readUint16BE();
 			}
 		}
 	}


Commit: 5c23fcdcb577aca0377957a0bb08f8b84a529b9d
    https://github.com/scummvm/scummvm/commit/5c23fcdcb577aca0377957a0bb08f8b84a529b9d
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-08-03T15:13:30+08:00

Commit Message:
DIRECTOR: skip compression in BITD decoder for D3

Changed paths:
    engines/director/images.cpp


diff --git a/engines/director/images.cpp b/engines/director/images.cpp
index 5cd5dc3626..448aca9720 100644
--- a/engines/director/images.cpp
+++ b/engines/director/images.cpp
@@ -184,7 +184,7 @@ bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
 	// If the stream has exactly the required number of bits for this image,
 	// we assume it is uncompressed.
 	// logic above does not fit the situation when _bitsPerPixel == 1, need to fix.
-	if ((stream.size() == _pitch * _surface->h * _bitsPerPixel / 8) || (_bitsPerPixel != 1 && _version < kFileVer300 && stream.size() >= _surface->h * _surface->w * _bitsPerPixel / 8)) {
+	if ((stream.size() == _pitch * _surface->h * _bitsPerPixel / 8) || (_bitsPerPixel != 1 && _version < kFileVer400 && stream.size() >= _surface->h * _surface->w * _bitsPerPixel / 8)) {
 		debugC(6, kDebugImages, "Skipping compression");
 		for (int i = 0; i < stream.size(); i++) {
 			pixels.push_back((int)stream.readByte());


Commit: 1dfd72273517d7dbe4ee7f85aee4632ad81760b5
    https://github.com/scummvm/scummvm/commit/1dfd72273517d7dbe4ee7f85aee4632ad81760b5
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-08-03T16:14:50+08:00

Commit Message:
DIRECTOR: supporting inverting QDShape

Changed paths:
    engines/director/sprite.cpp
    engines/director/sprite.h
    engines/director/window.cpp


diff --git a/engines/director/sprite.cpp b/engines/director/sprite.cpp
index 665a18b94f..7c0bd1aec9 100644
--- a/engines/director/sprite.cpp
+++ b/engines/director/sprite.cpp
@@ -52,6 +52,7 @@ Sprite::Sprite(Frame *frame) {
 	_ink = kInkTypeCopy;
 	_trails = 0;
 
+	_matte = nullptr;
 	_cast = nullptr;
 
 	_thickness = 0;
@@ -71,6 +72,7 @@ Sprite::Sprite(Frame *frame) {
 }
 
 Sprite::~Sprite() {
+	delete _matte;
 }
 
 bool Sprite::isQDShape() {
@@ -85,6 +87,68 @@ bool Sprite::isQDShape() {
 		_spriteType == kThickLineSprite;
 }
 
+void Sprite::createQDMatte() {
+	Graphics::ManagedSurface tmp;
+	tmp.create(_width, _height, g_director->_pixelformat);
+	tmp.clear(g_director->_wm->_colorWhite);
+
+	Common::Rect srcRect(_width, _height);
+
+	Common::Rect fillAreaRect((int)srcRect.width(), (int)srcRect.height());
+	Graphics::MacPlotData plotFill(&tmp, nullptr, &g_director->getPatterns(), getPattern(), 0, 0, 1, g_director->_wm->_colorBlack);
+
+	// it's the same for filled and outlined qd shape when we are using floodfill, so we use filled rect directly since it won't be affected by line size.
+	switch (_spriteType) {
+	case kOutlinedRectangleSprite:
+	case kRectangleSprite:
+		Graphics::drawFilledRect(fillAreaRect, g_director->_wm->_colorBlack, g_director->_wm->getDrawPixel(), &plotFill);
+		break;
+	case kOutlinedRoundedRectangleSprite:
+	case kRoundedRectangleSprite:
+		Graphics::drawRoundRect(fillAreaRect, 12, g_director->_wm->_colorBlack, true, g_director->_wm->getDrawPixel(), &plotFill);
+		break;
+	case kOutlinedOvalSprite:
+	case kOvalSprite:
+		Graphics::drawEllipse(fillAreaRect.left, fillAreaRect.top, fillAreaRect.right, fillAreaRect.bottom, g_director->_wm->_colorBlack, true, g_director->_wm->getDrawPixel(), &plotFill);
+		break;
+	case kLineBottomTopSprite:
+	case kLineTopBottomSprite:
+		warning("Sprite::createQDMatte doesn't support creating matte for type %d", _spriteType);
+		break;
+	default:
+		warning("Sprite::createQDMatte Expected shape type but got type %d", _spriteType);
+	}
+
+	Graphics::Surface surface;
+	surface.create(_width, _height, g_director->_pixelformat);
+	surface.copyFrom(tmp);
+
+	_matte = new Graphics::FloodFill(&surface, g_director->_wm->_colorWhite, 0, true);
+
+	for (int yy = 0; yy < surface.h; yy++) {
+		_matte->addSeed(0, yy);
+		_matte->addSeed(surface.w - 1, yy);
+	}
+
+	for (int xx = 0; xx < surface.w; xx++) {
+		_matte->addSeed(xx, 0);
+		_matte->addSeed(xx, surface.h - 1);
+	}
+
+	_matte->fillMask();
+	tmp.free();
+	surface.free();
+}
+
+Graphics::Surface *Sprite::getQDMatte() {
+	if (!isQDShape() || _ink != kInkTypeMatte)
+		return nullptr;
+	if (!_matte)
+		createQDMatte();
+	return _matte ? _matte->getMask() : nullptr;
+}
+
+
 void Sprite::updateCast() {
 	if (!_cast)
 		return;
diff --git a/engines/director/sprite.h b/engines/director/sprite.h
index 24308bb16f..de51b0f450 100644
--- a/engines/director/sprite.h
+++ b/engines/director/sprite.h
@@ -77,11 +77,15 @@ public:
 
 	void setCast(CastMemberID memberID);
 	bool isQDShape();
+	Graphics::Surface *getQDMatte();
+	void createQDMatte();
 
 	Frame *_frame;
 	Score *_score;
 	Movie *_movie;
 
+	Graphics::FloodFill *_matte; // matte for quickdraw shape
+
 	CastMemberID _scriptId;
 	byte _colorcode; // x40 editable, 0x80 moveable
 	byte _blendAmount;
diff --git a/engines/director/window.cpp b/engines/director/window.cpp
index 91d5d7b41f..94e6f5c549 100644
--- a/engines/director/window.cpp
+++ b/engines/director/window.cpp
@@ -81,7 +81,14 @@ Window::~Window() {
 }
 
 void Window::invertChannel(Channel *channel, const Common::Rect &destRect) {
-	const Graphics::Surface *mask = channel->getMask(true);
+	const Graphics::Surface *mask;
+
+	// in D3, we have inverted QDshape
+	if (channel->_sprite->isQDShape() && channel->_sprite->_ink == kInkTypeMatte)
+		mask = channel->_sprite->getQDMatte();
+	else
+		mask = channel->getMask(true);
+
 	Common::Rect srcRect = channel->getBbox();
 	srcRect.clip(destRect);
 




More information about the Scummvm-git-logs mailing list