Codechange: Make a generic DrawRectOutline function from DrawOutline. (#11524)
This allows drawing an outline from Rect, not just constrained to a Widget's Rect. And reduces duplication a little.
This commit is contained in:
15
src/gfx.cpp
15
src/gfx.cpp
@@ -451,6 +451,21 @@ void DrawBox(int x, int y, int dx1, int dy1, int dx2, int dy2, int dx3, int dy3)
|
||||
GfxDrawLineUnscaled(x + dx3, y + dy3, x + dx3 + dx2, y + dy3 + dy2, colour);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the outline of a Rect
|
||||
* @param r Rect to draw.
|
||||
* @param colour Colour of the outline.
|
||||
* @param width Width of the outline.
|
||||
* @param dash Length of dashes for dashed lines. 0 means solid lines.
|
||||
*/
|
||||
void DrawRectOutline(const Rect &r, int colour, int width, int dash)
|
||||
{
|
||||
GfxDrawLine(r.left, r.top, r.right, r.top, colour, width, dash);
|
||||
GfxDrawLine(r.left, r.top, r.left, r.bottom, colour, width, dash);
|
||||
GfxDrawLine(r.right, r.top, r.right, r.bottom, colour, width, dash);
|
||||
GfxDrawLine(r.left, r.bottom, r.right, r.bottom, colour, width, dash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the colour remap to be for the given colour.
|
||||
* @param colour the new colour of the remap.
|
||||
|
Reference in New Issue
Block a user