[Scummvm-git-logs] scummvm master -> 8b7f9d4ab2a5d3bd629b69c131276c0fd5b93e8a

npjg nathanael.gentrydb8 at gmail.com
Wed Aug 12 20:35:18 UTC 2020


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:
3a69512fe1 GRAPHICS: MACGUI: Fix menu direct rendering
8b7f9d4ab2 GRAPHICS: MACGUI: Handle direct draw window offsets


Commit: 3a69512fe1344ec468f1ed4279476b4c1666a4c7
    https://github.com/scummvm/scummvm/commit/3a69512fe1344ec468f1ed4279476b4c1666a4c7
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-08-12T16:34:24-04:00

Commit Message:
GRAPHICS: MACGUI: Fix menu direct rendering

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


diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index 72dd490d3a..1653734674 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -824,7 +824,7 @@ bool MacMenu::draw(ManagedSurface *g, bool forceRedraw) {
 		}
 	}
 
-	if (_wm->_mode & kWMModalMenuMode)
+	if ((_wm->_mode & kWMModalMenuMode) | !_wm->_screen)
 		g_system->copyRectToScreen(_screen.getBasePtr(_bbox.left, _bbox.top), _screen.pitch, _bbox.left, _bbox.top, _bbox.width(), _bbox.height());
 
 
@@ -832,9 +832,10 @@ bool MacMenu::draw(ManagedSurface *g, bool forceRedraw) {
 		renderSubmenu(_menustack[i], (i == _menustack.size() - 1));
 	}
 
-	g->transBlitFrom(_screen, _wm->_colorGreen);
+	if (g)
+		g->transBlitFrom(_screen, _wm->_colorGreen);
 
-	if (!(_wm->_mode & kWMModalMenuMode))
+	if (!(_wm->_mode & kWMModalMenuMode) && g)
 		g_system->copyRectToScreen(g->getPixels(), g->pitch, 0, 0, g->w, g->h);
 
 	return true;
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 2524c646ce..070ea8d430 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -550,11 +550,7 @@ void MacWindowManager::draw() {
 
 	// Menu is drawn on top of everything and always
 	if (_menu && !(_mode & kWMModeFullscreen)) {
-		if (_screen) {
-			_menu->draw(_screen, _fullRefresh);
-		} else {
-			g_system->copyRectToScreen(_menu->getWindowSurface()->getBasePtr(_menu->_dims.left, _menu->_dims.top), _menu->getWindowSurface()->pitch, _menu->_dims.left, _menu->_dims.top, _menu->_dims.width(), _menu->_dims.height());
-		}
+		_menu->draw(_screen, _fullRefresh);
 	}
 
 	_fullRefresh = false;


Commit: 8b7f9d4ab2a5d3bd629b69c131276c0fd5b93e8a
    https://github.com/scummvm/scummvm/commit/8b7f9d4ab2a5d3bd629b69c131276c0fd5b93e8a
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-08-12T16:34:24-04:00

Commit Message:
GRAPHICS: MACGUI: Handle direct draw window offsets

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


diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 070ea8d430..6978985a3f 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -479,6 +479,8 @@ void MacWindowManager::drawDesktop() {
 void MacWindowManager::draw() {
 	removeMarked();
 
+	Common::Rect bounds = getScreenBounds();
+
 	if (_fullRefresh) {
 		Common::Rect screen = getScreenBounds();
 		if (_desktop->w != screen.width() || _desktop->h != screen.height()) {
@@ -505,9 +507,14 @@ void MacWindowManager::draw() {
 		if (!w->isVisible())
 			continue;
 
-		Common::Rect clip = w->getDimensions();
-		clip.clip(getScreenBounds());
-		clip.clip(Common::Rect(0, 0, g_system->getWidth() - 1, g_system->getHeight() - 1));
+		Common::Rect clip = w->getInnerDimensions();
+		clip.clip(bounds);
+
+		if (clip.isEmpty())
+			continue;
+
+		clip = w->getDimensions();
+		clip.clip(bounds);
 
 		if (clip.isEmpty())
 			continue;
@@ -526,12 +533,15 @@ void MacWindowManager::draw() {
 			if (w->isDirty() || forceRedraw) {
 				w->draw(forceRedraw);
 
-				Common::Rect dims = w->getDimensions();
+				Common::Rect outerDims = w->getDimensions();
 				Common::Rect innerDims = w->getInnerDimensions();
+				int adjWidth, adjHeight;
 
-				g_system->copyRectToScreen(w->getBorderSurface()->getBasePtr(0, 0), w->getBorderSurface()->pitch, clip.left, clip.top, dims.width(), dims.height());
+				adjustDimensions(clip, outerDims, adjWidth, adjHeight);
+				g_system->copyRectToScreen(w->getBorderSurface()->getBasePtr(MAX(clip.left - outerDims.left, 0), MAX(clip.top - outerDims.top, 0)), w->getBorderSurface()->pitch, clip.left, clip.top, adjWidth, adjHeight);
 
-				g_system->copyRectToScreen(w->getWindowSurface()->getBasePtr(MAX(clip.left - innerDims.left, 0), MAX(clip.top - innerDims.top, 0)), w->getWindowSurface()->pitch, clip.left + (-dims.left + innerDims.left), clip.top + (-dims.top + innerDims.top), innerDims.width(), innerDims.height());
+				adjustDimensions(clip, innerDims, adjWidth, adjHeight);
+				g_system->copyRectToScreen(w->getWindowSurface()->getBasePtr(MAX(clip.left - innerDims.left, 0), MAX(clip.top - innerDims.top, 0)), w->getWindowSurface()->pitch,MAX(innerDims.left, (int16)0), MAX(innerDims.top, (int16)0), adjWidth, adjHeight);
 
 				dirtyRects.push_back(clip);
 			}
@@ -630,6 +640,26 @@ bool MacWindowManager::processEvent(Common::Event &event) {
 	return false;
 }
 
+void MacWindowManager::adjustDimensions(const Common::Rect &clip, const Common::Rect &dims, int &adjWidth, int &adjHeight) {
+	int wOffset, hOffset;
+
+	wOffset = clip.left - dims.left;
+	adjWidth = dims.width();
+	if (wOffset > 0) {
+		adjWidth -= wOffset;
+	} else if (dims.right > getScreenBounds().right) {
+		adjWidth -= (dims.right - getScreenBounds().right);
+	}
+
+	hOffset = clip.top - dims.top;
+	adjHeight = dims.height();
+	if (hOffset > 0) {
+		adjHeight -= hOffset;
+	} else if (dims.bottom > getScreenBounds().bottom) {
+		adjHeight -= (dims.bottom - getScreenBounds().bottom);
+	}
+}
+
 void MacWindowManager::removeMarked() {
 	if (!_needsRemoval) return;
 
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index 3da91e72e7..e38c5943b9 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -329,6 +329,8 @@ private:
 	void zoomBoxInner(Common::Rect &r, Graphics::MacPlotData &pd);
 	bool haveZoomBox() { return !_zoomBoxes.empty(); }
 
+	void adjustDimensions(const Common::Rect &clip, const Common::Rect &dims, int &adjWidth, int &adjHeight);
+
 public:
 	TransparentSurface *_desktopBmp;
 	ManagedSurface *_desktop;




More information about the Scummvm-git-logs mailing list