[Scummvm-git-logs] scummvm master -> c2daf29bb2613880f13244519c1364c94cc980b3

sev- noreply at scummvm.org
Mon Mar 21 10:44:36 UTC 2022


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:
c2daf29bb2 DIRECTOR: implement RearWindow methods


Commit: c2daf29bb2613880f13244519c1364c94cc980b3
    https://github.com/scummvm/scummvm/commit/c2daf29bb2613880f13244519c1364c94cc980b3
Author: Misty De Meo (mistydemeo at gmail.com)
Date: 2022-03-21T11:44:32+01:00

Commit Message:
DIRECTOR: implement RearWindow methods

Changed paths:
    engines/director/lingo/xlibs/winxobj.cpp
    engines/director/lingo/xlibs/winxobj.h
    graphics/macgui/macwindowmanager.cpp
    graphics/macgui/macwindowmanager.h


diff --git a/engines/director/lingo/xlibs/winxobj.cpp b/engines/director/lingo/xlibs/winxobj.cpp
index 60ca973f92f..71bf2166ee3 100644
--- a/engines/director/lingo/xlibs/winxobj.cpp
+++ b/engines/director/lingo/xlibs/winxobj.cpp
@@ -50,6 +50,7 @@ static MethodProto xlibMethods[] = {
 	{ "GetMemoryNeeded",	RearWindowXObj::m_getMemoryNeeded,		0,	0,	400 },	// D4
 	{ "PatToWindow",		RearWindowXObj::m_patToWindow,			1,	1,	400 },	// D4
 	{ "IndexColorToWindow",	RearWindowXObj::m_indexColorToWindow,	1,	1,	400 },	// D4
+	{ "RGBColorToWindow",   RearWindowXObj::m_rgbColorToWindow,     3,  3,  400 },  // D4
 	{ nullptr, nullptr, 0, 0, 0 }
 };
 
@@ -91,4 +92,13 @@ void RearWindowXObj::m_indexColorToWindow(int nargs) {
 	g_lingo->pop();
 }
 
+void RearWindowXObj::m_rgbColorToWindow(int nargs) {
+	Datum r = g_lingo->pop();
+	Datum g = g_lingo->pop();
+	Datum b = g_lingo->pop();
+	Graphics::MacWindowManager *window = g_director->getMacWindowManager();
+
+	window->setDesktopColor(r.asInt(), g.asInt(), b.asInt());
+}
+
 } // End of namespace Director
diff --git a/engines/director/lingo/xlibs/winxobj.h b/engines/director/lingo/xlibs/winxobj.h
index 5d3a5c947d7..08f2103b14b 100644
--- a/engines/director/lingo/xlibs/winxobj.h
+++ b/engines/director/lingo/xlibs/winxobj.h
@@ -42,6 +42,7 @@ void m_new(int nargs);
 void m_getMemoryNeeded(int nargs);
 void m_patToWindow(int nargs);
 void m_indexColorToWindow(int nargs);
+void m_rgbColorToWindow(int nargs);
 
 } // End of namespace RearWindowXObj
 
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index e85268139f6..b60192631f0 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -823,6 +823,21 @@ void MacWindowManager::loadDesktop() {
 	delete source;
 }
 
+void MacWindowManager::setDesktopColor(byte r, byte g, byte b) {
+	_desktopBmp = new Graphics::TransparentSurface();
+	uint32 color = TS_RGB(r, g, b);
+
+	const Graphics::PixelFormat requiredFormat_4byte(4, 8, 8, 8, 8, 0, 8, 16, 24);
+	Graphics::ManagedSurface *source = new Graphics::ManagedSurface();
+	source->create(10, 10, requiredFormat_4byte);
+	Common::Rect area = source->getBounds();
+	source->fillRect(area, color);
+
+	_desktopBmp->copyFrom(*source);
+	source->free();
+	delete source;
+}
+
 void MacWindowManager::drawDesktop() {
 	if (_desktopBmp) {
 		for (int i = 0; i < _desktop->w; ++i) {
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index d9d39e8feb0..2b96967f6c6 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -317,6 +317,7 @@ public:
 	uint findBestColor(byte cr, byte cg, byte cb);
 	uint findBestColor(uint32 color);
 	void decomposeColor(uint32 color, byte &r, byte &g, byte &b);
+	void setDesktopColor(byte, byte, byte);
 
 	uint inverter(uint src);
 




More information about the Scummvm-git-logs mailing list