From ddd21fa87a1f4cfc420e91a79d32370212adab27 Mon Sep 17 00:00:00 2001 From: annoyingdroid <48995374+annoyingdroid@users.noreply.github.com> Date: Sat, 1 Aug 2020 13:40:01 -0400 Subject: [PATCH] Part of #12098: Use ScreenRect on gfx_filter_rect (#12134) --- src/openrct2-ui/interface/InGameConsole.cpp | 5 +++-- src/openrct2-ui/interface/Widget.cpp | 3 ++- src/openrct2-ui/interface/Window.cpp | 2 +- src/openrct2-ui/scripting/CustomListView.cpp | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/openrct2-ui/interface/InGameConsole.cpp b/src/openrct2-ui/interface/InGameConsole.cpp index 7f4fac5235..cbb730a6d8 100644 --- a/src/openrct2-ui/interface/InGameConsole.cpp +++ b/src/openrct2-ui/interface/InGameConsole.cpp @@ -290,10 +290,11 @@ void InGameConsole::Draw(rct_drawpixelinfo* dpi) const Invalidate(); // Give console area a translucent effect. - gfx_filter_rect(dpi, _consoleLeft, _consoleTop, _consoleRight, _consoleBottom, PALETTE_51); + gfx_filter_rect(dpi, { { _consoleLeft, _consoleTop }, { _consoleRight, _consoleBottom } }, PALETTE_51); // Make input area more opaque. - gfx_filter_rect(dpi, _consoleLeft, _consoleBottom - lineHeight - 10, _consoleRight, _consoleBottom - 1, PALETTE_51); + gfx_filter_rect( + dpi, { { _consoleLeft, _consoleBottom - lineHeight - 10 }, { _consoleRight, _consoleBottom - 1 } }, PALETTE_51); // Paint background colour. uint8_t backgroundColour = theme_get_colour(WC_CONSOLE, 0); diff --git a/src/openrct2-ui/interface/Widget.cpp b/src/openrct2-ui/interface/Widget.cpp index 3d304b3f54..6c0820f7d8 100644 --- a/src/openrct2-ui/interface/Widget.cpp +++ b/src/openrct2-ui/interface/Widget.cpp @@ -532,7 +532,8 @@ static void widget_caption_draw(rct_drawpixelinfo* dpi, rct_window* w, rct_widge gfx_fill_rect( dpi, { { topLeft + ScreenCoordsXY{ 1, 1 } }, { bottomRight - ScreenCoordsXY{ 1, 1 } } }, ColourMapA[colour].dark); else - gfx_filter_rect(dpi, topLeft.x + 1, topLeft.y + 1, bottomRight.x - 1, bottomRight.y - 1, PALETTE_DARKEN_3); + gfx_filter_rect( + dpi, { { topLeft + ScreenCoordsXY{ 1, 1 } }, { bottomRight - ScreenCoordsXY{ 1, 1 } } }, PALETTE_DARKEN_3); // Draw text if (widget->text == STR_NONE) diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp index c76fa287ad..7c672b296b 100644 --- a/src/openrct2-ui/interface/Window.cpp +++ b/src/openrct2-ui/interface/Window.cpp @@ -587,7 +587,7 @@ void window_draw_widgets(rct_window* w, rct_drawpixelinfo* dpi) if ((w->flags & WF_TRANSPARENT) && !(w->flags & WF_NO_BACKGROUND)) gfx_filter_rect( - dpi, w->windowPos.x, w->windowPos.y, w->windowPos.x + w->width - 1, w->windowPos.y + w->height - 1, PALETTE_51); + dpi, { w->windowPos, w->windowPos + ScreenCoordsXY{ w->width - 1, w->windowPos.y + w->height - 1 } }, PALETTE_51); // todo: some code missing here? Between 006EB18C and 006EB260 diff --git a/src/openrct2-ui/scripting/CustomListView.cpp b/src/openrct2-ui/scripting/CustomListView.cpp index 37d94ad0f3..38d41a76bf 100644 --- a/src/openrct2-ui/scripting/CustomListView.cpp +++ b/src/openrct2-ui/scripting/CustomListView.cpp @@ -557,11 +557,11 @@ void CustomListView::Paint(rct_window* w, rct_drawpixelinfo* dpi, const rct_scro auto isSelected = (SelectedCell && itemIndex == SelectedCell->Row); if (isSelected) { - gfx_filter_rect(dpi, dpi->x, y, dpi->x + dpi->width, y + (LIST_ROW_HEIGHT - 1), PALETTE_DARKEN_2); + gfx_filter_rect(dpi, { { dpi->x, y }, { dpi->x + dpi->width, y + (LIST_ROW_HEIGHT - 1) } }, PALETTE_DARKEN_2); } else if (isHighlighted) { - gfx_filter_rect(dpi, dpi->x, y, dpi->x + dpi->width, y + (LIST_ROW_HEIGHT - 1), PALETTE_DARKEN_1); + gfx_filter_rect(dpi, { { dpi->x, y }, { dpi->x + dpi->width, y + (LIST_ROW_HEIGHT - 1) } }, PALETTE_DARKEN_1); } else if (isStriped) {