[Scummvm-cvs-logs] SF.net SVN: scummvm: [23669] scummvm/trunk/gui/newgui.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Aug 4 20:11:08 CEST 2006


Revision: 23669
Author:   fingolfin
Date:     2006-08-04 11:11:00 -0700 (Fri, 04 Aug 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=23669&view=rev

Log Message:
-----------
Only refresh the theme & reflow all dialogs if the screen settings actually changed

Modified Paths:
--------------
    scummvm/trunk/gui/newgui.cpp
Modified: scummvm/trunk/gui/newgui.cpp
===================================================================
--- scummvm/trunk/gui/newgui.cpp	2006-08-04 18:01:43 UTC (rev 23668)
+++ scummvm/trunk/gui/newgui.cpp	2006-08-04 18:11:00 UTC (rev 23669)
@@ -87,6 +87,7 @@
 	_stateIsSaved(false), _cursorAnimateCounter(0), _cursorAnimateTimer(0) {
 
 	_system = g_system;
+	_lastScreenChangeID = _system->getScreenChangeID();
 
 	// Clear the cursor
 	memset(_cursor, 0xFF, sizeof(_cursor));
@@ -257,6 +258,8 @@
 				_system->quit();
 				return;
 			case OSystem::EVENT_SCREEN_CHANGED:
+				_lastScreenChangeID = _system->getScreenChangeID();
+
 				// reinit the whole theme
 				_theme->refresh();
 				// refresh all dialogs
@@ -318,18 +321,22 @@
 	_dialogStack.push(dialog);
 	_needRedraw = true;
 
-	// TODO: No need to always reflow everything. Rather, we should
-	// check for the value of OSystem::getScreenChangeID() and
-	// only do a full update when that changed...
-	if (true) {
+	// We reflow the dialog just before opening it. If the screen changed
+	// since the last time we looked, also refresh the loaded theme,
+	// and reflow all other open dialogs, too.
+	int tmpScreenChangeID = _system->getScreenChangeID();
+	if (_lastScreenChangeID != tmpScreenChangeID) {
+		_lastScreenChangeID = tmpScreenChangeID;
+
 		// reinit the whole theme
 		_theme->refresh();
 		// refresh all dialogs
 		for (int i = 0; i < _dialogStack.size(); ++i) {
 		  _dialogStack[i]->reflowLayout();
 		}
-	} else
+	} else {
 	  dialog->reflowLayout();
+	 }
 }
 
 void NewGui::closeTopDialog() {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list