[Scummvm-git-logs] scummvm master -> 562da310b8a2d3331ea206c51e25ea7383925646

dreammaster dreammaster at scummvm.org
Sat Jul 8 02:55:20 CEST 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
562da310b8 TITANIC: Fix to only update modified parts of the screen


Commit: 562da310b8a2d3331ea206c51e25ea7383925646
    https://github.com/scummvm/scummvm/commit/562da310b8a2d3331ea206c51e25ea7383925646
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-07-07T20:55:12-04:00

Commit Message:
TITANIC: Fix to only update modified parts of the screen

Changed paths:
    engines/titanic/game_manager.cpp
    engines/titanic/support/rect.cpp


diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp
index 047ecf7..b276405 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 5fce440..b39ffc1 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) {





More information about the Scummvm-git-logs mailing list