From 4fa767198c09b0fb3922b25ecf490b8c61fc0f93 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Wed, 17 Oct 2012 20:17:07 -0400 Subject: [PATCH] Save and restore button clipping constraints. This fixes #8700 --- src/kits/interface/ControlLook.cpp | 31 ++++++++++++------------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/kits/interface/ControlLook.cpp b/src/kits/interface/ControlLook.cpp index 00c945e066..e48c3a6e8c 100644 --- a/src/kits/interface/ControlLook.cpp +++ b/src/kits/interface/ControlLook.cpp @@ -1898,15 +1898,11 @@ BControlLook::_DrawButtonFrame(BView* view, BRect& rect, if (!rect.IsValid() || !rect.Intersects(updateRect)) return; - // clipping constraints for the view - BRegion clipping; - view->GetClippingRegion(&clipping); + // save the clipping constraints of the view + view->PushState(); - // intersect constraints with updateRect - BRegion updateClipping(updateRect); - clipping.IntersectWith(&updateClipping); - - // clip to the intersection + // set cliping constraints to updateRect + BRegion clipping(updateRect); view->ConstrainClippingRegion(&clipping); // outer edge colors @@ -2046,7 +2042,8 @@ BControlLook::_DrawButtonFrame(BView* view, BRect& rect, frameShadowColor, frameShadowColor, borders); } - view->ConstrainClippingRegion(NULL); + // restore the clipping constraints of the view + view->PopState(); } @@ -2172,15 +2169,11 @@ BControlLook::_DrawButtonBackground(BView* view, BRect& rect, if (!rect.IsValid() || !rect.Intersects(updateRect)) return; - // clipping constraints for the view - BRegion clipping; - view->GetClippingRegion(&clipping); + // save the clipping constraints of the view + view->PushState(); - // intersect constraints with updateRect - BRegion updateClipping(updateRect); - clipping.IntersectWith(&updateClipping); - - // clip to the intersection + // set cliping constraints to updateRect + BRegion clipping(updateRect); view->ConstrainClippingRegion(&clipping); // inner bevel colors @@ -2288,8 +2281,8 @@ BControlLook::_DrawButtonBackground(BView* view, BRect& rect, // fill in the background view->FillRect(rect, fillGradient); - // reset clipping constraints - view->ConstrainClippingRegion(NULL); + // restore the clipping constraints of the view + view->PopState(); }