diff options
author | Paul Gilbert | 2015-01-28 20:59:01 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-01-28 20:59:01 -0500 |
commit | 1f28332b2053f2dbbe138937f9b0e342774a4cc9 (patch) | |
tree | 7828194129d517d0e7a103beb41538a3b9b2e31c /engines | |
parent | 16b8382d6e72c72d567b44bca8cf0d48a4280366 (diff) | |
download | scummvm-rg350-1f28332b2053f2dbbe138937f9b0e342774a4cc9.tar.gz scummvm-rg350-1f28332b2053f2dbbe138937f9b0e342774a4cc9.tar.bz2 scummvm-rg350-1f28332b2053f2dbbe138937f9b0e342774a4cc9.zip |
XEEN: Add saving/restoring of background when opening/closing windows
Diffstat (limited to 'engines')
-rw-r--r-- | engines/xeen/screen.cpp | 18 | ||||
-rw-r--r-- | engines/xeen/screen.h | 1 |
2 files changed, 16 insertions, 3 deletions
diff --git a/engines/xeen/screen.cpp b/engines/xeen/screen.cpp index e979143ed5..9c9783ba4c 100644 --- a/engines/xeen/screen.cpp +++ b/engines/xeen/screen.cpp @@ -60,11 +60,17 @@ void Window::open() { } void Window::open2() { + Screen &screen = *_vm->_screen; + + // Save a copy of the area under the window + _savedArea.create(_bounds.width(), _bounds.height()); + _savedArea.copyRectToSurface(screen, 0, 0, _bounds); + + // Mark the area as dirty and fill it with a default background addDirtyRect(_bounds); frame(); fill(); - Screen &screen = *_vm->_screen; screen._writePos.x = _bounds.right - 8; screen.writeSymbol(19); @@ -130,11 +136,17 @@ void Window::frame() { } void Window::close() { + Screen &screen = *_vm->_screen; + if (_enabled) { - // Update any remaining pending changes to the screen and free - // the window's internal surface storage + // Update the window update(); + // Restore the saved original content + screen.copyRectToSurface(_savedArea, _bounds.left, _bounds.top, + Common::Rect(0, 0, _bounds.width(), _bounds.height())); + addDirtyRect(_bounds); + // Remove the window from the stack and flag it as now disabled for (uint i = 0; i < _vm->_screen->_windowStack.size(); ++i) { if (_vm->_screen->_windowStack[i] == this) diff --git a/engines/xeen/screen.h b/engines/xeen/screen.h index 85affe3aa2..e3ced06236 100644 --- a/engines/xeen/screen.h +++ b/engines/xeen/screen.h @@ -61,6 +61,7 @@ private: XeenEngine *_vm; Common::Rect _bounds; Common::Rect _innerBounds; + XSurface _savedArea; int _a; int _border; int _xLo, _xHi; |