From ce4d4801df6902c6d1cb3351fe34cc1a847d5c19 Mon Sep 17 00:00:00 2001 From: Stefano Musumeci Date: Sat, 2 Aug 2014 21:50:31 +0200 Subject: [PATCH] TINYGL: Refined dirty regions redraw logic. --- graphics/tinygl/zrect.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/graphics/tinygl/zrect.cpp b/graphics/tinygl/zrect.cpp index aa8f06aaa7b..6643a483228 100644 --- a/graphics/tinygl/zrect.cpp +++ b/graphics/tinygl/zrect.cpp @@ -67,7 +67,7 @@ void tglPresentBuffer() { while(itPrevFrame != endPrevFrame) { const Graphics::DrawCall &previousCall = **itPrevFrame; rectangles.push_back(DirtyRectangle(previousCall.getDirtyRegion(), 255, 255, 255)); - itPrevFrame++; + ++itPrevFrame; } break; } @@ -79,7 +79,7 @@ void tglPresentBuffer() { while (itFrame != endFrame) { const Graphics::DrawCall ¤tCall = **itFrame; rectangles.push_back(DirtyRectangle(currentCall.getDirtyRegion(), 255, 0, 0)); - itFrame ++; + ++itFrame; } // Merge coalesce dirty rects. @@ -143,18 +143,16 @@ void tglPresentBuffer() { // Execute draw calls. while (it != end) { - //(*it)->execute(false); - + Common::Rect drawCallRegion = (*it)->getDirtyRegion(); itRectangles = rectangles.begin(); while (itRectangles != rectangles.end()) { Common::Rect dirtyRegion = (*itRectangles).rectangle; - (*it)->execute(dirtyRegion, false); - //if (dirtyRegion.intersects((*it)->getDirtyRegion())) { - // (*it)->execute(dirtyRegion, false); - //} - itRectangles++; + if (dirtyRegion.intersects(drawCallRegion) || drawCallRegion.contains(dirtyRegion)) { + (*it)->execute(dirtyRegion, false); + } + ++itRectangles; } - it++; + ++it; } int drawCallNumber = c->_drawCallsQueue.size();