From c4005c4d29daab8c89b8f5125c7293ab7250529c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Thu, 9 Apr 2009 14:19:09 +0000 Subject: [PATCH] * Some cleanup in the commented out debug code. * Fixed a problem when scrolling. Basically, the region that could be copied should be removed from the pending dirty region. Before a region is copied, the dirty regions are removed from it. So the region at the target offset can always be considered clean. This fixes the problem in Tracker when enlarging windows that are already scrolled to the right or bottom. This then triggers the Tracker window to scroll the pose view in such a way that the bottom/right stays fixed, but would trigger this exact situation: The bottom is already pending dirty, but then the clean contents are copied on top of it. Fixes ticket #1849 and perhaps also #2975. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30068 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Window.cpp | 49 ++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index 0cb273f565..a9d4b32016 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -67,6 +67,10 @@ using std::nothrow; // the update session, which tells us the cause of the update +//static rgb_color sPendingColor = (rgb_color){ 255, 255, 0, 255 }; +//static rgb_color sCurrentColor = (rgb_color){ 255, 0, 255, 255 }; + + Window::Window(const BRect& frame, const char *name, window_look look, window_feel feel, uint32 flags, uint32 workspaces, ::ServerWindow* window, DrawingEngine* drawingEngine) @@ -411,8 +415,8 @@ Window::ScrollViewBy(View* view, int32 dx, int32 dy) view->ScrollBy(dx, dy, dirty); -//fDrawingEngine->FillRegion(dirty, rgb_color{ 255, 0, 255, 255 }); -//snooze(2000); +//fDrawingEngine->FillRegion(*dirty, (rgb_color){ 255, 0, 255, 255 }); +//snooze(20000); if (!IsOffscreenWindow() && IsVisible() && view->IsVisible()) { dirty->IntersectWith(&VisibleContentRegion()); @@ -471,6 +475,18 @@ Window::CopyContents(BRegion* region, int32 xOffset, int32 yOffset) copyRegion->Exclude(allDirtyRegions); fDrawingEngine->CopyRegion(copyRegion, xOffset, yOffset); + + // 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); + fRegionPool.Recycle(copyRegion); } else { // Fallback, should never be here. @@ -1807,6 +1823,15 @@ Window::_TriggerContentRedraw(BRegion& dirtyContentRegion) fDrawingEngine->SetCopyToFrontEnabled(true); fDrawingEngine->SuspendAutoSync(); +//sCurrentColor.red = rand() % 255; +//sCurrentColor.green = rand() % 255; +//sCurrentColor.blue = rand() % 255; +//sPendingColor.red = rand() % 255; +//sPendingColor.green = rand() % 255; +//sPendingColor.blue = rand() % 255; +//fDrawingEngine->FillRegion(*backgroundClearingRegion, sCurrentColor); +//snooze(10000); + fTopView->Draw(fDrawingEngine, backgroundClearingRegion, &fContentRegion, true); @@ -1863,9 +1888,6 @@ fWindow->ResyncDrawState(); } -//static rgb_color sPendingColor; -//static rgb_color sCurrentColor; - /*! pre: the clipping is readlocked (this function is only called from _TriggerContentRedraw()), which @@ -1879,7 +1901,7 @@ Window::_TransferToUpdateSession(BRegion* contentDirtyRegion) return; //fDrawingEngine->FillRegion(*contentDirtyRegion, sPendingColor); -//snooze(10000); +//snooze(20000); // add to pending fPendingUpdateSession->SetUsed(true); @@ -1964,14 +1986,16 @@ Window::BeginUpdate(BPrivate::PortLink& link) dirty->IntersectWith(&VisibleContentRegion()); -//sCurrentColor.red = rand() % 255; -//sCurrentColor.green = rand() % 255; -//sCurrentColor.blue = rand() % 255; -//sPendingColor.red = rand() % 255; -//sPendingColor.green = rand() % 255; -//sPendingColor.blue = rand() % 255; +//if (!fCurrentUpdateSession->IsExpose()) { +////sCurrentColor.red = rand() % 255; +////sCurrentColor.green = rand() % 255; +////sCurrentColor.blue = rand() % 255; +////sPendingColor.red = rand() % 255; +////sPendingColor.green = rand() % 255; +////sPendingColor.blue = rand() % 255; //fDrawingEngine->FillRegion(*dirty, sCurrentColor); //snooze(10000); +//} link.StartMessage(B_OK); // append the current window geometry to the @@ -1990,7 +2014,6 @@ Window::BeginUpdate(BPrivate::PortLink& link) fDrawingEngine->SetCopyToFrontEnabled(false); if (!fCurrentUpdateSession->IsExpose() && fDrawingEngine->LockParallelAccess()) { -//fDrawingEngine->FillRegion(dirty, (rgb_color){ 255, 0, 0, 255 }); fDrawingEngine->SuspendAutoSync(); fTopView->Draw(fDrawingEngine, dirty, &fContentRegion, true);