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

djsrv dservilla at gmail.com
Thu Jul 9 20:32:33 UTC 2020


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:
a7319b0df5 GRAPHICS: MACGUI: Fix window layering


Commit: a7319b0df58c15623808c9de42e6c51f560b8a4c
    https://github.com/scummvm/scummvm/commit/a7319b0df58c15623808c9de42e6c51f560b8a4c
Author: djsrv (dservilla at gmail.com)
Date: 2020-07-09T16:29:42-04:00

Commit Message:
GRAPHICS: MACGUI: Fix window layering

If a window is redrawn, any windows on top of it need to be redrawn.

Changed paths:
    graphics/macgui/macwindowmanager.cpp


diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index b4f4d15062..abf544f944 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -410,20 +410,33 @@ void MacWindowManager::draw() {
 			_redrawEngineCallback(_engineR);
 	}
 
+	Common::Array<Common::Rect> dirtyRects;
 	for (Common::List<BaseMacWindow *>::const_iterator it = _windowStack.begin(); it != _windowStack.end(); it++) {
 		BaseMacWindow *w = *it;
 		if (!w->isVisible())
 			continue;
 
-		if (w->draw(_screen, _fullRefresh)) {
-			w->setDirty(false);
+		Common::Rect clip = w->getDimensions();
+		clip.clip(_screen->getBounds());
+		clip.clip(Common::Rect(0, 0, g_system->getWidth() - 1, g_system->getHeight() - 1));
 
-			Common::Rect clip(w->getDimensions().left - 2, w->getDimensions().top - 2, w->getDimensions().right - 2, w->getDimensions().bottom - 2);
-			clip.clip(_screen->getBounds());
-			clip.clip(Common::Rect(0, 0, g_system->getWidth() - 1, g_system->getHeight() - 1));
+		if (clip.isEmpty())
+			continue;
 
-			if (!clip.isEmpty())
-				g_system->copyRectToScreen(_screen->getBasePtr(clip.left, clip.top), _screen->pitch, clip.left, clip.top, clip.width(), clip.height());
+		bool forceRedraw = _fullRefresh;
+		if (!forceRedraw) {
+			for (Common::Array<Common::Rect>::iterator dirty = dirtyRects.begin(); dirty != dirtyRects.end(); dirty++) {
+				if (clip.intersects(*dirty)) {
+					forceRedraw = true;
+					break;
+				}
+			}
+		}
+
+		if (w->draw(_screen, forceRedraw)) {
+			w->setDirty(false);
+			g_system->copyRectToScreen(_screen->getBasePtr(clip.left, clip.top), _screen->pitch, clip.left, clip.top, clip.width(), clip.height());
+			dirtyRects.push_back(clip);
 		}
 	}
 




More information about the Scummvm-git-logs mailing list