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:
Peter Nelson
2023-11-30 18:10:07 +00:00
committed by GitHub
parent 33ba609290
commit 6f7153bf71
4 changed files with 19 additions and 10 deletions

View File

@@ -922,15 +922,11 @@ int Window::SortButtonWidth()
bool _draw_widget_outlines;
void DrawOutline(const Window *, const NWidgetBase *wid)
static void DrawOutline(const Window *, const NWidgetBase *wid)
{
if (!_draw_widget_outlines || wid->current_x == 0 || wid->current_y == 0) return;
Rect r = wid->GetCurrentRect();
GfxDrawLine(r.left, r.top, r.right, r.top, PC_WHITE, 1, 4);
GfxDrawLine(r.left, r.top, r.left, r.bottom, PC_WHITE, 1, 4);
GfxDrawLine(r.right, r.top, r.right, r.bottom, PC_WHITE, 1, 4);
GfxDrawLine(r.left, r.bottom, r.right, r.bottom, PC_WHITE, 1, 4);
DrawRectOutline(wid->GetCurrentRect(), PC_WHITE, 1, 4);
}
/**