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 <[email protected]> Reviewed-by: Adrien Destugues <[email protected]> Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
af3dceb279
commit
e6a598a2f4
@@ -430,6 +430,9 @@ public:
|
|||||||
virtual float GetScrollBarWidth(
|
virtual float GetScrollBarWidth(
|
||||||
orientation orientation = B_VERTICAL);
|
orientation orientation = B_VERTICAL);
|
||||||
|
|
||||||
|
static bool ShouldDraw(BView* view, const BRect& rect,
|
||||||
|
const BRect& updateRect);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// FBC padding
|
// FBC padding
|
||||||
virtual void _ReservedControlLook6();
|
virtual void _ReservedControlLook6();
|
||||||
|
|||||||
@@ -62,6 +62,38 @@ BControlLook::ComposeIconSize(int32 size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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
|
void
|
||||||
BControlLook::DrawLabel(BView* view, const char* label, const BBitmap* icon,
|
BControlLook::DrawLabel(BView* view, const char* label, const BBitmap* icon,
|
||||||
BRect rect, const BRect& updateRect, const rgb_color& base, uint32 flags,
|
BRect rect, const BRect& updateRect, const rgb_color& base, uint32 flags,
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ HaikuControlLook::DrawMenuBarBackground(BView* view, BRect& rect,
|
|||||||
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
||||||
uint32 borders)
|
uint32 borders)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// the surface edges
|
// the surface edges
|
||||||
@@ -295,7 +295,7 @@ HaikuControlLook::DrawMenuBackground(BView* view, BRect& rect,
|
|||||||
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
||||||
uint32 borders)
|
uint32 borders)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// inner bevel colors
|
// inner bevel colors
|
||||||
@@ -327,7 +327,7 @@ HaikuControlLook::DrawMenuItemBackground(BView* view, BRect& rect,
|
|||||||
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
||||||
uint32 borders)
|
uint32 borders)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// surface edges
|
// surface edges
|
||||||
@@ -366,7 +366,7 @@ void
|
|||||||
HaikuControlLook::DrawStatusBar(BView* view, BRect& rect, const BRect& updateRect,
|
HaikuControlLook::DrawStatusBar(BView* view, BRect& rect, const BRect& updateRect,
|
||||||
const rgb_color& base, const rgb_color& barColor, float progressPosition)
|
const rgb_color& base, const rgb_color& barColor, float progressPosition)
|
||||||
{
|
{
|
||||||
if (!rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_DrawOuterResessedFrame(view, rect, base, 0.6);
|
_DrawOuterResessedFrame(view, rect, base, 0.6);
|
||||||
@@ -419,7 +419,7 @@ void
|
|||||||
HaikuControlLook::DrawCheckBox(BView* view, BRect& rect, const BRect& updateRect,
|
HaikuControlLook::DrawCheckBox(BView* view, BRect& rect, const BRect& updateRect,
|
||||||
const rgb_color& base, uint32 flags)
|
const rgb_color& base, uint32 flags)
|
||||||
{
|
{
|
||||||
if (!rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rgb_color dark1BorderColor;
|
rgb_color dark1BorderColor;
|
||||||
@@ -491,7 +491,7 @@ void
|
|||||||
HaikuControlLook::DrawRadioButton(BView* view, BRect& rect, const BRect& updateRect,
|
HaikuControlLook::DrawRadioButton(BView* view, BRect& rect, const BRect& updateRect,
|
||||||
const rgb_color& base, uint32 flags)
|
const rgb_color& base, uint32 flags)
|
||||||
{
|
{
|
||||||
if (!rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rgb_color borderColor;
|
rgb_color borderColor;
|
||||||
@@ -563,14 +563,13 @@ HaikuControlLook::DrawScrollBarBorder(BView* view, BRect rect,
|
|||||||
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
||||||
orientation orientation)
|
orientation orientation)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
view->PushState();
|
view->PushState();
|
||||||
|
|
||||||
// set clipping constraints to updateRect
|
// set clipping constraints to rect
|
||||||
BRegion clipping(updateRect);
|
view->ClipToRect(rect);
|
||||||
view->ConstrainClippingRegion(&clipping);
|
|
||||||
|
|
||||||
bool isEnabled = (flags & B_DISABLED) == 0;
|
bool isEnabled = (flags & B_DISABLED) == 0;
|
||||||
bool isFocused = (flags & B_FOCUSED) != 0;
|
bool isFocused = (flags & B_FOCUSED) != 0;
|
||||||
@@ -619,12 +618,13 @@ HaikuControlLook::DrawScrollBarButton(BView* view, BRect rect,
|
|||||||
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
||||||
int32 direction, orientation orientation, bool down)
|
int32 direction, orientation orientation, bool down)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
view->PushState();
|
||||||
|
|
||||||
// clip to button
|
// clip to button
|
||||||
BRegion buttonRegion(rect);
|
view->ClipToRect(rect);
|
||||||
view->ConstrainClippingRegion(&buttonRegion);
|
|
||||||
|
|
||||||
bool isEnabled = (flags & B_DISABLED) == 0;
|
bool isEnabled = (flags & B_DISABLED) == 0;
|
||||||
|
|
||||||
@@ -638,8 +638,7 @@ HaikuControlLook::DrawScrollBarButton(BView* view, BRect rect,
|
|||||||
// almost but not quite B_DARKEN_MAX_TINT
|
// almost but not quite B_DARKEN_MAX_TINT
|
||||||
|
|
||||||
// revert clipping constraints
|
// revert clipping constraints
|
||||||
BRegion clipping(updateRect);
|
view->PopState();
|
||||||
view->ConstrainClippingRegion(&clipping);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -657,14 +656,13 @@ HaikuControlLook::DrawScrollBarBackground(BView* view, BRect& rect,
|
|||||||
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
||||||
orientation orientation)
|
orientation orientation)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
view->PushState();
|
view->PushState();
|
||||||
|
|
||||||
// set clipping constraints to updateRect
|
// set clipping constraints to rect
|
||||||
BRegion clipping(updateRect);
|
view->ClipToRect(rect);
|
||||||
view->ConstrainClippingRegion(&clipping);
|
|
||||||
|
|
||||||
bool isEnabled = (flags & B_DISABLED) == 0;
|
bool isEnabled = (flags & B_DISABLED) == 0;
|
||||||
|
|
||||||
@@ -754,14 +752,13 @@ HaikuControlLook::DrawScrollBarThumb(BView* view, BRect& rect,
|
|||||||
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
||||||
orientation orientation, uint32 knobStyle)
|
orientation orientation, uint32 knobStyle)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
view->PushState();
|
view->PushState();
|
||||||
|
|
||||||
// set clipping constraints to updateRect
|
// set clipping constraints to rect
|
||||||
BRegion clipping(updateRect);
|
view->ClipToRect(rect);
|
||||||
view->ConstrainClippingRegion(&clipping);
|
|
||||||
|
|
||||||
// flags
|
// flags
|
||||||
bool isEnabled = (flags & B_DISABLED) == 0;
|
bool isEnabled = (flags & B_DISABLED) == 0;
|
||||||
@@ -1117,12 +1114,9 @@ HaikuControlLook::DrawSliderBar(BView* view, BRect rect, const BRect& updateRect
|
|||||||
const rgb_color& base, rgb_color leftFillColor, rgb_color rightFillColor,
|
const rgb_color& base, rgb_color leftFillColor, rgb_color rightFillColor,
|
||||||
float sliderScale, uint32 flags, orientation orientation)
|
float sliderScale, uint32 flags, orientation orientation)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// save the clipping constraints of the view
|
|
||||||
view->PushState();
|
|
||||||
|
|
||||||
// separate the bar in two sides
|
// separate the bar in two sides
|
||||||
float sliderPosition;
|
float sliderPosition;
|
||||||
BRect leftBarSide = rect;
|
BRect leftBarSide = rect;
|
||||||
@@ -1141,30 +1135,16 @@ HaikuControlLook::DrawSliderBar(BView* view, BRect rect, const BRect& updateRect
|
|||||||
rightBarSide.bottom = sliderPosition - 1;
|
rightBarSide.bottom = sliderPosition - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fill the background for the corners, exclude the middle bar for now
|
|
||||||
BRegion region(rect);
|
|
||||||
region.Exclude(rightBarSide);
|
|
||||||
view->ConstrainClippingRegion(®ion);
|
|
||||||
|
|
||||||
view->PushState();
|
view->PushState();
|
||||||
|
view->ClipToRect(leftBarSide);
|
||||||
DrawSliderBar(view, rect, updateRect, base, leftFillColor, flags,
|
DrawSliderBar(view, rect, updateRect, base, leftFillColor, flags,
|
||||||
orientation);
|
orientation);
|
||||||
|
|
||||||
view->PopState();
|
view->PopState();
|
||||||
|
|
||||||
region.Set(rect);
|
|
||||||
region.Exclude(leftBarSide);
|
|
||||||
view->ConstrainClippingRegion(®ion);
|
|
||||||
|
|
||||||
view->PushState();
|
view->PushState();
|
||||||
|
view->ClipToRect(rightBarSide);
|
||||||
DrawSliderBar(view, rect, updateRect, base, rightFillColor, flags,
|
DrawSliderBar(view, rect, updateRect, base, rightFillColor, flags,
|
||||||
orientation);
|
orientation);
|
||||||
|
|
||||||
view->PopState();
|
|
||||||
|
|
||||||
// restore the clipping constraints of the view
|
|
||||||
view->PopState();
|
view->PopState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1174,7 +1154,7 @@ HaikuControlLook::DrawSliderBar(BView* view, BRect rect, const BRect& updateRect
|
|||||||
const rgb_color& base, rgb_color fillColor, uint32 flags,
|
const rgb_color& base, rgb_color fillColor, uint32 flags,
|
||||||
orientation orientation)
|
orientation orientation)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// separate the rect into corners
|
// separate the rect into corners
|
||||||
@@ -1195,9 +1175,9 @@ HaikuControlLook::DrawSliderBar(BView* view, BRect rect, const BRect& updateRect
|
|||||||
}
|
}
|
||||||
|
|
||||||
// fill the background for the corners, exclude the middle bar for now
|
// fill the background for the corners, exclude the middle bar for now
|
||||||
BRegion region(rect);
|
view->PushState();
|
||||||
region.Exclude(barRect);
|
view->ClipToRect(rect);
|
||||||
view->ConstrainClippingRegion(®ion);
|
view->ClipToInverseRect(barRect);
|
||||||
|
|
||||||
if ((flags & B_BLEND_FRAME) == 0) {
|
if ((flags & B_BLEND_FRAME) == 0) {
|
||||||
view->SetHighColor(base);
|
view->SetHighColor(base);
|
||||||
@@ -1285,7 +1265,9 @@ HaikuControlLook::DrawSliderBar(BView* view, BRect rect, const BRect& updateRect
|
|||||||
fillShadowColor, 1.0, 0.0, -1.0, -1.0, orientation);
|
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);
|
view->BeginLineArray(4);
|
||||||
if (orientation == B_HORIZONTAL) {
|
if (orientation == B_HORIZONTAL) {
|
||||||
@@ -1324,7 +1306,7 @@ void
|
|||||||
HaikuControlLook::DrawSliderThumb(BView* view, BRect& rect, const BRect& updateRect,
|
HaikuControlLook::DrawSliderThumb(BView* view, BRect& rect, const BRect& updateRect,
|
||||||
const rgb_color& base, uint32 flags, orientation orientation)
|
const rgb_color& base, uint32 flags, orientation orientation)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// figure out frame color
|
// figure out frame color
|
||||||
@@ -1418,7 +1400,7 @@ HaikuControlLook::DrawSliderTriangle(BView* view, BRect& rect,
|
|||||||
const BRect& updateRect, const rgb_color& base, const rgb_color& fill,
|
const BRect& updateRect, const rgb_color& base, const rgb_color& fill,
|
||||||
uint32 flags, orientation orientation)
|
uint32 flags, orientation orientation)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// figure out frame color
|
// figure out frame color
|
||||||
@@ -1536,7 +1518,7 @@ HaikuControlLook::DrawSliderHashMarks(BView* view, BRect& rect,
|
|||||||
const BRect& updateRect, const rgb_color& base, int32 count,
|
const BRect& updateRect, const rgb_color& base, int32 count,
|
||||||
hash_mark_location location, uint32 flags, orientation orientation)
|
hash_mark_location location, uint32 flags, orientation orientation)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rgb_color lightColor;
|
rgb_color lightColor;
|
||||||
@@ -1626,7 +1608,7 @@ HaikuControlLook::DrawTabFrame(BView* view, BRect& rect,
|
|||||||
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
||||||
uint32 borders, border_style borderStyle, uint32 side)
|
uint32 borders, border_style borderStyle, uint32 side)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (side == BTabView::kTopSide || side == BTabView::kBottomSide) {
|
if (side == BTabView::kTopSide || side == BTabView::kBottomSide) {
|
||||||
@@ -1660,7 +1642,7 @@ HaikuControlLook::DrawActiveTab(BView* view, BRect& rect,
|
|||||||
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
||||||
uint32 borders, uint32 side, int32, int32, int32, int32)
|
uint32 borders, uint32 side, int32, int32, int32, int32)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Snap the rectangle to pixels to avoid rounding errors.
|
// Snap the rectangle to pixels to avoid rounding errors.
|
||||||
@@ -1672,9 +1654,8 @@ HaikuControlLook::DrawActiveTab(BView* view, BRect& rect,
|
|||||||
// save the clipping constraints of the view
|
// save the clipping constraints of the view
|
||||||
view->PushState();
|
view->PushState();
|
||||||
|
|
||||||
// set clipping constraints to updateRect
|
// set clipping constraints to rect
|
||||||
BRegion clipping(updateRect);
|
view->ClipToRect(rect);
|
||||||
view->ConstrainClippingRegion(&clipping);
|
|
||||||
|
|
||||||
rgb_color edgeShadowColor;
|
rgb_color edgeShadowColor;
|
||||||
rgb_color edgeLightColor;
|
rgb_color edgeLightColor;
|
||||||
@@ -1729,10 +1710,12 @@ HaikuControlLook::DrawActiveTab(BView* view, BRect& rect,
|
|||||||
- kRoundCornerRadius);
|
- kRoundCornerRadius);
|
||||||
rightBottomCorner.top = floorf(rect.bottom - kRoundCornerRadius);
|
rightBottomCorner.top = floorf(rect.bottom - kRoundCornerRadius);
|
||||||
|
|
||||||
|
BRect roundCorner[2];
|
||||||
|
|
||||||
switch (side) {
|
switch (side) {
|
||||||
case B_TOP_BORDER:
|
case B_TOP_BORDER:
|
||||||
clipping.Exclude(leftTopCorner);
|
roundCorner[0] = leftTopCorner;
|
||||||
clipping.Exclude(rightTopCorner);
|
roundCorner[1] = rightTopCorner;
|
||||||
|
|
||||||
// draw the left top corner
|
// draw the left top corner
|
||||||
_DrawRoundCornerLeftTop(view, leftTopCorner, updateRect, base,
|
_DrawRoundCornerLeftTop(view, leftTopCorner, updateRect, base,
|
||||||
@@ -1745,8 +1728,8 @@ HaikuControlLook::DrawActiveTab(BView* view, BRect& rect,
|
|||||||
fillGradient);
|
fillGradient);
|
||||||
break;
|
break;
|
||||||
case B_BOTTOM_BORDER:
|
case B_BOTTOM_BORDER:
|
||||||
clipping.Exclude(leftBottomCorner);
|
roundCorner[0] = leftBottomCorner;
|
||||||
clipping.Exclude(rightBottomCorner);
|
roundCorner[1] = rightBottomCorner;
|
||||||
|
|
||||||
// draw the left bottom corner
|
// draw the left bottom corner
|
||||||
_DrawRoundCornerLeftBottom(view, leftBottomCorner, updateRect, base,
|
_DrawRoundCornerLeftBottom(view, leftBottomCorner, updateRect, base,
|
||||||
@@ -1759,8 +1742,8 @@ HaikuControlLook::DrawActiveTab(BView* view, BRect& rect,
|
|||||||
fillGradient);
|
fillGradient);
|
||||||
break;
|
break;
|
||||||
case B_LEFT_BORDER:
|
case B_LEFT_BORDER:
|
||||||
clipping.Exclude(leftTopCorner);
|
roundCorner[0] = leftTopCorner;
|
||||||
clipping.Exclude(leftBottomCorner);
|
roundCorner[1] = leftBottomCorner;
|
||||||
|
|
||||||
// draw the left top corner
|
// draw the left top corner
|
||||||
_DrawRoundCornerLeftTop(view, leftTopCorner, updateRect, base,
|
_DrawRoundCornerLeftTop(view, leftTopCorner, updateRect, base,
|
||||||
@@ -1773,8 +1756,8 @@ HaikuControlLook::DrawActiveTab(BView* view, BRect& rect,
|
|||||||
fillGradient);
|
fillGradient);
|
||||||
break;
|
break;
|
||||||
case B_RIGHT_BORDER:
|
case B_RIGHT_BORDER:
|
||||||
clipping.Exclude(rightTopCorner);
|
roundCorner[0] = rightTopCorner;
|
||||||
clipping.Exclude(rightBottomCorner);
|
roundCorner[1] = rightBottomCorner;
|
||||||
|
|
||||||
// draw the right top corner
|
// draw the right top corner
|
||||||
_DrawRoundCornerRightTop(view, rightTopCorner, updateRect, base,
|
_DrawRoundCornerRightTop(view, rightTopCorner, updateRect, base,
|
||||||
@@ -1789,7 +1772,8 @@ HaikuControlLook::DrawActiveTab(BView* view, BRect& rect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// clip out the corners
|
// clip out the corners
|
||||||
view->ConstrainClippingRegion(&clipping);
|
view->ClipToInverseRect(roundCorner[0]);
|
||||||
|
view->ClipToInverseRect(roundCorner[1]);
|
||||||
|
|
||||||
uint32 bordersToDraw = 0;
|
uint32 bordersToDraw = 0;
|
||||||
switch (side) {
|
switch (side) {
|
||||||
@@ -1840,7 +1824,7 @@ HaikuControlLook::DrawInactiveTab(BView* view, BRect& rect,
|
|||||||
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
||||||
uint32 borders, uint32 side, int32, int32, int32, int32)
|
uint32 borders, uint32 side, int32, int32, int32, int32)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rgb_color edgeShadowColor;
|
rgb_color edgeShadowColor;
|
||||||
@@ -1942,7 +1926,7 @@ HaikuControlLook::DrawSplitter(BView* view, BRect& rect, const BRect& updateRect
|
|||||||
const rgb_color& base, orientation orientation, uint32 flags,
|
const rgb_color& base, orientation orientation, uint32 flags,
|
||||||
uint32 borders)
|
uint32 borders)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rgb_color background;
|
rgb_color background;
|
||||||
@@ -2102,7 +2086,7 @@ HaikuControlLook::DrawTextControlBorder(BView* view, BRect& rect,
|
|||||||
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
||||||
uint32 borders)
|
uint32 borders)
|
||||||
{
|
{
|
||||||
if (!rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rgb_color dark1BorderColor;
|
rgb_color dark1BorderColor;
|
||||||
@@ -2333,7 +2317,7 @@ HaikuControlLook::DrawLabel(BView* view, const char* label, const BBitmap* icon,
|
|||||||
BRect rect, const BRect& updateRect, const rgb_color& base, uint32 flags,
|
BRect rect, const BRect& updateRect, const rgb_color& base, uint32 flags,
|
||||||
const BAlignment& alignment, const rgb_color* textColor)
|
const BAlignment& alignment, const rgb_color* textColor)
|
||||||
{
|
{
|
||||||
if (!rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (label == NULL && icon == NULL)
|
if (label == NULL && icon == NULL)
|
||||||
@@ -2521,9 +2505,8 @@ HaikuControlLook::_DrawButtonFrame(BView* view, BRect& rect,
|
|||||||
// save the clipping constraints of the view
|
// save the clipping constraints of the view
|
||||||
view->PushState();
|
view->PushState();
|
||||||
|
|
||||||
// set clipping constraints to updateRect
|
// set clipping constraints to rect
|
||||||
BRegion clipping(updateRect);
|
view->ClipToRect(rect);
|
||||||
view->ConstrainClippingRegion(&clipping);
|
|
||||||
|
|
||||||
// If the button is flat and neither activated nor otherwise highlighted
|
// If the button is flat and neither activated nor otherwise highlighted
|
||||||
// (mouse hovering or focussed), draw it flat.
|
// (mouse hovering or focussed), draw it flat.
|
||||||
@@ -2602,9 +2585,10 @@ HaikuControlLook::_DrawButtonFrame(BView* view, BRect& rect,
|
|||||||
BRect leftTopCorner(floorf(rect.left), floorf(rect.top),
|
BRect leftTopCorner(floorf(rect.left), floorf(rect.top),
|
||||||
floorf(rect.left + leftTopRadius),
|
floorf(rect.left + leftTopRadius),
|
||||||
floorf(rect.top + leftTopRadius));
|
floorf(rect.top + leftTopRadius));
|
||||||
clipping.Exclude(leftTopCorner);
|
BRect cornerRect(leftTopCorner);
|
||||||
_DrawRoundCornerFrameLeftTop(view, leftTopCorner, updateRect,
|
_DrawRoundCornerFrameLeftTop(view, leftTopCorner, updateRect,
|
||||||
cornerBgColor, edgeShadowColor, frameLightColor);
|
cornerBgColor, edgeShadowColor, frameLightColor);
|
||||||
|
view->ClipToInverseRect(cornerRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((borders & B_TOP_BORDER) != 0 && (borders & B_RIGHT_BORDER) != 0
|
if ((borders & B_TOP_BORDER) != 0 && (borders & B_RIGHT_BORDER) != 0
|
||||||
@@ -2613,10 +2597,11 @@ HaikuControlLook::_DrawButtonFrame(BView* view, BRect& rect,
|
|||||||
BRect rightTopCorner(floorf(rect.right - rightTopRadius),
|
BRect rightTopCorner(floorf(rect.right - rightTopRadius),
|
||||||
floorf(rect.top), floorf(rect.right),
|
floorf(rect.top), floorf(rect.right),
|
||||||
floorf(rect.top + rightTopRadius));
|
floorf(rect.top + rightTopRadius));
|
||||||
clipping.Exclude(rightTopCorner);
|
BRect cornerRect(rightTopCorner);
|
||||||
_DrawRoundCornerFrameRightTop(view, rightTopCorner, updateRect,
|
_DrawRoundCornerFrameRightTop(view, rightTopCorner, updateRect,
|
||||||
cornerBgColor, edgeShadowColor, edgeLightColor,
|
cornerBgColor, edgeShadowColor, edgeLightColor,
|
||||||
frameLightColor, frameShadowColor);
|
frameLightColor, frameShadowColor);
|
||||||
|
view->ClipToInverseRect(cornerRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((borders & B_LEFT_BORDER) != 0 && (borders & B_BOTTOM_BORDER) != 0
|
if ((borders & B_LEFT_BORDER) != 0 && (borders & B_BOTTOM_BORDER) != 0
|
||||||
@@ -2625,10 +2610,11 @@ HaikuControlLook::_DrawButtonFrame(BView* view, BRect& rect,
|
|||||||
BRect leftBottomCorner(floorf(rect.left),
|
BRect leftBottomCorner(floorf(rect.left),
|
||||||
floorf(rect.bottom - leftBottomRadius),
|
floorf(rect.bottom - leftBottomRadius),
|
||||||
floorf(rect.left + leftBottomRadius), floorf(rect.bottom));
|
floorf(rect.left + leftBottomRadius), floorf(rect.bottom));
|
||||||
clipping.Exclude(leftBottomCorner);
|
BRect cornerRect(leftBottomCorner);
|
||||||
_DrawRoundCornerFrameLeftBottom(view, leftBottomCorner, updateRect,
|
_DrawRoundCornerFrameLeftBottom(view, leftBottomCorner, updateRect,
|
||||||
cornerBgColor, edgeShadowColor, edgeLightColor,
|
cornerBgColor, edgeShadowColor, edgeLightColor,
|
||||||
frameLightColor, frameShadowColor);
|
frameLightColor, frameShadowColor);
|
||||||
|
view->ClipToInverseRect(cornerRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((borders & B_RIGHT_BORDER) != 0 && (borders & B_BOTTOM_BORDER) != 0
|
if ((borders & B_RIGHT_BORDER) != 0 && (borders & B_BOTTOM_BORDER) != 0
|
||||||
@@ -2637,14 +2623,12 @@ HaikuControlLook::_DrawButtonFrame(BView* view, BRect& rect,
|
|||||||
BRect rightBottomCorner(floorf(rect.right - rightBottomRadius),
|
BRect rightBottomCorner(floorf(rect.right - rightBottomRadius),
|
||||||
floorf(rect.bottom - rightBottomRadius), floorf(rect.right),
|
floorf(rect.bottom - rightBottomRadius), floorf(rect.right),
|
||||||
floorf(rect.bottom));
|
floorf(rect.bottom));
|
||||||
clipping.Exclude(rightBottomCorner);
|
BRect cornerRect(rightBottomCorner);
|
||||||
_DrawRoundCornerFrameRightBottom(view, rightBottomCorner,
|
_DrawRoundCornerFrameRightBottom(view, rightBottomCorner,
|
||||||
updateRect, cornerBgColor, edgeLightColor, frameShadowColor);
|
updateRect, cornerBgColor, edgeLightColor, frameShadowColor);
|
||||||
|
view->ClipToInverseRect(cornerRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clip out the corners
|
|
||||||
view->ConstrainClippingRegion(&clipping);
|
|
||||||
|
|
||||||
// draw outer edge
|
// draw outer edge
|
||||||
if ((flags & B_DEFAULT_BUTTON) != 0) {
|
if ((flags & B_DEFAULT_BUTTON) != 0) {
|
||||||
_DrawOuterResessedFrame(view, rect, defaultIndicatorColor,
|
_DrawOuterResessedFrame(view, rect, defaultIndicatorColor,
|
||||||
@@ -2803,9 +2787,8 @@ HaikuControlLook::_DrawButtonBackground(BView* view, BRect& rect,
|
|||||||
// save the clipping constraints of the view
|
// save the clipping constraints of the view
|
||||||
view->PushState();
|
view->PushState();
|
||||||
|
|
||||||
// set clipping constraints to updateRect
|
// set clipping constraints to rect
|
||||||
BRegion clipping(updateRect);
|
view->ClipToRect(rect);
|
||||||
view->ConstrainClippingRegion(&clipping);
|
|
||||||
|
|
||||||
// If the button is flat and neither activated nor otherwise highlighted
|
// If the button is flat and neither activated nor otherwise highlighted
|
||||||
// (mouse hovering or focussed), draw it flat.
|
// (mouse hovering or focussed), draw it flat.
|
||||||
@@ -2816,6 +2799,7 @@ HaikuControlLook::_DrawButtonBackground(BView* view, BRect& rect,
|
|||||||
_DrawFlatButtonBackground(view, rect, updateRect, base, popupIndicator,
|
_DrawFlatButtonBackground(view, rect, updateRect, base, popupIndicator,
|
||||||
flags, borders, orientation);
|
flags, borders, orientation);
|
||||||
} else {
|
} else {
|
||||||
|
BRegion clipping(rect);
|
||||||
_DrawNonFlatButtonBackground(view, rect, updateRect, clipping,
|
_DrawNonFlatButtonBackground(view, rect, updateRect, clipping,
|
||||||
leftTopRadius, rightTopRadius, leftBottomRadius, rightBottomRadius,
|
leftTopRadius, rightTopRadius, leftBottomRadius, rightBottomRadius,
|
||||||
base, popupIndicator, flags, borders, orientation);
|
base, popupIndicator, flags, borders, orientation);
|
||||||
@@ -2882,8 +2866,10 @@ HaikuControlLook::_DrawNonFlatButtonBackground(BView* view, BRect& rect,
|
|||||||
floorf(rect.left + leftTopRadius - 2.0),
|
floorf(rect.left + leftTopRadius - 2.0),
|
||||||
floorf(rect.top + leftTopRadius - 2.0));
|
floorf(rect.top + leftTopRadius - 2.0));
|
||||||
clipping.Exclude(leftTopCorner);
|
clipping.Exclude(leftTopCorner);
|
||||||
|
BRect cornerRect(leftTopCorner);
|
||||||
_DrawRoundCornerBackgroundLeftTop(view, leftTopCorner, updateRect,
|
_DrawRoundCornerBackgroundLeftTop(view, leftTopCorner, updateRect,
|
||||||
bevelLightColor, fillGradient);
|
bevelLightColor, fillGradient);
|
||||||
|
view->ClipToInverseRect(cornerRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((borders & B_TOP_BORDER) != 0 && (borders & B_RIGHT_BORDER) != 0
|
if ((borders & B_TOP_BORDER) != 0 && (borders & B_RIGHT_BORDER) != 0
|
||||||
@@ -2893,8 +2879,10 @@ HaikuControlLook::_DrawNonFlatButtonBackground(BView* view, BRect& rect,
|
|||||||
floorf(rect.top), floorf(rect.right),
|
floorf(rect.top), floorf(rect.right),
|
||||||
floorf(rect.top + rightTopRadius - 2.0));
|
floorf(rect.top + rightTopRadius - 2.0));
|
||||||
clipping.Exclude(rightTopCorner);
|
clipping.Exclude(rightTopCorner);
|
||||||
|
BRect cornerRect(rightTopCorner);
|
||||||
_DrawRoundCornerBackgroundRightTop(view, rightTopCorner,
|
_DrawRoundCornerBackgroundRightTop(view, rightTopCorner,
|
||||||
updateRect, bevelLightColor, bevelShadowColor, fillGradient);
|
updateRect, bevelLightColor, bevelShadowColor, fillGradient);
|
||||||
|
view->ClipToInverseRect(cornerRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((borders & B_LEFT_BORDER) != 0 && (borders & B_BOTTOM_BORDER) != 0
|
if ((borders & B_LEFT_BORDER) != 0 && (borders & B_BOTTOM_BORDER) != 0
|
||||||
@@ -2905,8 +2893,10 @@ HaikuControlLook::_DrawNonFlatButtonBackground(BView* view, BRect& rect,
|
|||||||
floorf(rect.left + leftBottomRadius - 2.0),
|
floorf(rect.left + leftBottomRadius - 2.0),
|
||||||
floorf(rect.bottom));
|
floorf(rect.bottom));
|
||||||
clipping.Exclude(leftBottomCorner);
|
clipping.Exclude(leftBottomCorner);
|
||||||
|
BRect cornerRect(leftBottomCorner);
|
||||||
_DrawRoundCornerBackgroundLeftBottom(view, leftBottomCorner,
|
_DrawRoundCornerBackgroundLeftBottom(view, leftBottomCorner,
|
||||||
updateRect, bevelLightColor, bevelShadowColor, fillGradient);
|
updateRect, bevelLightColor, bevelShadowColor, fillGradient);
|
||||||
|
view->ClipToInverseRect(cornerRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((borders & B_RIGHT_BORDER) != 0 && (borders & B_BOTTOM_BORDER) != 0
|
if ((borders & B_RIGHT_BORDER) != 0 && (borders & B_BOTTOM_BORDER) != 0
|
||||||
@@ -2916,13 +2906,12 @@ HaikuControlLook::_DrawNonFlatButtonBackground(BView* view, BRect& rect,
|
|||||||
floorf(rect.bottom - rightBottomRadius + 2.0), floorf(rect.right),
|
floorf(rect.bottom - rightBottomRadius + 2.0), floorf(rect.right),
|
||||||
floorf(rect.bottom));
|
floorf(rect.bottom));
|
||||||
clipping.Exclude(rightBottomCorner);
|
clipping.Exclude(rightBottomCorner);
|
||||||
|
BRect cornerRect(rightBottomCorner);
|
||||||
_DrawRoundCornerBackgroundRightBottom(view, rightBottomCorner,
|
_DrawRoundCornerBackgroundRightBottom(view, rightBottomCorner,
|
||||||
updateRect, bevelShadowColor, fillGradient);
|
updateRect, bevelShadowColor, fillGradient);
|
||||||
|
view->ClipToInverseRect(cornerRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clip out the corners
|
|
||||||
view->ConstrainClippingRegion(&clipping);
|
|
||||||
|
|
||||||
// draw inner bevel
|
// draw inner bevel
|
||||||
|
|
||||||
if ((flags & B_ACTIVATED) != 0) {
|
if ((flags & B_ACTIVATED) != 0) {
|
||||||
@@ -3042,7 +3031,7 @@ HaikuControlLook::_DrawMenuFieldBackgroundOutside(BView* view, BRect& rect,
|
|||||||
float leftBottomRadius, float rightBottomRadius, const rgb_color& base,
|
float leftBottomRadius, float rightBottomRadius, const rgb_color& base,
|
||||||
bool popupIndicator, uint32 flags)
|
bool popupIndicator, uint32 flags)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (popupIndicator) {
|
if (popupIndicator) {
|
||||||
@@ -3091,15 +3080,14 @@ HaikuControlLook::_DrawMenuFieldBackgroundInside(BView* view, BRect& rect,
|
|||||||
float leftBottomRadius, float rightBottomRadius, const rgb_color& base,
|
float leftBottomRadius, float rightBottomRadius, const rgb_color& base,
|
||||||
uint32 flags, uint32 borders)
|
uint32 flags, uint32 borders)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// save the clipping constraints of the view
|
// save the clipping constraints of the view
|
||||||
view->PushState();
|
view->PushState();
|
||||||
|
|
||||||
// set clipping constraints to updateRect
|
// set clipping constraints to rect
|
||||||
BRegion clipping(updateRect);
|
view->ClipToRect(rect);
|
||||||
view->ConstrainClippingRegion(&clipping);
|
|
||||||
|
|
||||||
// frame colors
|
// frame colors
|
||||||
rgb_color frameLightColor = _FrameLightColor(base, flags);
|
rgb_color frameLightColor = _FrameLightColor(base, flags);
|
||||||
@@ -3146,10 +3134,10 @@ HaikuControlLook::_DrawMenuFieldBackgroundInside(BView* view, BRect& rect,
|
|||||||
BRect leftTopCorner(floorf(rect.left), floorf(rect.top),
|
BRect leftTopCorner(floorf(rect.left), floorf(rect.top),
|
||||||
floorf(rect.left + leftTopRadius - 2.0),
|
floorf(rect.left + leftTopRadius - 2.0),
|
||||||
floorf(rect.top + leftTopRadius - 2.0));
|
floorf(rect.top + leftTopRadius - 2.0));
|
||||||
clipping.Exclude(leftTopCorner);
|
BRect cornerRect(leftTopCorner);
|
||||||
|
|
||||||
BRegion cornerClipping(leftTopCorner);
|
view->PushState();
|
||||||
view->ConstrainClippingRegion(&cornerClipping);
|
view->ClipToRect(cornerRect);
|
||||||
|
|
||||||
BRect ellipseRect(leftTopCorner);
|
BRect ellipseRect(leftTopCorner);
|
||||||
ellipseRect.InsetBy(-1.0, -1.0);
|
ellipseRect.InsetBy(-1.0, -1.0);
|
||||||
@@ -3163,6 +3151,9 @@ HaikuControlLook::_DrawMenuFieldBackgroundInside(BView* view, BRect& rect,
|
|||||||
// draw the bevel and background
|
// draw the bevel and background
|
||||||
_DrawRoundCornerBackgroundLeftTop(view, leftTopCorner, updateRect,
|
_DrawRoundCornerBackgroundLeftTop(view, leftTopCorner, updateRect,
|
||||||
bevelColor1, fillGradient);
|
bevelColor1, fillGradient);
|
||||||
|
|
||||||
|
view->PopState();
|
||||||
|
view->ClipToInverseRect(cornerRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((borders & B_TOP_BORDER) != 0 && (borders & B_RIGHT_BORDER) != 0
|
if ((borders & B_TOP_BORDER) != 0 && (borders & B_RIGHT_BORDER) != 0
|
||||||
@@ -3171,10 +3162,10 @@ HaikuControlLook::_DrawMenuFieldBackgroundInside(BView* view, BRect& rect,
|
|||||||
BRect rightTopCorner(floorf(rect.right - rightTopRadius + 2.0),
|
BRect rightTopCorner(floorf(rect.right - rightTopRadius + 2.0),
|
||||||
floorf(rect.top), floorf(rect.right),
|
floorf(rect.top), floorf(rect.right),
|
||||||
floorf(rect.top + rightTopRadius - 2.0));
|
floorf(rect.top + rightTopRadius - 2.0));
|
||||||
clipping.Exclude(rightTopCorner);
|
BRect cornerRect(rightTopCorner);
|
||||||
|
|
||||||
BRegion cornerClipping(rightTopCorner);
|
view->PushState();
|
||||||
view->ConstrainClippingRegion(&cornerClipping);
|
view->ClipToRect(cornerRect);
|
||||||
|
|
||||||
BRect ellipseRect(rightTopCorner);
|
BRect ellipseRect(rightTopCorner);
|
||||||
ellipseRect.InsetBy(-1.0, -1.0);
|
ellipseRect.InsetBy(-1.0, -1.0);
|
||||||
@@ -3197,6 +3188,9 @@ HaikuControlLook::_DrawMenuFieldBackgroundInside(BView* view, BRect& rect,
|
|||||||
// draw the bevel and background
|
// draw the bevel and background
|
||||||
_DrawRoundCornerBackgroundRightTop(view, rightTopCorner, updateRect,
|
_DrawRoundCornerBackgroundRightTop(view, rightTopCorner, updateRect,
|
||||||
bevelColor1, bevelColor3, fillGradient);
|
bevelColor1, bevelColor3, fillGradient);
|
||||||
|
|
||||||
|
view->PopState();
|
||||||
|
view->ClipToInverseRect(cornerRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((borders & B_LEFT_BORDER) != 0 && (borders & B_BOTTOM_BORDER) != 0
|
if ((borders & B_LEFT_BORDER) != 0 && (borders & B_BOTTOM_BORDER) != 0
|
||||||
@@ -3206,10 +3200,10 @@ HaikuControlLook::_DrawMenuFieldBackgroundInside(BView* view, BRect& rect,
|
|||||||
floorf(rect.bottom - leftBottomRadius + 2.0),
|
floorf(rect.bottom - leftBottomRadius + 2.0),
|
||||||
floorf(rect.left + leftBottomRadius - 2.0),
|
floorf(rect.left + leftBottomRadius - 2.0),
|
||||||
floorf(rect.bottom));
|
floorf(rect.bottom));
|
||||||
clipping.Exclude(leftBottomCorner);
|
BRect cornerRect(leftBottomCorner);
|
||||||
|
|
||||||
BRegion cornerClipping(leftBottomCorner);
|
view->PushState();
|
||||||
view->ConstrainClippingRegion(&cornerClipping);
|
view->ClipToRect(cornerRect);
|
||||||
|
|
||||||
BRect ellipseRect(leftBottomCorner);
|
BRect ellipseRect(leftBottomCorner);
|
||||||
ellipseRect.InsetBy(-1.0, -1.0);
|
ellipseRect.InsetBy(-1.0, -1.0);
|
||||||
@@ -3232,6 +3226,9 @@ HaikuControlLook::_DrawMenuFieldBackgroundInside(BView* view, BRect& rect,
|
|||||||
// draw the bevel and background
|
// draw the bevel and background
|
||||||
_DrawRoundCornerBackgroundLeftBottom(view, leftBottomCorner,
|
_DrawRoundCornerBackgroundLeftBottom(view, leftBottomCorner,
|
||||||
updateRect, bevelColor2, bevelColor3, fillGradient);
|
updateRect, bevelColor2, bevelColor3, fillGradient);
|
||||||
|
|
||||||
|
view->PopState();
|
||||||
|
view->ClipToInverseRect(cornerRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((borders & B_RIGHT_BORDER) != 0 && (borders & B_BOTTOM_BORDER) != 0
|
if ((borders & B_RIGHT_BORDER) != 0 && (borders & B_BOTTOM_BORDER) != 0
|
||||||
@@ -3240,10 +3237,10 @@ HaikuControlLook::_DrawMenuFieldBackgroundInside(BView* view, BRect& rect,
|
|||||||
BRect rightBottomCorner(floorf(rect.right - rightBottomRadius + 2.0),
|
BRect rightBottomCorner(floorf(rect.right - rightBottomRadius + 2.0),
|
||||||
floorf(rect.bottom - rightBottomRadius + 2.0), floorf(rect.right),
|
floorf(rect.bottom - rightBottomRadius + 2.0), floorf(rect.right),
|
||||||
floorf(rect.bottom));
|
floorf(rect.bottom));
|
||||||
clipping.Exclude(rightBottomCorner);
|
BRect cornerRect(rightBottomCorner);
|
||||||
|
|
||||||
BRegion cornerClipping(rightBottomCorner);
|
view->PushState();
|
||||||
view->ConstrainClippingRegion(&cornerClipping);
|
view->ClipToRect(cornerRect);
|
||||||
|
|
||||||
BRect ellipseRect(rightBottomCorner);
|
BRect ellipseRect(rightBottomCorner);
|
||||||
ellipseRect.InsetBy(-1.0, -1.0);
|
ellipseRect.InsetBy(-1.0, -1.0);
|
||||||
@@ -3257,10 +3254,10 @@ HaikuControlLook::_DrawMenuFieldBackgroundInside(BView* view, BRect& rect,
|
|||||||
// draw the bevel and background
|
// draw the bevel and background
|
||||||
_DrawRoundCornerBackgroundRightBottom(view, rightBottomCorner,
|
_DrawRoundCornerBackgroundRightBottom(view, rightBottomCorner,
|
||||||
updateRect, bevelColor3, fillGradient);
|
updateRect, bevelColor3, fillGradient);
|
||||||
}
|
|
||||||
|
|
||||||
// clip out the corners
|
view->PopState();
|
||||||
view->ConstrainClippingRegion(&clipping);
|
view->ClipToInverseRect(cornerRect);
|
||||||
|
}
|
||||||
|
|
||||||
// draw the bevel
|
// draw the bevel
|
||||||
_DrawFrame(view, rect,
|
_DrawFrame(view, rect,
|
||||||
@@ -3295,9 +3292,10 @@ HaikuControlLook::_DrawRoundCornerFrameLeftTop(BView* view, BRect& cornerRect,
|
|||||||
const BRect& updateRect, const rgb_color& background,
|
const BRect& updateRect, const rgb_color& background,
|
||||||
const rgb_color& edgeColor, const rgb_color& frameColor)
|
const rgb_color& edgeColor, const rgb_color& frameColor)
|
||||||
{
|
{
|
||||||
|
view->PushState();
|
||||||
|
|
||||||
// constrain clipping region to corner
|
// constrain clipping region to corner
|
||||||
BRegion clipping(cornerRect);
|
view->ClipToRect(cornerRect);
|
||||||
view->ConstrainClippingRegion(&clipping);
|
|
||||||
|
|
||||||
// background
|
// background
|
||||||
view->SetHighColor(background);
|
view->SetHighColor(background);
|
||||||
@@ -3321,6 +3319,8 @@ HaikuControlLook::_DrawRoundCornerFrameLeftTop(BView* view, BRect& cornerRect,
|
|||||||
// prepare for bevel
|
// prepare for bevel
|
||||||
cornerRect.left++;
|
cornerRect.left++;
|
||||||
cornerRect.top++;
|
cornerRect.top++;
|
||||||
|
|
||||||
|
view->PopState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3329,9 +3329,10 @@ HaikuControlLook::_DrawRoundCornerBackgroundLeftTop(BView* view, BRect& cornerRe
|
|||||||
const BRect& updateRect, const rgb_color& bevelColor,
|
const BRect& updateRect, const rgb_color& bevelColor,
|
||||||
const BGradientLinear& fillGradient)
|
const BGradientLinear& fillGradient)
|
||||||
{
|
{
|
||||||
|
view->PushState();
|
||||||
|
|
||||||
// constrain clipping region to corner
|
// constrain clipping region to corner
|
||||||
BRegion clipping(cornerRect);
|
view->ClipToRect(cornerRect);
|
||||||
view->ConstrainClippingRegion(&clipping);
|
|
||||||
|
|
||||||
BRect ellipseRect(cornerRect);
|
BRect ellipseRect(cornerRect);
|
||||||
ellipseRect.right = ellipseRect.left + ellipseRect.Width() * 2;
|
ellipseRect.right = ellipseRect.left + ellipseRect.Width() * 2;
|
||||||
@@ -3344,6 +3345,8 @@ HaikuControlLook::_DrawRoundCornerBackgroundLeftTop(BView* view, BRect& cornerRe
|
|||||||
// gradient
|
// gradient
|
||||||
ellipseRect.InsetBy(1, 1);
|
ellipseRect.InsetBy(1, 1);
|
||||||
view->FillEllipse(ellipseRect, fillGradient);
|
view->FillEllipse(ellipseRect, fillGradient);
|
||||||
|
|
||||||
|
view->PopState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3369,9 +3372,10 @@ HaikuControlLook::_DrawRoundCornerFrameRightTop(BView* view, BRect& cornerRect,
|
|||||||
const rgb_color& edgeTopColor, const rgb_color& edgeRightColor,
|
const rgb_color& edgeTopColor, const rgb_color& edgeRightColor,
|
||||||
const rgb_color& frameTopColor, const rgb_color& frameRightColor)
|
const rgb_color& frameTopColor, const rgb_color& frameRightColor)
|
||||||
{
|
{
|
||||||
|
view->PushState();
|
||||||
|
|
||||||
// constrain clipping region to corner
|
// constrain clipping region to corner
|
||||||
BRegion clipping(cornerRect);
|
view->ClipToRect(cornerRect);
|
||||||
view->ConstrainClippingRegion(&clipping);
|
|
||||||
|
|
||||||
// background
|
// background
|
||||||
view->SetHighColor(background);
|
view->SetHighColor(background);
|
||||||
@@ -3407,6 +3411,8 @@ HaikuControlLook::_DrawRoundCornerFrameRightTop(BView* view, BRect& cornerRect,
|
|||||||
// prepare for bevel
|
// prepare for bevel
|
||||||
cornerRect.right--;
|
cornerRect.right--;
|
||||||
cornerRect.top++;
|
cornerRect.top++;
|
||||||
|
|
||||||
|
view->PopState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3415,9 +3421,10 @@ HaikuControlLook::_DrawRoundCornerBackgroundRightTop(BView* view, BRect& cornerR
|
|||||||
const BRect& updateRect, const rgb_color& bevelTopColor,
|
const BRect& updateRect, const rgb_color& bevelTopColor,
|
||||||
const rgb_color& bevelRightColor, const BGradientLinear& fillGradient)
|
const rgb_color& bevelRightColor, const BGradientLinear& fillGradient)
|
||||||
{
|
{
|
||||||
|
view->PushState();
|
||||||
|
|
||||||
// constrain clipping region to corner
|
// constrain clipping region to corner
|
||||||
BRegion clipping(cornerRect);
|
view->ClipToRect(cornerRect);
|
||||||
view->ConstrainClippingRegion(&clipping);
|
|
||||||
|
|
||||||
BRect ellipseRect(cornerRect);
|
BRect ellipseRect(cornerRect);
|
||||||
ellipseRect.left = ellipseRect.right - ellipseRect.Width() * 2;
|
ellipseRect.left = ellipseRect.right - ellipseRect.Width() * 2;
|
||||||
@@ -3434,6 +3441,8 @@ HaikuControlLook::_DrawRoundCornerBackgroundRightTop(BView* view, BRect& cornerR
|
|||||||
// gradient
|
// gradient
|
||||||
ellipseRect.InsetBy(1, 1);
|
ellipseRect.InsetBy(1, 1);
|
||||||
view->FillEllipse(ellipseRect, fillGradient);
|
view->FillEllipse(ellipseRect, fillGradient);
|
||||||
|
|
||||||
|
view->PopState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3459,9 +3468,10 @@ HaikuControlLook::_DrawRoundCornerFrameLeftBottom(BView* view, BRect& cornerRect
|
|||||||
const rgb_color& edgeLeftColor, const rgb_color& edgeBottomColor,
|
const rgb_color& edgeLeftColor, const rgb_color& edgeBottomColor,
|
||||||
const rgb_color& frameLeftColor, const rgb_color& frameBottomColor)
|
const rgb_color& frameLeftColor, const rgb_color& frameBottomColor)
|
||||||
{
|
{
|
||||||
|
view->PushState();
|
||||||
|
|
||||||
// constrain clipping region to corner
|
// constrain clipping region to corner
|
||||||
BRegion clipping(cornerRect);
|
view->ClipToRect(cornerRect);
|
||||||
view->ConstrainClippingRegion(&clipping);
|
|
||||||
|
|
||||||
// background
|
// background
|
||||||
view->SetHighColor(background);
|
view->SetHighColor(background);
|
||||||
@@ -3497,6 +3507,8 @@ HaikuControlLook::_DrawRoundCornerFrameLeftBottom(BView* view, BRect& cornerRect
|
|||||||
// prepare for bevel
|
// prepare for bevel
|
||||||
cornerRect.left++;
|
cornerRect.left++;
|
||||||
cornerRect.bottom--;
|
cornerRect.bottom--;
|
||||||
|
|
||||||
|
view->PopState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3505,9 +3517,10 @@ HaikuControlLook::_DrawRoundCornerBackgroundLeftBottom(BView* view, BRect& corne
|
|||||||
const BRect& updateRect, const rgb_color& bevelLeftColor,
|
const BRect& updateRect, const rgb_color& bevelLeftColor,
|
||||||
const rgb_color& bevelBottomColor, const BGradientLinear& fillGradient)
|
const rgb_color& bevelBottomColor, const BGradientLinear& fillGradient)
|
||||||
{
|
{
|
||||||
|
view->PushState();
|
||||||
|
|
||||||
// constrain clipping region to corner
|
// constrain clipping region to corner
|
||||||
BRegion clipping(cornerRect);
|
view->ClipToRect(cornerRect);
|
||||||
view->ConstrainClippingRegion(&clipping);
|
|
||||||
|
|
||||||
BRect ellipseRect(cornerRect);
|
BRect ellipseRect(cornerRect);
|
||||||
ellipseRect.right = ellipseRect.left + ellipseRect.Width() * 2;
|
ellipseRect.right = ellipseRect.left + ellipseRect.Width() * 2;
|
||||||
@@ -3524,6 +3537,8 @@ HaikuControlLook::_DrawRoundCornerBackgroundLeftBottom(BView* view, BRect& corne
|
|||||||
// gradient
|
// gradient
|
||||||
ellipseRect.InsetBy(1, 1);
|
ellipseRect.InsetBy(1, 1);
|
||||||
view->FillEllipse(ellipseRect, fillGradient);
|
view->FillEllipse(ellipseRect, fillGradient);
|
||||||
|
|
||||||
|
view->PopState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3545,9 +3560,10 @@ HaikuControlLook::_DrawRoundCornerFrameRightBottom(BView* view, BRect& cornerRec
|
|||||||
const BRect& updateRect, const rgb_color& background,
|
const BRect& updateRect, const rgb_color& background,
|
||||||
const rgb_color& edgeColor, const rgb_color& frameColor)
|
const rgb_color& edgeColor, const rgb_color& frameColor)
|
||||||
{
|
{
|
||||||
|
view->PushState();
|
||||||
|
|
||||||
// constrain clipping region to corner
|
// constrain clipping region to corner
|
||||||
BRegion clipping(cornerRect);
|
view->ClipToRect(cornerRect);
|
||||||
view->ConstrainClippingRegion(&clipping);
|
|
||||||
|
|
||||||
// background
|
// background
|
||||||
view->SetHighColor(background);
|
view->SetHighColor(background);
|
||||||
@@ -3571,6 +3587,8 @@ HaikuControlLook::_DrawRoundCornerFrameRightBottom(BView* view, BRect& cornerRec
|
|||||||
// prepare for bevel
|
// prepare for bevel
|
||||||
cornerRect.right--;
|
cornerRect.right--;
|
||||||
cornerRect.bottom--;
|
cornerRect.bottom--;
|
||||||
|
|
||||||
|
view->PopState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3579,9 +3597,10 @@ HaikuControlLook::_DrawRoundCornerBackgroundRightBottom(BView* view,
|
|||||||
BRect& cornerRect, const BRect& updateRect, const rgb_color& bevelColor,
|
BRect& cornerRect, const BRect& updateRect, const rgb_color& bevelColor,
|
||||||
const BGradientLinear& fillGradient)
|
const BGradientLinear& fillGradient)
|
||||||
{
|
{
|
||||||
|
view->PushState();
|
||||||
|
|
||||||
// constrain clipping region to corner
|
// constrain clipping region to corner
|
||||||
BRegion clipping(cornerRect);
|
view->ClipToRect(cornerRect);
|
||||||
view->ConstrainClippingRegion(&clipping);
|
|
||||||
|
|
||||||
BRect ellipseRect(cornerRect);
|
BRect ellipseRect(cornerRect);
|
||||||
ellipseRect.left = ellipseRect.right - ellipseRect.Width() * 2;
|
ellipseRect.left = ellipseRect.right - ellipseRect.Width() * 2;
|
||||||
@@ -3594,6 +3613,8 @@ HaikuControlLook::_DrawRoundCornerBackgroundRightBottom(BView* view,
|
|||||||
// gradient
|
// gradient
|
||||||
ellipseRect.InsetBy(1, 1);
|
ellipseRect.InsetBy(1, 1);
|
||||||
view->FillEllipse(ellipseRect, fillGradient);
|
view->FillEllipse(ellipseRect, fillGradient);
|
||||||
|
|
||||||
|
view->PopState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3606,7 +3627,7 @@ HaikuControlLook::_DrawRoundBarCorner(BView* view, BRect& rect,
|
|||||||
float leftInset, float topInset, float rightInset, float bottomInset,
|
float leftInset, float topInset, float rightInset, float bottomInset,
|
||||||
orientation orientation)
|
orientation orientation)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || !rect.Intersects(updateRect))
|
if (!ShouldDraw(view, rect, updateRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BGradientLinear gradient;
|
BGradientLinear gradient;
|
||||||
|
|||||||
Reference in New Issue
Block a user