[Scummvm-cvs-logs] SF.net SVN: scummvm:[33190] scummvm/branches/gsoc2008-gui/gui

Tanoku at users.sourceforge.net Tanoku at users.sourceforge.net
Tue Jul 22 11:23:38 CEST 2008


Revision: 33190
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33190&view=rev
Author:   Tanoku
Date:     2008-07-22 09:23:37 +0000 (Tue, 22 Jul 2008)

Log Message:
-----------
Dirty screen handling!

Modified Paths:
--------------
    scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp
    scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h

Modified: scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp	2008-07-22 09:12:10 UTC (rev 33189)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp	2008-07-22 09:23:37 UTC (rev 33190)
@@ -369,6 +369,8 @@
 
 		_vectorRenderer->textStep(q.text, q.area, _widgets[q.type]->_textStep);
 	}
+	
+	addDirtyRect(q.area);
 }
 
 void ThemeRenderer::calcBackgroundOffset(DrawData type) {
@@ -554,8 +556,6 @@
 }
 
 void ThemeRenderer::updateScreen() {
-//	renderDirtyScreen();
-	
 	if (!_bufferQueue.empty()) {
 		_vectorRenderer->setSurface(_backBuffer);
 		
@@ -583,18 +583,41 @@
 		_textQueue.clear();
 	}
 		
-	_vectorRenderer->copyWholeFrame(_system);
+	renderDirtyScreen();
 }
 
 void ThemeRenderer::renderDirtyScreen() {
-	// TODO: This isn't really optimized. Check dirty squares for collisions
-	// and all that.
 	if (_dirtyScreen.empty())
 		return;
-
-	for (uint i = 0; i < _dirtyScreen.size(); ++i)
-		_vectorRenderer->copyFrame(_system, _dirtyScreen[i]);
-
+		
+	Common::List<Common::Rect>::iterator cur;
+	for (Common::List<Common::Rect>::iterator d = _dirtyScreen.begin(); d != _dirtyScreen.end(); ++d) {
+		cur = d;
+		do {
+			++d;
+			if (cur->intersects(*d))
+				_dirtyScreen.erase(d);
+		} while (d != _dirtyScreen.end());
+		
+		
+		// FIXME: this square-merging algorithm can be rather slow, and I don't think it
+		// benefits us *that* much. Maybe we should just stick to finding dirty squares that overlap.
+		
+		// d = cur;
+		// 
+		// do {
+		// 	++d;
+		// 	if ((cur->top == d->top && cur->bottom == d->bottom && (ABS(cur->left - d->right) < 10 || ABS(cur->right - d->left) < 10)) ||
+		// 		(cur->left == d->left && cur->right == d->right && (ABS(cur->top - d->bottom) < 10 || ABS(cur->bottom - d->top) < 10))) {
+		// 		cur->extend(*d);
+		// 		_dirtyScreen.erase(d);
+		// 	}
+		// } while (d != _dirtyScreen.end());
+		
+		d = cur;
+		_vectorRenderer->copyFrame(_system, *d);
+	}
+		
 	_dirtyScreen.clear();
 }
 

Modified: scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h	2008-07-22 09:12:10 UTC (rev 33189)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h	2008-07-22 09:23:37 UTC (rev 33190)
@@ -603,7 +603,7 @@
 	Graphics::TextStep _texts[kTextColorMAX];
 	
 	/** List of all the dirty screens that must be blitted to the overlay. */
-	Common::Array<Common::Rect> _dirtyScreen;
+	Common::List<Common::Rect> _dirtyScreen;
 	
 	/** Queue with all the drawing that must be done to the Back Buffer */
 	Common::List<DrawQueue> _bufferQueue;


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