Save and restore button clipping constraints.

This fixes #8700
This commit is contained in:
John Scipione 2012-10-17 20:17:07 -04:00 committed by Alexander von Gluck IV
parent 8358b7807b
commit 530ee871ff

View File

@ -1898,15 +1898,11 @@ BControlLook::_DrawButtonFrame(BView* view, BRect& rect,
if (!rect.IsValid() || !rect.Intersects(updateRect)) if (!rect.IsValid() || !rect.Intersects(updateRect))
return; return;
// clipping constraints for the view // save the clipping constraints of the view
BRegion clipping; view->PushState();
view->GetClippingRegion(&clipping);
// intersect constraints with updateRect // set cliping constraints to updateRect
BRegion updateClipping(updateRect); BRegion clipping(updateRect);
clipping.IntersectWith(&updateClipping);
// clip to the intersection
view->ConstrainClippingRegion(&clipping); view->ConstrainClippingRegion(&clipping);
// outer edge colors // outer edge colors
@ -2046,7 +2042,8 @@ BControlLook::_DrawButtonFrame(BView* view, BRect& rect,
frameShadowColor, frameShadowColor, borders); 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)) if (!rect.IsValid() || !rect.Intersects(updateRect))
return; return;
// clipping constraints for the view // save the clipping constraints of the view
BRegion clipping; view->PushState();
view->GetClippingRegion(&clipping);
// intersect constraints with updateRect // set cliping constraints to updateRect
BRegion updateClipping(updateRect); BRegion clipping(updateRect);
clipping.IntersectWith(&updateClipping);
// clip to the intersection
view->ConstrainClippingRegion(&clipping); view->ConstrainClippingRegion(&clipping);
// inner bevel colors // inner bevel colors
@ -2288,8 +2281,8 @@ BControlLook::_DrawButtonBackground(BView* view, BRect& rect,
// fill in the background // fill in the background
view->FillRect(rect, fillGradient); view->FillRect(rect, fillGradient);
// reset clipping constraints // restore the clipping constraints of the view
view->ConstrainClippingRegion(NULL); view->PopState();
} }