From cc636a35cb540468d8f77e52c61a559cd893cd66 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 24 May 2009 14:38:09 +0000 Subject: [PATCH] Simplify dirty region handling when copying regions. Basically the full region is considered dirty and only what we are really able to copy (which excludes all possible dirty regions) is removed from that again. This is simpler and less error prone than to remove more than we may copy and then add the old dirty regions back. Fixes a few region copy related redraw issues most visible in case of scrolling like non-updated parts when scrolling in Tracker or Terminal as in bug #3803. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30840 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Window.cpp | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index a9d4b32016..dbd6b26997 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -450,8 +450,6 @@ Window::CopyContents(BRegion* region, int32 xOffset, int32 yOffset) // if the region still contains any rects // offset to source location again region->OffsetBy(-xOffset, -yOffset); - // the part which we can copy is not dirty - newDirty->Exclude(region); BRegion* allDirtyRegions = fRegionPool.GetRegion(fDirtyRegion); if (allDirtyRegions != NULL) { @@ -476,13 +474,12 @@ Window::CopyContents(BRegion* region, int32 xOffset, int32 yOffset) fDrawingEngine->CopyRegion(copyRegion, xOffset, yOffset); + // Prevent those parts from being added to the dirty region... + newDirty->Exclude(copyRegion); + // The parts that could be copied are not dirty (at the // target location!) copyRegion->OffsetBy(xOffset, yOffset); - // Prevent those parts to being transfered to the dirty - // region... - if (allDirtyRegions != NULL) - allDirtyRegions->Exclude(copyRegion); // ... and even exclude them from the pending dirty region! if (fPendingUpdateSession->IsUsed()) fPendingUpdateSession->DirtyRegion().Exclude(copyRegion); @@ -493,26 +490,8 @@ Window::CopyContents(BRegion* region, int32 xOffset, int32 yOffset) fDrawingEngine->CopyRegion(region, xOffset, yOffset); } - if (allDirtyRegions != NULL) { - // Move along the dirty regions and include it in the newDirty - // region. TODO: This is disabled for the moment, since it - // works fine without excluding the pending region. But there - // is one occasion where I observed flickering that could be - // explained by disabling this. - //allDirtyRegions->OffsetBy(xOffset, yOffset); - //// no need to include what's already pending anyways - //// NOTE: The left overs of the current update session which - //// have been moved are still included! - //if (fPendingUpdateSession->IsUsed()) { - //allDirtyRegions->Exclude( - //&fPendingUpdateSession->DirtyRegion()); - //} - //allDirtyRegions->OffsetBy(-xOffset, -yOffset); - // include the left over of the moved dirty regions in the - // new dirty region - newDirty->Include(allDirtyRegions); + if (allDirtyRegions != NULL) fRegionPool.Recycle(allDirtyRegions); - } } } // what is left visible from the original region