[Scummvm-git-logs] scummvm master -> 7563759f4bb6db083f996d568ccf9635c44b4b79

sev- sev at scummvm.org
Sun Aug 16 21:56:44 UTC 2020


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

Summary:
367dd5ff66 GRAPHICS: MACGUI: More fixed for 32bpp mode
3f160561d6 DIRECTOR: Fixed for 32bpp mode, things work
03055cb49d DIRECTOR: Keep alpha when inverting a channel in 32bpp mode
97fecbec16 DIRECTOR: Simplify DigitalVideo rendering
e8e137a46c GRAPHICS: Create FloodFill mask with the matching pixel format of the main surface
7563759f4b DIRECTOR: Fix Matte Ink for 32bpp mode


Commit: 367dd5ff663d22b84df3fbd8b669cf30b228899b
    https://github.com/scummvm/scummvm/commit/367dd5ff663d22b84df3fbd8b669cf30b228899b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-08-16T23:08:33+02:00

Commit Message:
GRAPHICS: MACGUI: More fixed for 32bpp mode

Changed paths:
    graphics/macgui/macwidget.cpp
    graphics/macgui/macwidget.h
    graphics/macgui/macwindowmanager.cpp
    graphics/macgui/macwindowmanager.h


diff --git a/graphics/macgui/macwidget.cpp b/graphics/macgui/macwidget.cpp
index 321e9daeb9..f2256762bd 100644
--- a/graphics/macgui/macwidget.cpp
+++ b/graphics/macgui/macwidget.cpp
@@ -85,7 +85,7 @@ void MacWidget::blit(ManagedSurface *g, Common::Rect &dest) {
 	g->transBlitFrom(*_composeSurface, _composeSurface->getBounds(), dest, _wm->_colorGreen2);
 }
 
-void MacWidget::setColors(int fg, int bg) {
+void MacWidget::setColors(uint32 fg, uint32 bg) {
 	_fgcolor = fg;
 	_bgcolor = bg;
 
diff --git a/graphics/macgui/macwidget.h b/graphics/macgui/macwidget.h
index a25a7260e3..69e6e76da5 100644
--- a/graphics/macgui/macwidget.h
+++ b/graphics/macgui/macwidget.h
@@ -71,7 +71,7 @@ public:
 	virtual bool hasAllFocus() { return _active; }
 	virtual bool isEditable() { return _editable; }
 
-	virtual void setColors(int fg, int bg);
+	virtual void setColors(uint32 fg, uint32 bg);
 
 	virtual void setDimensions(const Common::Rect &r) {
 		_dims = r;
@@ -89,7 +89,7 @@ protected:
 	uint16 _gutter;
 	uint16 _shadow;
 
-	int _fgcolor, _bgcolor;
+	uint32 _fgcolor, _bgcolor;
 
 	Graphics::ManagedSurface *_composeSurface;
 
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 79b8c4baf1..63295bd351 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -988,10 +988,14 @@ uint MacWindowManager::findBestColor(byte cr, byte cg, byte cb) {
 	return bestColor;
 }
 
-void MacWindowManager::decomposeColor(byte color, byte &r, byte &g, byte &b) {
-	r = *(_palette + 3 * color + 0);
-	g = *(_palette + 3 * color + 1);
-	b = *(_palette + 3 * color + 2);
+void MacWindowManager::decomposeColor(uint32 color, byte &r, byte &g, byte &b) {
+	if (_pixelformat.bytesPerPixel == 1 || color <= 0xff) {
+		r = *(_palette + 3 * color + 0);
+		g = *(_palette + 3 * color + 1);
+		b = *(_palette + 3 * color + 2);
+	} else {
+		_pixelformat.colorToRGB(color, r, g, b);
+	}
 }
 
 PauseToken MacWindowManager::pauseEngine() {
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index 3ff4d3568a..ebf9ce5065 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -295,7 +295,7 @@ public:
 
 	void passPalette(const byte *palette, uint size);
 	uint findBestColor(byte cr, byte cg, byte cb);
-	void decomposeColor(byte color, byte &r, byte &g, byte &b);
+	void decomposeColor(uint32 color, byte &r, byte &g, byte &b);
 
 	void renderZoomBox(bool redraw = false);
 	void addZoomBox(ZoomBox *box);


Commit: 3f160561d61763e8b648ceac16ff2f633bb5bdfa
    https://github.com/scummvm/scummvm/commit/3f160561d61763e8b648ceac16ff2f633bb5bdfa
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-08-16T23:08:33+02:00

Commit Message:
DIRECTOR: Fixed for 32bpp mode, things work

Changed paths:
    engines/director/channel.cpp
    engines/director/channel.h
    engines/director/director.h
    engines/director/graphics.cpp
    engines/director/movie.cpp
    engines/director/sprite.cpp
    engines/director/sprite.h
    engines/director/window.cpp


diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp
index cf93328fde..779ca503de 100644
--- a/engines/director/channel.cpp
+++ b/engines/director/channel.cpp
@@ -493,7 +493,7 @@ MacShape *Channel::getShape() {
 	return shape;
 }
 
-uint Channel::getBackColor() {
+uint32 Channel::getBackColor() {
 	if (!_sprite->_cast)
 		return _sprite->_backColor;
 
@@ -508,7 +508,7 @@ uint Channel::getBackColor() {
 	}
 }
 
-uint Channel::getForeColor() {
+uint32 Channel::getForeColor() {
 	if (!_sprite->_cast)
 		return _sprite->_foreColor;
 
diff --git a/engines/director/channel.h b/engines/director/channel.h
index b284cd1562..fedb36691c 100644
--- a/engines/director/channel.h
+++ b/engines/director/channel.h
@@ -89,8 +89,8 @@ private:
 	Graphics::ManagedSurface *getSurface();
 	MacShape *getShape();
 	Common::Point getPosition();
-	uint getForeColor();
-	uint getBackColor();
+	uint32 getForeColor();
+	uint32 getBackColor();
 
 	void addRegistrationOffset(Common::Point &pos, bool subtract = false);
 };
diff --git a/engines/director/director.h b/engines/director/director.h
index dc7fe09759..397eff8cba 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -139,22 +139,22 @@ struct DirectorPlotData {
 
 	SpriteType sprite;
 	InkType ink;
-	int colorWhite;
-	int colorBlack;
+	uint32 colorWhite;
+	uint32 colorBlack;
 	int alpha;
 
-	int backColor;
-	int foreColor;
+	uint32 backColor;
+	uint32 foreColor;
 	bool applyColor;
 
 	void setApplyColor(); // graphics.cpp
 
-	DirectorPlotData(Graphics::MacWindowManager *w, SpriteType s, InkType i, int a, uint b, uint f) : _wm(w), sprite(s), ink(i), alpha(a), backColor(b), foreColor(f) {
+	DirectorPlotData(Graphics::MacWindowManager *w, SpriteType s, InkType i, int a, uint32 b, uint32 f) : _wm(w), sprite(s), ink(i), alpha(a), backColor(b), foreColor(f) {
 		srf = nullptr;
 		ms = nullptr;
 		dst = nullptr;
-		colorWhite = 255;
-		colorBlack = 0;
+		colorWhite = w->_colorWhite;
+		colorBlack = w->_colorBlack;
 		applyColor = false;
 	}
 
diff --git a/engines/director/graphics.cpp b/engines/director/graphics.cpp
index 78d4a34515..52a1fc1ad4 100644
--- a/engines/director/graphics.cpp
+++ b/engines/director/graphics.cpp
@@ -950,10 +950,10 @@ void inkDrawPixel(int x, int y, int src, void *data) {
 					*dst = p->_wm->findBestColor((rSrc + rDst) / 2, (gSrc + gDst) / 2, (bSrc + bDst) / 2);
 				break;
 			case kInkTypeAddPin:
-					*dst = p->_wm->findBestColor(MIN((rSrc + rDst), p->colorWhite), MIN((gSrc + gDst), p->colorWhite), MIN((bSrc + bDst), p->colorWhite));
+					*dst = p->_wm->findBestColor(MIN((rSrc + rDst), 0xff), MIN((gSrc + gDst), 0xff), MIN((bSrc + bDst), 0xff));
 				break;
 			case kInkTypeAdd:
-					*dst = p->_wm->findBestColor(abs(rSrc + rDst) % p->colorWhite + 1, abs(gSrc + gDst) % p->colorWhite + 1, abs(bSrc + bDst) % p->colorWhite + 1);
+					*dst = p->_wm->findBestColor(abs(rSrc + rDst) % 0xff + 1, abs(gSrc + gDst) % 0xff + 1, abs(bSrc + bDst) % 0xff + 1);
 				break;
 			case kInkTypeSubPin:
 					*dst = p->_wm->findBestColor(MAX(rSrc - rDst, 0), MAX(gSrc - gDst, 0), MAX(bSrc - bDst, 0));
@@ -962,7 +962,7 @@ void inkDrawPixel(int x, int y, int src, void *data) {
 					*dst = p->_wm->findBestColor(MAX(rSrc, rDst), MAX(gSrc, gDst), MAX(bSrc, bDst));
 				break;
 			case kInkTypeSub:
-					*dst = p->_wm->findBestColor(abs(rSrc - rDst) % p->colorWhite + 1, abs(gSrc - gDst) % p->colorWhite + 1, abs(bSrc - bDst) % p->colorWhite + 1);
+					*dst = p->_wm->findBestColor(abs(rSrc - rDst) % 0xff + 1, abs(gSrc - gDst) % 0xff + 1, abs(bSrc - bDst) % 0xff + 1);
 				break;
 			case kInkTypeDark:
 					*dst = p->_wm->findBestColor(MIN(rSrc, rDst), MIN(gSrc, gDst), MIN(bSrc, bDst));
diff --git a/engines/director/movie.cpp b/engines/director/movie.cpp
index 160281a223..8ea8bf4352 100644
--- a/engines/director/movie.cpp
+++ b/engines/director/movie.cpp
@@ -44,7 +44,7 @@ Movie::Movie(Window *window) {
 	_lingo = _vm->getLingo();
 
 	_flags = 0;
-	_stageColor = 0xFF;
+	_stageColor = _window->_wm->_colorWhite;
 
 	_currentClickOnSpriteId = 0;
 	_currentEditableTextChannel = 0;
diff --git a/engines/director/sprite.cpp b/engines/director/sprite.cpp
index e1749d3c80..83bd8f45c8 100644
--- a/engines/director/sprite.cpp
+++ b/engines/director/sprite.cpp
@@ -63,8 +63,8 @@ Sprite::Sprite(Frame *frame) {
 	_editable = false;
 	_puppet = false;
 	_immediate = false;
-	_backColor = 255;
-	_foreColor = 0;
+	_backColor = g_director->_wm->_colorWhite;
+	_foreColor = g_director->_wm->_colorBlack;
 
 	_blend = 0;
 
diff --git a/engines/director/sprite.h b/engines/director/sprite.h
index 0fe66ac342..36df4750d5 100644
--- a/engines/director/sprite.h
+++ b/engines/director/sprite.h
@@ -106,8 +106,8 @@ public:
 	bool _editable;
 	bool _puppet;
 	bool _immediate;
-	byte _backColor;
-	byte _foreColor;
+	uint32 _backColor;
+	uint32 _foreColor;
 
 	byte _blend;
 
diff --git a/engines/director/window.cpp b/engines/director/window.cpp
index f5d8319bf0..df82159071 100644
--- a/engines/director/window.cpp
+++ b/engines/director/window.cpp
@@ -45,7 +45,7 @@ Window::Window(int id, bool scrollable, bool resizable, bool editable, Graphics:
 	: MacWindow(id, scrollable, resizable, editable, wm), Object<Window>("Window") {
 	_vm = vm;
 	_isStage = isStage;
-	_stageColor = 0;
+	_stageColor = _wm->_colorBlack;
 	_puppetTransition = nullptr;
 
 	_currentMovie = nullptr;


Commit: 03055cb49daa44512ecc0123153a4f9f080af954
    https://github.com/scummvm/scummvm/commit/03055cb49daa44512ecc0123153a4f9f080af954
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-08-16T23:08:33+02:00

Commit Message:
DIRECTOR: Keep alpha when inverting a channel in 32bpp mode

Changed paths:
    engines/director/castmember.cpp
    engines/director/window.cpp


diff --git a/engines/director/castmember.cpp b/engines/director/castmember.cpp
index 6d32f3d423..fb13520433 100644
--- a/engines/director/castmember.cpp
+++ b/engines/director/castmember.cpp
@@ -207,7 +207,7 @@ void BitmapCastMember::createMatte() {
 			}
 		}
 	} else {
-		whiteColor = g_director->_wm->findBestColor(0xff, 0xff, 0xff);
+		whiteColor = g_director->_wm->_colorWhite;
 	}
 
 	if (whiteColor == -1) {
diff --git a/engines/director/window.cpp b/engines/director/window.cpp
index df82159071..1a6d82ff4e 100644
--- a/engines/director/window.cpp
+++ b/engines/director/window.cpp
@@ -74,21 +74,25 @@ void Window::invertChannel(Channel *channel) {
 	const Graphics::Surface *mask = channel->getMask(true);
 	Common::Rect destRect = channel->getBbox();
 
-	for (int i = 0; i < destRect.height(); i++) {
-		if (_wm->_pixelformat.bytesPerPixel == 1) {
+	if (_wm->_pixelformat.bytesPerPixel == 1) {
+		for (int i = 0; i < destRect.height(); i++) {
 			byte *src = (byte *)_composeSurface->getBasePtr(destRect.left, destRect.top + i);
 			const byte *msk = mask ? (const byte *)mask->getBasePtr(0, i) : nullptr;
 
 			for (int j = 0; j < destRect.width(); j++, src++)
 				if (!mask || (msk && !(*msk++)))
 					*src = ~(*src);
-		} else {
+		}
+	} else {
+		uint32 alpha = _wm->_pixelformat.ARGBToColor(255, 0, 0, 0);
+
+		for (int i = 0; i < destRect.height(); i++) {
 			uint32 *src = (uint32 *)_composeSurface->getBasePtr(destRect.left, destRect.top + i);
 			const uint32 *msk = mask ? (const uint32 *)mask->getBasePtr(0, i) : nullptr;
 
 			for (int j = 0; j < destRect.width(); j++, src++)
 				if (!mask || (msk && !(*msk++)))
-					*src = ~(*src);
+					*src = ~(*src & ~alpha) | alpha;
 		}
 	}
 }


Commit: 97fecbec16e7572ea1c7c5a127e4a0fbf91ae6d2
    https://github.com/scummvm/scummvm/commit/97fecbec16e7572ea1c7c5a127e4a0fbf91ae6d2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-08-16T23:08:33+02:00

Commit Message:
DIRECTOR: Simplify DigitalVideo rendering

Changed paths:
    engines/director/castmember.cpp


diff --git a/engines/director/castmember.cpp b/engines/director/castmember.cpp
index fb13520433..b762387573 100644
--- a/engines/director/castmember.cpp
+++ b/engines/director/castmember.cpp
@@ -321,19 +321,16 @@ Graphics::MacWidget *DigitalVideoCastMember::createWidget(Common::Rect &bbox, Ch
 	_channel->_movieTime = getMovieCurrentTime();
 
 	if (frame) {
-		if (frame->format.bytesPerPixel != 1) {
-			if (g_director->_pixelformat.bytesPerPixel == 1)
+		if (g_director->_pixelformat.bytesPerPixel == 1) {
+			if (frame->format.bytesPerPixel != 1) {
 				warning("STUB: video >8bpp");
-			else
-				widget->getSurface()->blitFrom(*frame);
-		} else {
-			if (g_director->_pixelformat.bytesPerPixel == 1) {
-				widget->getSurface()->blitFrom(*frame);
 			} else {
-				const Graphics::Surface *surf = frame->convertTo(g_director->_pixelformat, g_director->getPalette());
-				widget->getSurface()->blitFrom(*surf);
-				delete surf;
+				widget->getSurface()->blitFrom(*frame);
 			}
+		} else {
+			const Graphics::Surface *surf = frame->convertTo(g_director->_pixelformat, g_director->getPalette());
+			widget->getSurface()->blitFrom(*surf);
+			delete surf;
 		}
 	}
 


Commit: e8e137a46c988358e171d85cd53b239cf22a8760
    https://github.com/scummvm/scummvm/commit/e8e137a46c988358e171d85cd53b239cf22a8760
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-08-16T23:50:46+02:00

Commit Message:
GRAPHICS: Create FloodFill mask with the matching pixel format of the main surface

Changed paths:
    graphics/surface.cpp


diff --git a/graphics/surface.cpp b/graphics/surface.cpp
index d389f139ef..ebdf2256f8 100644
--- a/graphics/surface.cpp
+++ b/graphics/surface.cpp
@@ -543,7 +543,7 @@ FloodFill::FloodFill(Graphics::Surface *surface, uint32 oldColor, uint32 fillCol
 
 	if (_maskMode) {
 		_mask = new Graphics::Surface();
-		_mask->create(_w, _h, Graphics::PixelFormat::createFormatCLUT8()); // Uses calloc()
+		_mask->create(_w, _h, surface->format); // Uses calloc()
 	}
 
 	_visited = (byte *)calloc(_w * _h, 1);
@@ -588,7 +588,7 @@ void FloodFill::addSeed(int x, int y) {
 					if (!_maskMode)
 						WRITE_UINT16(src, _fillColor);
 					else
-						*((byte *)dst) = 255;
+						*((uint16 *)dst) = 0xffff;
 
 					changed = true;
 				}
@@ -597,7 +597,7 @@ void FloodFill::addSeed(int x, int y) {
 					if (!_maskMode)
 						WRITE_UINT32(src, _fillColor);
 					else
-						*((byte *)dst) = 255;
+						*((uint32 *)dst) = 0xffffffff;
 
 					changed = true;
 				}
@@ -632,7 +632,7 @@ void FloodFill::fillMask() {
 
 	if (!_mask) {
 		_mask = new Graphics::Surface();
-		_mask->create(_w, _h, Graphics::PixelFormat::createFormatCLUT8()); // Uses calloc()
+		_mask->create(_w, _h, _surface->format); // Uses calloc()
 	}
 
 	fill();


Commit: 7563759f4bb6db083f996d568ccf9635c44b4b79
    https://github.com/scummvm/scummvm/commit/7563759f4bb6db083f996d568ccf9635c44b4b79
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-08-16T23:51:56+02:00

Commit Message:
DIRECTOR: Fix Matte Ink for 32bpp mode

Changed paths:
    engines/director/castmember.cpp


diff --git a/engines/director/castmember.cpp b/engines/director/castmember.cpp
index b762387573..1751a55c26 100644
--- a/engines/director/castmember.cpp
+++ b/engines/director/castmember.cpp
@@ -190,8 +190,11 @@ void BitmapCastMember::createMatte() {
 	tmp.create(_initialRect.width(), _initialRect.height(), g_director->_pixelformat);
 	tmp.copyFrom(*_img->getSurface());
 
+	_noMatte = true;
+
 	// Searching white color in the corners
-	int whiteColor = -1;
+	uint32 whiteColor = 0;
+	bool colorFound = false;
 
 	if (g_director->_pixelformat.bytesPerPixel == 1) {
 		for (int y = 0; y < tmp.h; y++) {
@@ -202,17 +205,18 @@ void BitmapCastMember::createMatte() {
 						g_director->getPalette()[color * 3 + 1] == 0xff &&
 						g_director->getPalette()[color * 3 + 2] == 0xff) {
 					whiteColor = color;
+					colorFound = true;
 					break;
 				}
 			}
 		}
 	} else {
 		whiteColor = g_director->_wm->_colorWhite;
+		colorFound = true;
 	}
 
-	if (whiteColor == -1) {
+	if (!colorFound) {
 		debugC(1, kDebugImages, "BitmapCastMember::createMatte(): No white color for matte image");
-		_noMatte = true;
 	} else {
 		delete _matte;
 




More information about the Scummvm-git-logs mailing list