aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2017-07-07 20:55:12 -0400
committerPaul Gilbert2017-07-07 20:55:12 -0400
commit562da310b8a2d3331ea206c51e25ea7383925646 (patch)
treec339bc1ca03cab98174c2145ca2676bf24274668
parent8d7f0168abb4daa3bace49f3e08a0eaffe1a8e96 (diff)
downloadscummvm-rg350-562da310b8a2d3331ea206c51e25ea7383925646.tar.gz
scummvm-rg350-562da310b8a2d3331ea206c51e25ea7383925646.tar.bz2
scummvm-rg350-562da310b8a2d3331ea206c51e25ea7383925646.zip
TITANIC: Fix to only update modified parts of the screen
-rw-r--r--engines/titanic/game_manager.cpp15
-rw-r--r--engines/titanic/support/rect.cpp9
2 files changed, 13 insertions, 11 deletions
diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp
index 047ecf7f6e..b276405dd4 100644
--- a/engines/titanic/game_manager.cpp
+++ b/engines/titanic/game_manager.cpp
@@ -173,30 +173,31 @@ void CGameManager::update() {
CViewItem *view = getView();
if (view) {
- // Expand the game manager's bounds to encompass all the view's items
+ // Expand the game manager's bounds to encompass any modified
+ // areas of any of the view's items
for (CTreeItem *item = view; item; item = item->scan(view)) {
Rect r = item->getBounds();
if (!r.isEmpty())
- _bounds.extend(r);
+ _bounds.combine(r);
}
- // Also include the PET control in the bounds
+ // Also include any modified area of the PET control
if (_project) {
CPetControl *pet = _project->getPetControl();
if (pet)
- _bounds.extend(pet->getBounds());
+ _bounds.combine(pet->getBounds());
}
// And the text cursor
CScreenManager *screenManager = CScreenManager::_screenManagerPtr;
CTextCursor *textCursor = screenManager->_textCursor;
if (textCursor && textCursor->_active)
- _bounds.extend(textCursor->getCursorBounds());
+ _bounds.combine(textCursor->getCursorBounds());
- // Set the surface bounds
+ // Set the screen's modified area bounds
screenManager->setSurfaceBounds(SURFACE_BACKBUFFER, _bounds);
- // Handle redrawing the view
+ // Handle redrawing the view if there is any changed area
if (!_bounds.isEmpty()) {
_gameView->draw(_bounds);
_bounds = Rect();
diff --git a/engines/titanic/support/rect.cpp b/engines/titanic/support/rect.cpp
index 5fce4402cb..b39ffc1c45 100644
--- a/engines/titanic/support/rect.cpp
+++ b/engines/titanic/support/rect.cpp
@@ -25,10 +25,11 @@
namespace Titanic {
void Rect::combine(const Rect &r) {
- if (isEmpty() || r.isEmpty())
- return;
-
- Common::Rect::extend(r);
+ if (isEmpty()) {
+ *this = r;
+ } else if (!r.isEmpty()) {
+ Common::Rect::extend(r);
+ }
}
void Rect::constrain(const Rect &r) {