From a075725845495cb8c7a46c24d08e3c4cab6eddb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 29 Apr 2006 18:19:54 +0000 Subject: [PATCH] another long overdue fix... CopyBits() is now taking children of the view in question into account. Neither are they included in the region being copied, nor are views overdrawn by the copied contents. Also, the update region is calculated from the region having been copied, so that holes from children views are invalidated correctly. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17268 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/ViewLayer.cpp | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/servers/app/ViewLayer.cpp b/src/servers/app/ViewLayer.cpp index e3a2e981e4..cf7650cc35 100644 --- a/src/servers/app/ViewLayer.cpp +++ b/src/servers/app/ViewLayer.cpp @@ -928,25 +928,48 @@ ViewLayer::CopyBits(BRect src, BRect dst, BRegion& windowContentClipping) if (!copyRegion) return; + // move src rect to destination here for efficiency reasons + visibleSrc.OffsetBy(xOffset, yOffset); + + // we need to interstect the copyRegion too times, onces + // at the source and once at the destination (here done + // the other way arround but it doesn't matter) + // the reason for this is that we are not supposed to visually + // copy children in the source rect and neither to copy onto + // children in the destination rect... copyRegion->Set(visibleSrc); copyRegion->IntersectWith(&ScreenClipping(&windowContentClipping)); + // note that fScreenClipping is used directly from hereon + // because it is now up to date + + copyRegion->OffsetBy(-xOffset, -yOffset); + copyRegion->IntersectWith(&fScreenClipping); + + // do the actual blit fWindow->CopyContents(copyRegion, xOffset, yOffset); // find the dirty region as far as we are concerned BRect dirtyDst(dst); ConvertToVisibleInTopView(&dirtyDst); - BRegion* dirty = copyRegion; - // reuse copyRegion and call it "dirty" + BRegion* dirty = fWindow->GetRegion(); + if (!dirty) { + fWindow->RecycleRegion(copyRegion); + return; + } + // offset copyRegion to destination again + copyRegion->OffsetBy(xOffset, yOffset); + // start with destination given by user dirty->Set(dirtyDst); // exclude the part that we could copy - visibleSrc.OffsetBy(xOffset, yOffset); - dirty->Exclude(visibleSrc); - dirty->IntersectWith(&ScreenClipping(&windowContentClipping)); + dirty->Exclude(copyRegion); + + dirty->IntersectWith(&fScreenClipping); fWindow->MarkContentDirty(*dirty); fWindow->RecycleRegion(dirty); + fWindow->RecycleRegion(copyRegion); }