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
This commit is contained in:
John Scipione 2012-10-19 19:30:14 -04:00 committed by Alexander von Gluck IV
parent 9f98e6a6cb
commit 5a4c398e25

View File

@ -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);
// save the clipping constraints of the view
view->PushState();
// intersect constraints with updateRect
BRegion updateClipping(updateRect);
clipping.IntersectWith(&updateClipping);
// 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);
// save the clipping constraints of the view
view->PushState();
// intersect constraints with updateRect
BRegion updateClipping(updateRect);
clipping.IntersectWith(&updateClipping);
// 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();
}