Skip to content

Commit

Permalink
Remove inverted round rectangle corner drawing
Browse files Browse the repository at this point in the history
Rectangles with inverted round corners (`IGraphics::CORNER_I*`) are currently not used anywhere and also only supported when using `Draw4`.

They also feel clunky to use due to the inverted corners being drawn outside of the specified rectangle area.
  • Loading branch information
Robyt3 committed Jul 27, 2023
1 parent fd13ae5 commit c695fd7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 54 deletions.
44 changes: 0 additions & 44 deletions src/engine/client/graphics_threaded.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1377,50 +1377,6 @@ void CGraphics_Threaded::DrawRectExt4(float x, float y, float w, float h, ColorR
x + w - r + Ca2 * r, y + h - r + Sa2 * r);
QuadsDrawFreeform(&ItemF, 1);
}

if(Corners & CORNER_ITL)
{
SetColor(ColorTopLeft);
IGraphics::CFreeformItem ItemF = IGraphics::CFreeformItem(
x, y,
x + (1 - Ca1) * r, y - r + Sa1 * r,
x + (1 - Ca3) * r, y - r + Sa3 * r,
x + (1 - Ca2) * r, y - r + Sa2 * r);
QuadsDrawFreeform(&ItemF, 1);
}

if(Corners & CORNER_ITR)
{
SetColor(ColorTopRight);
IGraphics::CFreeformItem ItemF = IGraphics::CFreeformItem(
x + w, y,
x + w - r + Ca1 * r, y - r + Sa1 * r,
x + w - r + Ca3 * r, y - r + Sa3 * r,
x + w - r + Ca2 * r, y - r + Sa2 * r);
QuadsDrawFreeform(&ItemF, 1);
}

if(Corners & CORNER_IBL)
{
SetColor(ColorBottomLeft);
IGraphics::CFreeformItem ItemF = IGraphics::CFreeformItem(
x, y + h,
x + (1 - Ca1) * r, y + h + (1 - Sa1) * r,
x + (1 - Ca3) * r, y + h + (1 - Sa3) * r,
x + (1 - Ca2) * r, y + h + (1 - Sa2) * r);
QuadsDrawFreeform(&ItemF, 1);
}

if(Corners & CORNER_IBR)
{
SetColor(ColorBottomRight);
IGraphics::CFreeformItem ItemF = IGraphics::CFreeformItem(
x + w, y + h,
x + w - r + Ca1 * r, y + h + (1 - Sa1) * r,
x + w - r + Ca3 * r, y + h + (1 - Sa3) * r,
x + w - r + Ca2 * r, y + h + (1 - Sa2) * r);
QuadsDrawFreeform(&ItemF, 1);
}
}

SetColor4(ColorTopLeft, ColorTopRight, ColorBottomLeft, ColorBottomRight);
Expand Down
10 changes: 0 additions & 10 deletions src/engine/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -461,23 +461,13 @@ class IGraphics : public IInterface
CORNER_TR = 2,
CORNER_BL = 4,
CORNER_BR = 8,
CORNER_ITL = 16,
CORNER_ITR = 32,
CORNER_IBL = 64,
CORNER_IBR = 128,

CORNER_T = CORNER_TL | CORNER_TR,
CORNER_B = CORNER_BL | CORNER_BR,
CORNER_R = CORNER_TR | CORNER_BR,
CORNER_L = CORNER_TL | CORNER_BL,

CORNER_IT = CORNER_ITL | CORNER_ITR,
CORNER_IB = CORNER_IBL | CORNER_IBR,
CORNER_IR = CORNER_ITR | CORNER_IBR,
CORNER_IL = CORNER_ITL | CORNER_IBL,

CORNER_ALL = CORNER_T | CORNER_B,
CORNER_INV_ALL = CORNER_IT | CORNER_IB
};
virtual void DrawRectExt(float x, float y, float w, float h, float r, int Corners) = 0;
virtual void DrawRectExt4(float x, float y, float w, float h, ColorRGBA ColorTopLeft, ColorRGBA ColorTopRight, ColorRGBA ColorBottomLeft, ColorRGBA ColorBottomRight, float r, int Corners) = 0;
Expand Down

0 comments on commit c695fd7

Please sign in to comment.