From 624b72625a6ced91d08029c06197ef46246e07fd Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Wed, 21 Jan 2004 21:05:57 +0000 Subject: [PATCH] Add ifdefs (off by default) that allow better debugging of invalidation problems by painting invalidated regions exactly rather than taking the minimal containing rectangle. b=215303 r=roc sr=bryner git-svn-id: svn://10.0.0.236/trunk@151652 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/gtk/nsWindow.cpp | 39 ++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/mozilla/widget/src/gtk/nsWindow.cpp b/mozilla/widget/src/gtk/nsWindow.cpp index c03b391e932..298ab337f3c 100644 --- a/mozilla/widget/src/gtk/nsWindow.cpp +++ b/mozilla/widget/src/gtk/nsWindow.cpp @@ -803,14 +803,6 @@ nsWindow::DoPaint (nsIRegion *aClipRegion) if (!mEventCallback) return; - nsPaintEvent event(NS_PAINT, this); - - event.time = GDK_CURRENT_TIME; // No time in EXPOSE events - - nsRect boundsRect; - aClipRegion->GetBoundingBox(&boundsRect.x, &boundsRect.y, &boundsRect.width, &boundsRect.height); - event.rect = &boundsRect; - // Don't paint anything if our window isn't visible. if (!mSuperWin) return; @@ -826,10 +818,31 @@ nsWindow::DoPaint (nsIRegion *aClipRegion) return; } - event.renderingContext = GetRenderingContext(); - if (!event.renderingContext) + nsCOMPtr rc = getter_AddRefs(GetRenderingContext()); + if (!rc) return; +// defining NS_PAINT_SEPARATELY is useful for debugging invalidation +// problems since it limits repainting to the rects that were actually +// invalidated. +#undef NS_PAINT_SEPARATELY + +#ifdef NS_PAINT_SEPARATELY + nsRegionRectSet *regionRectSet = nsnull; + aClipRegion->GetRects(®ionRectSet); + for (nsRegionRect *r = regionRectSet->mRects, + *r_end = r + regionRectSet->mNumRects; r < r_end; ++r) { + nsRect boundsRect(r->x, r->y, r->width, r->height); +#else + nsRect boundsRect; + aClipRegion->GetBoundingBox(&boundsRect.x, &boundsRect.y, &boundsRect.width, &boundsRect.height); +#endif + + nsPaintEvent event(NS_PAINT, this); + event.renderingContext = rc; + event.time = GDK_CURRENT_TIME; // No time in EXPOSE events + event.rect = &boundsRect; + #ifdef DEBUG GdkWindow *gw = GetRenderWindow(GTK_OBJECT(mSuperWin)); if (WANT_PAINT_FLASHING && gw) @@ -846,9 +859,11 @@ nsWindow::DoPaint (nsIRegion *aClipRegion) debug_GetName(GTK_OBJECT(mSuperWin)), (PRInt32) debug_GetRenderXID(GTK_OBJECT(mSuperWin))); #endif // DEBUG - + DispatchWindowEvent(&event); - NS_RELEASE(event.renderingContext); +#ifdef NS_PAINT_SEPARATELY + } +#endif } static NS_DEFINE_CID(kRegionCID, NS_REGION_CID);