aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/screen.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-01-28 20:59:01 -0500
committerPaul Gilbert2015-01-28 20:59:01 -0500
commit1f28332b2053f2dbbe138937f9b0e342774a4cc9 (patch)
tree7828194129d517d0e7a103beb41538a3b9b2e31c /engines/xeen/screen.cpp
parent16b8382d6e72c72d567b44bca8cf0d48a4280366 (diff)
downloadscummvm-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/xeen/screen.cpp')
-rw-r--r--engines/xeen/screen.cpp18
1 files changed, 15 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)