diff options
author | Eugene Sandulenko | 2019-12-16 12:19:36 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2019-12-16 12:19:36 +0100 |
commit | 4c3cea846bf9997ff146d92f64f5d1f1ed57cb69 (patch) | |
tree | 0af94552df89f11dba037d5f9fd75c4ec449240f /graphics/macgui | |
parent | 8c0590be77979645429e254fb4a763d0932c8722 (diff) | |
download | scummvm-rg350-4c3cea846bf9997ff146d92f64f5d1f1ed57cb69.tar.gz scummvm-rg350-4c3cea846bf9997ff146d92f64f5d1f1ed57cb69.tar.bz2 scummvm-rg350-4c3cea846bf9997ff146d92f64f5d1f1ed57cb69.zip |
GRAPHICS: MACGUI: Restore background for modal MacMenus
Diffstat (limited to 'graphics/macgui')
-rw-r--r-- | graphics/macgui/macmenu.cpp | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp index 4594b6a156..e7ed416893 100644 --- a/graphics/macgui/macmenu.cpp +++ b/graphics/macgui/macmenu.cpp @@ -789,13 +789,18 @@ bool MacMenu::draw(ManagedSurface *g, bool forceRedraw) { } } + if (_wm->_mode & kWMModalMenuMode) + g_system->copyRectToScreen(_screen.getBasePtr(_bbox.left, _bbox.top), _screen.pitch, _bbox.left, _bbox.top, _bbox.width(), _bbox.height()); + + for (uint i = 0; i < _menustack.size(); i++) { renderSubmenu(_menustack[i], (i == _menustack.size() - 1)); } g->transBlitFrom(_screen, kColorGreen); - g_system->copyRectToScreen(g->getPixels(), g->pitch, 0, 0, g->w, g->h); + if (!(_wm->_mode & kWMModalMenuMode)) + g_system->copyRectToScreen(g->getPixels(), g->pitch, 0, 0, g->w, g->h); return true; } @@ -890,7 +895,9 @@ void MacMenu::renderSubmenu(MacMenuSubMenu *menu, bool recursive) { renderSubmenu(menu->items[menu->highlight]->submenu, false); _contentIsDirty = true; - //g_system->copyRectToScreen(_screen.getBasePtr(r->left, r->top), _screen.pitch, r->left, r->top, r->width() + 2, r->height() + 2); + + if (_wm->_mode & kWMModalMenuMode) + g_system->copyRectToScreen(_screen.getBasePtr(r->left, r->top), _screen.pitch, r->left, r->top, r->width() + 2, r->height() + 2); } void MacMenu::drawSubMenuArrow(ManagedSurface *dst, int x, int y, int color) { @@ -943,6 +950,14 @@ bool MacMenu::mouseClick(int x, int y) { if (_items[_activeItem]->submenu != nullptr) { _wm->setFullRefresh(true); + if (_wm->_mode & kWMModalMenuMode) { + int x1 = _items[_activeItem]->submenu->bbox.left; + int y1 = _items[_activeItem]->submenu->bbox.top; + uint w = _items[_activeItem]->submenu->bbox.width() + 2; + uint h = _items[_activeItem]->submenu->bbox.height() + 2; + g_system->copyRectToScreen(_wm->_screenCopy->getBasePtr(x1, y1), _wm->_screenCopy->pitch, x1, y1, w, h); + } + _menustack.pop_back(); // Drop previous submenu } } @@ -977,6 +992,15 @@ bool MacMenu::mouseClick(int x, int y) { int numSubItem = menu->ytoItem(y); if (numSubItem != _activeSubItem) { + if (_wm->_mode & kWMModalMenuMode) { + if (_activeSubItem != -1 && menu->items[_activeSubItem]->submenu != nullptr) { + int x1 = menu->items[_activeSubItem]->submenu->bbox.left; + int y1 = menu->items[_activeSubItem]->submenu->bbox.top; + uint w = menu->items[_activeSubItem]->submenu->bbox.width() + 2; + uint h = menu->items[_activeSubItem]->submenu->bbox.height() + 2; + g_system->copyRectToScreen(_wm->_screenCopy->getBasePtr(x1, y1), _wm->_screenCopy->pitch, x1, y1, w, h); + } + } _activeSubItem = numSubItem; menu->highlight = _activeSubItem; @@ -1005,6 +1029,14 @@ bool MacMenu::mouseClick(int x, int y) { if (_menustack[_menustack.size() - 2]->bbox.contains(x, y)) { _menustack.back()->highlight = -1; // Erase it for the closed popup + if (_wm->_mode & kWMModalMenuMode) { + int x1 = _menustack.back()->bbox.left; + int y1 = _menustack.back()->bbox.top; + uint w = _menustack.back()->bbox.width() + 2; + uint h = _menustack.back()->bbox.height() + 2; + g_system->copyRectToScreen(_wm->_screenCopy->getBasePtr(x1, y1), _wm->_screenCopy->pitch, x1, y1, w, h); + } + _menustack.pop_back(); MacMenuSubMenu *menu = _menustack.back(); |