ControlLook: fix clipping
Remove ConstrainClippingRegion calls as they do not take into
account view transformations.
Clip drawing to the drawing rect, not the updated area.
Fixes #12890
Change-Id: Ie76cb83e0af03213008da78407de25261daea5df
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4457
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
(cherry picked from commit e6a598a2f4a3f359259f314699d8993b21c6847f)
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6340
Diff
headers/os/interface/ControlLook.h | 3 +++
src/kits/interface/ControlLook.cpp | 32 ++++++++++++++++++++++++++++++++
src/kits/interface/HaikuControlLook.cpp | 265 ++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
3 files changed, 178 insertions(+), 122 deletions(-)
@@ -430,6 +430,9 @@
virtual float GetScrollBarWidth(
orientation orientation = B_VERTICAL);
static bool ShouldDraw(BView* view, const BRect& rect,
const BRect& updateRect);
private:
virtual void _ReservedControlLook6();
@@ -62,6 +62,38 @@
}
bool
BControlLook::ShouldDraw(BView* view, const BRect& rect, const BRect& updateRect)
{
if (!rect.IsValid())
return false;
BPoint points[4];
points[0] = rect.LeftTop();
points[1] = rect.RightBottom();
points[2] = rect.LeftBottom();
points[3] = rect.RightTop();
view->TransformTo(B_VIEW_COORDINATES).Apply(points, 4);
BRect dest;
dest.left = dest.right = points[0].x;
dest.top = dest.bottom = points[0].y;
for (int i = 1; i < 4; i++) {
dest.left = std::min(dest.left, points[i].x);
dest.right = std::max(dest.right, points[i].x);
dest.top = std::min(dest.top, points[i].y);
dest.bottom = std::max(dest.bottom, points[i].y);
}
dest.left = floorf(dest.left);
dest.right = ceilf(dest.right);
dest.top = floorf(dest.top);
dest.bottom = ceilf(dest.bottom);
return dest.Intersects(updateRect);
}
void
BControlLook::DrawLabel(BView* view, const char* label, const BBitmap* icon,
BRect rect, const BRect& updateRect, const rgb_color& base, uint32 flags,
@@ -174,7 +174,7 @@
const BRect& updateRect, const rgb_color& base, uint32 flags,
uint32 borders)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
@@ -295,7 +295,7 @@
const BRect& updateRect, const rgb_color& base, uint32 flags,
uint32 borders)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
@@ -327,7 +327,7 @@
const BRect& updateRect, const rgb_color& base, uint32 flags,
uint32 borders)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
@@ -366,7 +366,7 @@
HaikuControlLook::DrawStatusBar(BView* view, BRect& rect, const BRect& updateRect,
const rgb_color& base, const rgb_color& barColor, float progressPosition)
{
if (!rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
_DrawOuterResessedFrame(view, rect, base, 0.6);
@@ -419,7 +419,7 @@
HaikuControlLook::DrawCheckBox(BView* view, BRect& rect, const BRect& updateRect,
const rgb_color& base, uint32 flags)
{
if (!rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
rgb_color dark1BorderColor;
@@ -491,7 +491,7 @@
HaikuControlLook::DrawRadioButton(BView* view, BRect& rect, const BRect& updateRect,
const rgb_color& base, uint32 flags)
{
if (!rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
rgb_color borderColor;
@@ -563,14 +563,13 @@
const BRect& updateRect, const rgb_color& base, uint32 flags,
orientation orientation)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
view->PushState();
BRegion clipping(updateRect);
view->ConstrainClippingRegion(&clipping);
view->ClipToRect(rect);
bool isEnabled = (flags & B_DISABLED) == 0;
bool isFocused = (flags & B_FOCUSED) != 0;
@@ -619,12 +618,13 @@
const BRect& updateRect, const rgb_color& base, uint32 flags,
int32 direction, orientation orientation, bool down)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
view->PushState();
BRegion buttonRegion(rect);
view->ConstrainClippingRegion(&buttonRegion);
view->ClipToRect(rect);
bool isEnabled = (flags & B_DISABLED) == 0;
@@ -638,8 +638,7 @@
BRegion clipping(updateRect);
view->ConstrainClippingRegion(&clipping);
view->PopState();
}
void
@@ -657,14 +656,13 @@
const BRect& updateRect, const rgb_color& base, uint32 flags,
orientation orientation)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
view->PushState();
BRegion clipping(updateRect);
view->ConstrainClippingRegion(&clipping);
view->ClipToRect(rect);
bool isEnabled = (flags & B_DISABLED) == 0;
@@ -754,14 +752,13 @@
const BRect& updateRect, const rgb_color& base, uint32 flags,
orientation orientation, uint32 knobStyle)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
view->PushState();
BRegion clipping(updateRect);
view->ConstrainClippingRegion(&clipping);
view->ClipToRect(rect);
bool isEnabled = (flags & B_DISABLED) == 0;
@@ -1117,11 +1114,8 @@
const rgb_color& base, rgb_color leftFillColor, rgb_color rightFillColor,
float sliderScale, uint32 flags, orientation orientation)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
view->PushState();
float sliderPosition;
@@ -1141,31 +1135,17 @@
rightBarSide.bottom = sliderPosition - 1;
}
BRegion region(rect);
region.Exclude(rightBarSide);
view->ConstrainClippingRegion(®ion);
view->PushState();
view->ClipToRect(leftBarSide);
DrawSliderBar(view, rect, updateRect, base, leftFillColor, flags,
orientation);
view->PopState();
region.Set(rect);
region.Exclude(leftBarSide);
view->ConstrainClippingRegion(®ion);
view->PushState();
view->ClipToRect(rightBarSide);
DrawSliderBar(view, rect, updateRect, base, rightFillColor, flags,
orientation);
view->PopState();
view->PopState();
}
@@ -1174,7 +1154,7 @@
const rgb_color& base, rgb_color fillColor, uint32 flags,
orientation orientation)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
@@ -1195,9 +1175,9 @@
}
BRegion region(rect);
region.Exclude(barRect);
view->ConstrainClippingRegion(®ion);
view->PushState();
view->ClipToRect(rect);
view->ClipToInverseRect(barRect);
if ((flags & B_BLEND_FRAME) == 0) {
view->SetHighColor(base);
@@ -1285,7 +1265,9 @@
fillShadowColor, 1.0, 0.0, -1.0, -1.0, orientation);
}
view->ConstrainClippingRegion(NULL);
view->PopState();
if ((flags & B_BLEND_FRAME) != 0)
view->SetDrawingMode(B_OP_ALPHA);
view->BeginLineArray(4);
if (orientation == B_HORIZONTAL) {
@@ -1324,7 +1306,7 @@
HaikuControlLook::DrawSliderThumb(BView* view, BRect& rect, const BRect& updateRect,
const rgb_color& base, uint32 flags, orientation orientation)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
@@ -1418,7 +1400,7 @@
const BRect& updateRect, const rgb_color& base, const rgb_color& fill,
uint32 flags, orientation orientation)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
@@ -1536,7 +1518,7 @@
const BRect& updateRect, const rgb_color& base, int32 count,
hash_mark_location location, uint32 flags, orientation orientation)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
rgb_color lightColor;
@@ -1626,7 +1608,7 @@
const BRect& updateRect, const rgb_color& base, uint32 flags,
uint32 borders, border_style borderStyle, uint32 side)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
if (side == BTabView::kTopSide || side == BTabView::kBottomSide) {
@@ -1660,7 +1642,7 @@
const BRect& updateRect, const rgb_color& base, uint32 flags,
uint32 borders, uint32 side, int32, int32, int32, int32)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
@@ -1672,9 +1654,8 @@
view->PushState();
BRegion clipping(updateRect);
view->ConstrainClippingRegion(&clipping);
view->ClipToRect(rect);
rgb_color edgeShadowColor;
rgb_color edgeLightColor;
@@ -1728,11 +1709,13 @@
rightBottomCorner.left = floorf(rightBottomCorner.right
- kRoundCornerRadius);
rightBottomCorner.top = floorf(rect.bottom - kRoundCornerRadius);
BRect roundCorner[2];
switch (side) {
case B_TOP_BORDER:
clipping.Exclude(leftTopCorner);
clipping.Exclude(rightTopCorner);
roundCorner[0] = leftTopCorner;
roundCorner[1] = rightTopCorner;
_DrawRoundCornerLeftTop(view, leftTopCorner, updateRect, base,
@@ -1745,8 +1728,8 @@
fillGradient);
break;
case B_BOTTOM_BORDER:
clipping.Exclude(leftBottomCorner);
clipping.Exclude(rightBottomCorner);
roundCorner[0] = leftBottomCorner;
roundCorner[1] = rightBottomCorner;
_DrawRoundCornerLeftBottom(view, leftBottomCorner, updateRect, base,
@@ -1759,8 +1742,8 @@
fillGradient);
break;
case B_LEFT_BORDER:
clipping.Exclude(leftTopCorner);
clipping.Exclude(leftBottomCorner);
roundCorner[0] = leftTopCorner;
roundCorner[1] = leftBottomCorner;
_DrawRoundCornerLeftTop(view, leftTopCorner, updateRect, base,
@@ -1773,8 +1756,8 @@
fillGradient);
break;
case B_RIGHT_BORDER:
clipping.Exclude(rightTopCorner);
clipping.Exclude(rightBottomCorner);
roundCorner[0] = rightTopCorner;
roundCorner[1] = rightBottomCorner;
_DrawRoundCornerRightTop(view, rightTopCorner, updateRect, base,
@@ -1789,7 +1772,8 @@
}
view->ConstrainClippingRegion(&clipping);
view->ClipToInverseRect(roundCorner[0]);
view->ClipToInverseRect(roundCorner[1]);
uint32 bordersToDraw = 0;
switch (side) {
@@ -1840,7 +1824,7 @@
const BRect& updateRect, const rgb_color& base, uint32 flags,
uint32 borders, uint32 side, int32, int32, int32, int32)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
rgb_color edgeShadowColor;
@@ -1942,7 +1926,7 @@
const rgb_color& base, orientation orientation, uint32 flags,
uint32 borders)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
rgb_color background;
@@ -2102,7 +2086,7 @@
const BRect& updateRect, const rgb_color& base, uint32 flags,
uint32 borders)
{
if (!rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
rgb_color dark1BorderColor;
@@ -2333,7 +2317,7 @@
BRect rect, const BRect& updateRect, const rgb_color& base, uint32 flags,
const BAlignment& alignment, const rgb_color* textColor)
{
if (!rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
if (label == NULL && icon == NULL)
@@ -2521,9 +2505,8 @@
view->PushState();
BRegion clipping(updateRect);
view->ConstrainClippingRegion(&clipping);
view->ClipToRect(rect);
@@ -2602,9 +2585,10 @@
BRect leftTopCorner(floorf(rect.left), floorf(rect.top),
floorf(rect.left + leftTopRadius),
floorf(rect.top + leftTopRadius));
clipping.Exclude(leftTopCorner);
BRect cornerRect(leftTopCorner);
_DrawRoundCornerFrameLeftTop(view, leftTopCorner, updateRect,
cornerBgColor, edgeShadowColor, frameLightColor);
view->ClipToInverseRect(cornerRect);
}
if ((borders & B_TOP_BORDER) != 0 && (borders & B_RIGHT_BORDER) != 0
@@ -2613,10 +2597,11 @@
BRect rightTopCorner(floorf(rect.right - rightTopRadius),
floorf(rect.top), floorf(rect.right),
floorf(rect.top + rightTopRadius));
clipping.Exclude(rightTopCorner);
BRect cornerRect(rightTopCorner);
_DrawRoundCornerFrameRightTop(view, rightTopCorner, updateRect,
cornerBgColor, edgeShadowColor, edgeLightColor,
frameLightColor, frameShadowColor);
view->ClipToInverseRect(cornerRect);
}
if ((borders & B_LEFT_BORDER) != 0 && (borders & B_BOTTOM_BORDER) != 0
@@ -2625,10 +2610,11 @@
BRect leftBottomCorner(floorf(rect.left),
floorf(rect.bottom - leftBottomRadius),
floorf(rect.left + leftBottomRadius), floorf(rect.bottom));
clipping.Exclude(leftBottomCorner);
BRect cornerRect(leftBottomCorner);
_DrawRoundCornerFrameLeftBottom(view, leftBottomCorner, updateRect,
cornerBgColor, edgeShadowColor, edgeLightColor,
frameLightColor, frameShadowColor);
view->ClipToInverseRect(cornerRect);
}
if ((borders & B_RIGHT_BORDER) != 0 && (borders & B_BOTTOM_BORDER) != 0
@@ -2637,14 +2623,12 @@
BRect rightBottomCorner(floorf(rect.right - rightBottomRadius),
floorf(rect.bottom - rightBottomRadius), floorf(rect.right),
floorf(rect.bottom));
clipping.Exclude(rightBottomCorner);
BRect cornerRect(rightBottomCorner);
_DrawRoundCornerFrameRightBottom(view, rightBottomCorner,
updateRect, cornerBgColor, edgeLightColor, frameShadowColor);
view->ClipToInverseRect(cornerRect);
}
view->ConstrainClippingRegion(&clipping);
if ((flags & B_DEFAULT_BUTTON) != 0) {
_DrawOuterResessedFrame(view, rect, defaultIndicatorColor,
@@ -2803,9 +2787,8 @@
view->PushState();
BRegion clipping(updateRect);
view->ConstrainClippingRegion(&clipping);
view->ClipToRect(rect);
@@ -2816,6 +2799,7 @@
_DrawFlatButtonBackground(view, rect, updateRect, base, popupIndicator,
flags, borders, orientation);
} else {
BRegion clipping(rect);
_DrawNonFlatButtonBackground(view, rect, updateRect, clipping,
leftTopRadius, rightTopRadius, leftBottomRadius, rightBottomRadius,
base, popupIndicator, flags, borders, orientation);
@@ -2882,8 +2866,10 @@
floorf(rect.left + leftTopRadius - 2.0),
floorf(rect.top + leftTopRadius - 2.0));
clipping.Exclude(leftTopCorner);
BRect cornerRect(leftTopCorner);
_DrawRoundCornerBackgroundLeftTop(view, leftTopCorner, updateRect,
bevelLightColor, fillGradient);
view->ClipToInverseRect(cornerRect);
}
if ((borders & B_TOP_BORDER) != 0 && (borders & B_RIGHT_BORDER) != 0
@@ -2893,8 +2879,10 @@
floorf(rect.top), floorf(rect.right),
floorf(rect.top + rightTopRadius - 2.0));
clipping.Exclude(rightTopCorner);
BRect cornerRect(rightTopCorner);
_DrawRoundCornerBackgroundRightTop(view, rightTopCorner,
updateRect, bevelLightColor, bevelShadowColor, fillGradient);
view->ClipToInverseRect(cornerRect);
}
if ((borders & B_LEFT_BORDER) != 0 && (borders & B_BOTTOM_BORDER) != 0
@@ -2905,8 +2893,10 @@
floorf(rect.left + leftBottomRadius - 2.0),
floorf(rect.bottom));
clipping.Exclude(leftBottomCorner);
BRect cornerRect(leftBottomCorner);
_DrawRoundCornerBackgroundLeftBottom(view, leftBottomCorner,
updateRect, bevelLightColor, bevelShadowColor, fillGradient);
view->ClipToInverseRect(cornerRect);
}
if ((borders & B_RIGHT_BORDER) != 0 && (borders & B_BOTTOM_BORDER) != 0
@@ -2916,12 +2906,11 @@
floorf(rect.bottom - rightBottomRadius + 2.0), floorf(rect.right),
floorf(rect.bottom));
clipping.Exclude(rightBottomCorner);
BRect cornerRect(rightBottomCorner);
_DrawRoundCornerBackgroundRightBottom(view, rightBottomCorner,
updateRect, bevelShadowColor, fillGradient);
view->ClipToInverseRect(cornerRect);
}
view->ConstrainClippingRegion(&clipping);
@@ -3042,7 +3031,7 @@
float leftBottomRadius, float rightBottomRadius, const rgb_color& base,
bool popupIndicator, uint32 flags)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
if (popupIndicator) {
@@ -3091,15 +3080,14 @@
float leftBottomRadius, float rightBottomRadius, const rgb_color& base,
uint32 flags, uint32 borders)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
view->PushState();
BRegion clipping(updateRect);
view->ConstrainClippingRegion(&clipping);
view->ClipToRect(rect);
rgb_color frameLightColor = _FrameLightColor(base, flags);
@@ -3146,10 +3134,10 @@
BRect leftTopCorner(floorf(rect.left), floorf(rect.top),
floorf(rect.left + leftTopRadius - 2.0),
floorf(rect.top + leftTopRadius - 2.0));
clipping.Exclude(leftTopCorner);
BRect cornerRect(leftTopCorner);
BRegion cornerClipping(leftTopCorner);
view->ConstrainClippingRegion(&cornerClipping);
view->PushState();
view->ClipToRect(cornerRect);
BRect ellipseRect(leftTopCorner);
ellipseRect.InsetBy(-1.0, -1.0);
@@ -3163,6 +3151,9 @@
_DrawRoundCornerBackgroundLeftTop(view, leftTopCorner, updateRect,
bevelColor1, fillGradient);
view->PopState();
view->ClipToInverseRect(cornerRect);
}
if ((borders & B_TOP_BORDER) != 0 && (borders & B_RIGHT_BORDER) != 0
@@ -3171,10 +3162,10 @@
BRect rightTopCorner(floorf(rect.right - rightTopRadius + 2.0),
floorf(rect.top), floorf(rect.right),
floorf(rect.top + rightTopRadius - 2.0));
clipping.Exclude(rightTopCorner);
BRect cornerRect(rightTopCorner);
BRegion cornerClipping(rightTopCorner);
view->ConstrainClippingRegion(&cornerClipping);
view->PushState();
view->ClipToRect(cornerRect);
BRect ellipseRect(rightTopCorner);
ellipseRect.InsetBy(-1.0, -1.0);
@@ -3197,6 +3188,9 @@
_DrawRoundCornerBackgroundRightTop(view, rightTopCorner, updateRect,
bevelColor1, bevelColor3, fillGradient);
view->PopState();
view->ClipToInverseRect(cornerRect);
}
if ((borders & B_LEFT_BORDER) != 0 && (borders & B_BOTTOM_BORDER) != 0
@@ -3206,10 +3200,10 @@
floorf(rect.bottom - leftBottomRadius + 2.0),
floorf(rect.left + leftBottomRadius - 2.0),
floorf(rect.bottom));
clipping.Exclude(leftBottomCorner);
BRect cornerRect(leftBottomCorner);
BRegion cornerClipping(leftBottomCorner);
view->ConstrainClippingRegion(&cornerClipping);
view->PushState();
view->ClipToRect(cornerRect);
BRect ellipseRect(leftBottomCorner);
ellipseRect.InsetBy(-1.0, -1.0);
@@ -3232,6 +3226,9 @@
_DrawRoundCornerBackgroundLeftBottom(view, leftBottomCorner,
updateRect, bevelColor2, bevelColor3, fillGradient);
view->PopState();
view->ClipToInverseRect(cornerRect);
}
if ((borders & B_RIGHT_BORDER) != 0 && (borders & B_BOTTOM_BORDER) != 0
@@ -3240,10 +3237,10 @@
BRect rightBottomCorner(floorf(rect.right - rightBottomRadius + 2.0),
floorf(rect.bottom - rightBottomRadius + 2.0), floorf(rect.right),
floorf(rect.bottom));
clipping.Exclude(rightBottomCorner);
BRect cornerRect(rightBottomCorner);
BRegion cornerClipping(rightBottomCorner);
view->ConstrainClippingRegion(&cornerClipping);
view->PushState();
view->ClipToRect(cornerRect);
BRect ellipseRect(rightBottomCorner);
ellipseRect.InsetBy(-1.0, -1.0);
@@ -3257,10 +3254,10 @@
_DrawRoundCornerBackgroundRightBottom(view, rightBottomCorner,
updateRect, bevelColor3, fillGradient);
}
view->ConstrainClippingRegion(&clipping);
view->PopState();
view->ClipToInverseRect(cornerRect);
}
_DrawFrame(view, rect,
@@ -3295,9 +3292,10 @@
const BRect& updateRect, const rgb_color& background,
const rgb_color& edgeColor, const rgb_color& frameColor)
{
view->PushState();
BRegion clipping(cornerRect);
view->ConstrainClippingRegion(&clipping);
view->ClipToRect(cornerRect);
view->SetHighColor(background);
@@ -3321,6 +3319,8 @@
cornerRect.left++;
cornerRect.top++;
view->PopState();
}
@@ -3329,9 +3329,10 @@
const BRect& updateRect, const rgb_color& bevelColor,
const BGradientLinear& fillGradient)
{
view->PushState();
BRegion clipping(cornerRect);
view->ConstrainClippingRegion(&clipping);
view->ClipToRect(cornerRect);
BRect ellipseRect(cornerRect);
ellipseRect.right = ellipseRect.left + ellipseRect.Width() * 2;
@@ -3344,6 +3345,8 @@
ellipseRect.InsetBy(1, 1);
view->FillEllipse(ellipseRect, fillGradient);
view->PopState();
}
@@ -3369,9 +3372,10 @@
const rgb_color& edgeTopColor, const rgb_color& edgeRightColor,
const rgb_color& frameTopColor, const rgb_color& frameRightColor)
{
view->PushState();
BRegion clipping(cornerRect);
view->ConstrainClippingRegion(&clipping);
view->ClipToRect(cornerRect);
view->SetHighColor(background);
@@ -3407,6 +3411,8 @@
cornerRect.right--;
cornerRect.top++;
view->PopState();
}
@@ -3415,9 +3421,10 @@
const BRect& updateRect, const rgb_color& bevelTopColor,
const rgb_color& bevelRightColor, const BGradientLinear& fillGradient)
{
view->PushState();
BRegion clipping(cornerRect);
view->ConstrainClippingRegion(&clipping);
view->ClipToRect(cornerRect);
BRect ellipseRect(cornerRect);
ellipseRect.left = ellipseRect.right - ellipseRect.Width() * 2;
@@ -3434,6 +3441,8 @@
ellipseRect.InsetBy(1, 1);
view->FillEllipse(ellipseRect, fillGradient);
view->PopState();
}
@@ -3459,9 +3468,10 @@
const rgb_color& edgeLeftColor, const rgb_color& edgeBottomColor,
const rgb_color& frameLeftColor, const rgb_color& frameBottomColor)
{
view->PushState();
BRegion clipping(cornerRect);
view->ConstrainClippingRegion(&clipping);
view->ClipToRect(cornerRect);
view->SetHighColor(background);
@@ -3497,6 +3507,8 @@
cornerRect.left++;
cornerRect.bottom--;
view->PopState();
}
@@ -3505,9 +3517,10 @@
const BRect& updateRect, const rgb_color& bevelLeftColor,
const rgb_color& bevelBottomColor, const BGradientLinear& fillGradient)
{
view->PushState();
BRegion clipping(cornerRect);
view->ConstrainClippingRegion(&clipping);
view->ClipToRect(cornerRect);
BRect ellipseRect(cornerRect);
ellipseRect.right = ellipseRect.left + ellipseRect.Width() * 2;
@@ -3524,6 +3537,8 @@
ellipseRect.InsetBy(1, 1);
view->FillEllipse(ellipseRect, fillGradient);
view->PopState();
}
@@ -3545,9 +3560,10 @@
const BRect& updateRect, const rgb_color& background,
const rgb_color& edgeColor, const rgb_color& frameColor)
{
view->PushState();
BRegion clipping(cornerRect);
view->ConstrainClippingRegion(&clipping);
view->ClipToRect(cornerRect);
view->SetHighColor(background);
@@ -3571,6 +3587,8 @@
cornerRect.right--;
cornerRect.bottom--;
view->PopState();
}
@@ -3579,9 +3597,10 @@
BRect& cornerRect, const BRect& updateRect, const rgb_color& bevelColor,
const BGradientLinear& fillGradient)
{
view->PushState();
BRegion clipping(cornerRect);
view->ConstrainClippingRegion(&clipping);
view->ClipToRect(cornerRect);
BRect ellipseRect(cornerRect);
ellipseRect.left = ellipseRect.right - ellipseRect.Width() * 2;
@@ -3594,6 +3613,8 @@
ellipseRect.InsetBy(1, 1);
view->FillEllipse(ellipseRect, fillGradient);
view->PopState();
}
@@ -3606,7 +3627,7 @@
float leftInset, float topInset, float rightInset, float bottomInset,
orientation orientation)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
if (!ShouldDraw(view, rect, updateRect))
return;
BGradientLinear gradient;