[Scummvm-git-logs] scummvm master -> 090bb44d929b24985120e1834886ad386ee41d26

sev- sev at scummvm.org
Fri Oct 4 22:33:36 CEST 2019


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

Summary:
c17800cfc4 GRAPHICS: MACGUI: Add possibility to setup engine redraw callback
090bb44d92 PINK: Properly redraw game screen when browsing menus


Commit: c17800cfc4f09cebcfb90aea07f94c8f107b3e9d
    https://github.com/scummvm/scummvm/commit/c17800cfc4f09cebcfb90aea07f94c8f107b3e9d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-10-04T22:32:24+02:00

Commit Message:
GRAPHICS: MACGUI: Add possibility to setup engine redraw callback

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


diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index 946161f..d4543e3 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -854,6 +854,7 @@ bool MacMenu::mouseClick(int x, int y) {
 				_menuActivated = true;
 
 				_contentIsDirty = true;
+				_wm->setFullRefresh(true);
 
 				return true;
 			}
@@ -871,6 +872,7 @@ bool MacMenu::mouseClick(int x, int y) {
 			menu->highlight = _activeSubItem;
 
 			_contentIsDirty = true;
+			_wm->setFullRefresh(true);
 		}
 
 		return true;
@@ -882,6 +884,7 @@ bool MacMenu::mouseClick(int x, int y) {
 
 			_activeSubItem = 0;
 			_contentIsDirty = true;
+			_wm->setFullRefresh(true);
 
 			_menustack.back()->highlight = 0;
 
@@ -900,6 +903,7 @@ bool MacMenu::mouseClick(int x, int y) {
 			_activeSubItem = menu->highlight = menu->ytoItem(y);
 
 			_contentIsDirty = true;
+			_wm->setFullRefresh(true);
 
 			return true;
 		}
@@ -910,6 +914,7 @@ bool MacMenu::mouseClick(int x, int y) {
 
 		if (_menustack.size()) {
 			_contentIsDirty = true;
+			_wm->setFullRefresh(true);
 		}
 
 		return true;
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 65a5da5..1e8a4ba 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -160,8 +160,10 @@ MacWindowManager::MacWindowManager() {
 	_menuDelay = 0;
 	_menuTimerActive = false;
 
-	_engine = nullptr;
+	_engineP = nullptr;
+	_engineR = nullptr;
 	_pauseEngineCallback = nullptr;
+	_redrawEngineCallback = nullptr;
 
 	_colorBlack = 0;
 	_colorWhite = 2;
@@ -319,8 +321,13 @@ void MacWindowManager::draw() {
 
 	removeMarked();
 
-	if (_fullRefresh && !(_mode & kWMModeNoDesktop))
-		drawDesktop();
+	if (_fullRefresh) {
+		if (!(_mode & kWMModeNoDesktop))
+			drawDesktop();
+
+		if (_redrawEngineCallback != nullptr)
+			_redrawEngineCallback(_engineR);
+	}
 
 	for (Common::List<BaseMacWindow *>::const_iterator it = _windowStack.begin(); it != _windowStack.end(); it++) {
 		BaseMacWindow *w = *it;
@@ -525,14 +532,19 @@ void MacWindowManager::passPalette(const byte *pal, uint size) {
 }
 
 void MacWindowManager::pauseEngine(bool pause) {
-	if (_engine && _pauseEngineCallback) {
-		_pauseEngineCallback(_engine, pause);
+	if (_engineP && _pauseEngineCallback) {
+		_pauseEngineCallback(_engineP, pause);
 	}
 }
 
 void MacWindowManager::setEnginePauseCallback(void *engine, void (*pauseCallback)(void *, bool)) {
-	_engine = engine;
+	_engineP = engine;
 	_pauseEngineCallback = pauseCallback;
 }
 
+void MacWindowManager::setEngineRedrawCallback(void *engine, void (*redrawCallback)(void *)) {
+	_engineR = engine;
+	_redrawEngineCallback = redrawCallback;
+}
+
 } // End of namespace Graphics
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index 967a5cd..f288a09 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -215,6 +215,7 @@ public:
 	void setMode(uint32 mode);
 
 	void setEnginePauseCallback(void *engine, void (*pauseCallback)(void *engine, bool pause));
+	void setEngineRedrawCallback(void *engine, void (*redrawCallback)(void *engine));
 
 	void passPalette(const byte *palette, uint size);
 
@@ -257,8 +258,10 @@ private:
 	MacMenu *_menu;
 	uint32 _menuDelay;
 
-	void *_engine;
+	void *_engineP;
+	void *_engineR;
 	void (*_pauseEngineCallback)(void *engine, bool pause);
+	void (*_redrawEngineCallback)(void *engine);
 
 	bool _cursorIsArrow;
 };


Commit: 090bb44d929b24985120e1834886ad386ee41d26
    https://github.com/scummvm/scummvm/commit/090bb44d929b24985120e1834886ad386ee41d26
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-10-04T22:33:01+02:00

Commit Message:
PINK: Properly redraw game screen when browsing menus

Changed paths:
    engines/pink/director.cpp
    engines/pink/director.h


diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index bb59ff9..1baf239 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -79,6 +79,15 @@ static const Graphics::MacMenuData menuSubItems[] = {
 };
 */
 
+static void redrawCallback(void *ref) {
+	Director *dir = (Director *)ref;
+
+	if (dir->getWndManager().isMenuActive()) {
+		dir->addDirtyRect(Common::Rect(0, 0, 640, 480));
+		dir->draw(false);
+	}
+}
+
 Director::Director()
 	: _surface(640, 480), _textRendered(false) {
 	_wm.setScreen(&_surface);
@@ -86,6 +95,7 @@ Director::Director()
 				Graphics::kWMModeForceBuiltinFonts);
 	_wm.setMenuHotzone(Common::Rect(0, 0, 640, 23));
 	_wm.setMenuDelay(250000);
+	_wm.setEngineRedrawCallback(this, redrawCallback);
 }
 
 void Director::update() {
@@ -203,7 +213,7 @@ Actor *Director::getActorByPoint(const Common::Point point) {
 	return nullptr;
 }
 
-void Director::draw() {
+void Director::draw(bool blit) {
 	if (!_dirtyRects.empty() || !_textRendered) {
 		mergeDirtyRects();
 
@@ -219,7 +229,9 @@ void Director::draw() {
 		}
 
 		_dirtyRects.resize(0);
-		_surface.update();
+
+		if (blit)
+			_surface.update();
 	} else
 		g_system->updateScreen();
 }
diff --git a/engines/pink/director.h b/engines/pink/director.h
index 7273b65..af8dbfc3 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -77,8 +77,9 @@ public:
 
 	Graphics::MacWindowManager &getWndManager() { return _wm; };
 
+	void draw(bool blit = true);
+
 private:
-	void draw();
 	void mergeDirtyRects();
 	void drawRect(const Common::Rect &rect);
 





More information about the Scummvm-git-logs mailing list