hrev44709 adds 1 changeset to branch 'master' old head: 9aaf8ee2032a116d615975aee444f70c64a5505b new head: 5666b4f7a3c7cec818d229901b9664d106346591 ---------------------------------------------------------------------------- 5666b4f: Preserve the clipping constraints of the parent view... when drawing the following controls: * SliderBar * ActiveTab * MenuField This is a followup commit based on the change made for buttons in hrev44708 in response to bug #8700. It is good practice to always preserve the parent view's clipping constraints. Stippi and Axel can you you at this commit and make sure this is kosher? +alpha4 [ John Scipione <jscipione@xxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev44709 Commit: 5666b4f7a3c7cec818d229901b9664d106346591 URL: http://cgit.haiku-os.org/haiku/commit/?id=5666b4f Author: John Scipione <jscipione@xxxxxxxxx> Date: Fri Oct 19 23:30:14 2012 UTC Ticket: https://dev.haiku-os.org/ticket/8700 ---------------------------------------------------------------------------- 1 file changed, 19 insertions(+), 24 deletions(-) src/kits/interface/ControlLook.cpp | 43 ++++++++++++++------------------ ---------------------------------------------------------------------------- diff --git a/src/kits/interface/ControlLook.cpp b/src/kits/interface/ControlLook.cpp index e48c3a6..4b0910e 100644 --- a/src/kits/interface/ControlLook.cpp +++ b/src/kits/interface/ControlLook.cpp @@ -806,6 +806,9 @@ BControlLook::DrawSliderBar(BView* view, BRect rect, const BRect& updateRect, if (!rect.IsValid() || !rect.Intersects(updateRect)) return; + // save the clipping constraints of the view + view->PushState(); + // separate the bar in two sides float sliderPosition; BRect leftBarSide = rect; @@ -847,8 +850,8 @@ BControlLook::DrawSliderBar(BView* view, BRect rect, const BRect& updateRect, view->PopState(); - // reset clipping constraints - view->ConstrainClippingRegion(NULL); + // restore the clipping constraints of the view + view->PopState(); } @@ -1309,15 +1312,11 @@ BControlLook::DrawActiveTab(BView* view, BRect& rect, const BRect& updateRect, if (!rect.IsValid() || !rect.Intersects(updateRect)) return; - // clipping constraints for the view - BRegion clipping; - view->GetClippingRegion(&clipping); - - // intersect constraints with updateRect - BRegion updateClipping(updateRect); - clipping.IntersectWith(&updateClipping); + // save the clipping constraints of the view + view->PushState(); - // clip to the intersection + // set clipping constraints to updateRect + BRegion clipping(updateRect); view->ConstrainClippingRegion(&clipping); rgb_color edgeShadowColor; @@ -1396,8 +1395,8 @@ BControlLook::DrawActiveTab(BView* view, BRect& rect, const BRect& updateRect, view->FillRect(rect, fillGradient); - // reset clipping constraints - view->ConstrainClippingRegion(NULL); + // restore the clipping constraints of the view + view->PopState(); } @@ -1901,7 +1900,7 @@ BControlLook::_DrawButtonFrame(BView* view, BRect& rect, // save the clipping constraints of the view view->PushState(); - // set cliping constraints to updateRect + // set clipping constraints to updateRect BRegion clipping(updateRect); view->ConstrainClippingRegion(&clipping); @@ -2172,7 +2171,7 @@ BControlLook::_DrawButtonBackground(BView* view, BRect& rect, // save the clipping constraints of the view view->PushState(); - // set cliping constraints to updateRect + // set clipping constraints to updateRect BRegion clipping(updateRect); view->ConstrainClippingRegion(&clipping); @@ -2358,15 +2357,11 @@ BControlLook::_DrawMenuFieldBackgroundInside(BView* view, BRect& rect, if (!rect.IsValid() || !rect.Intersects(updateRect)) return; - // clipping constraints for the view - BRegion clipping; - view->GetClippingRegion(&clipping); - - // intersect constraints with updateRect - BRegion updateClipping(updateRect); - clipping.IntersectWith(&updateClipping); + // save the clipping constraints of the view + view->PushState(); - // clip to the intersection + // set clipping constraints to updateRect + BRegion clipping(updateRect); view->ConstrainClippingRegion(&clipping); // frame colors @@ -2540,8 +2535,8 @@ BControlLook::_DrawMenuFieldBackgroundInside(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(); }