1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-25 07:44:38 +01:00

Use dpi ref in rect and line drawing functions

This commit is contained in:
Gymnasiast
2023-04-03 23:16:34 +02:00
committed by duncanspumpkin
parent 2941f6f7a5
commit bb83a80eab
47 changed files with 276 additions and 278 deletions

View File

@@ -552,7 +552,7 @@ void CustomListView::MouseUp(const ScreenCoordsXY& pos)
void CustomListView::Paint(WindowBase* w, DrawPixelInfo& dpi, const ScrollBar* scroll) const
{
auto paletteIndex = ColourMapA[w->colours[1]].mid_light;
GfxFillRect(&dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width, dpi.y + dpi.height } }, paletteIndex);
GfxFillRect(dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width, dpi.y + dpi.height } }, paletteIndex);
int32_t y = ShowColumnHeaders ? COLUMN_HEADER_HEIGHT : 0;
for (size_t i = 0; i < Items.size(); i++)
@@ -583,19 +583,19 @@ void CustomListView::Paint(WindowBase* w, DrawPixelInfo& dpi, const ScrollBar* s
if (isSelected)
{
GfxFilterRect(
&dpi, { { dpi.x, y }, { dpi.x + dpi.width, y + (LIST_ROW_HEIGHT - 1) } },
dpi, { { dpi.x, y }, { dpi.x + dpi.width, y + (LIST_ROW_HEIGHT - 1) } },
FilterPaletteID::PaletteDarken2);
}
else if (isHighlighted)
{
GfxFilterRect(
&dpi, { { dpi.x, y }, { dpi.x + dpi.width, y + (LIST_ROW_HEIGHT - 1) } },
dpi, { { dpi.x, y }, { dpi.x + dpi.width, y + (LIST_ROW_HEIGHT - 1) } },
FilterPaletteID::PaletteDarken2);
}
else if (isStriped)
{
GfxFillRect(
&dpi, { { dpi.x, y }, { dpi.x + dpi.width, y + (LIST_ROW_HEIGHT - 1) } },
dpi, { { dpi.x, y }, { dpi.x + dpi.width, y + (LIST_ROW_HEIGHT - 1) } },
ColourMapA[w->colours[1]].lighter | 0x1000000);
}
@@ -641,7 +641,7 @@ void CustomListView::Paint(WindowBase* w, DrawPixelInfo& dpi, const ScrollBar* s
y = scroll->v_top;
auto bgColour = ColourMapA[w->colours[1]].mid_light;
GfxFillRect(&dpi, { { dpi.x, y }, { dpi.x + dpi.width, y + 12 } }, bgColour);
GfxFillRect(dpi, { { dpi.x, y }, { dpi.x + dpi.width, y + 12 } }, bgColour);
int32_t x = 0;
for (int32_t j = 0; j < static_cast<int32_t>(Columns.size()); j++)
@@ -673,7 +673,7 @@ void CustomListView::PaintHeading(
{
boxFlags = INSET_RECT_FLAG_BORDER_INSET;
}
GfxFillRectInset(&dpi, { pos, pos + ScreenCoordsXY{ size.width - 1, size.height - 1 } }, w->colours[1], boxFlags);
GfxFillRectInset(dpi, { pos, pos + ScreenCoordsXY{ size.width - 1, size.height - 1 } }, w->colours[1], boxFlags);
if (!text.empty())
{
PaintCell(dpi, pos, size, text.c_str(), false);
@@ -723,32 +723,32 @@ void CustomListView::PaintSeperator(
// Draw light horizontal rule
auto lightLineLeftTop1 = ScreenCoordsXY{ left, lineY0 };
auto lightLineRightBottom1 = ScreenCoordsXY{ strLeft, lineY0 };
GfxDrawLine(&dpi, { lightLineLeftTop1, lightLineRightBottom1 }, lightColour);
GfxDrawLine(dpi, { lightLineLeftTop1, lightLineRightBottom1 }, lightColour);
auto lightLineLeftTop2 = ScreenCoordsXY{ strRight, lineY0 };
auto lightLineRightBottom2 = ScreenCoordsXY{ right, lineY0 };
GfxDrawLine(&dpi, { lightLineLeftTop2, lightLineRightBottom2 }, lightColour);
GfxDrawLine(dpi, { lightLineLeftTop2, lightLineRightBottom2 }, lightColour);
// Draw dark horizontal rule
auto darkLineLeftTop1 = ScreenCoordsXY{ left, lineY1 };
auto darkLineRightBottom1 = ScreenCoordsXY{ strLeft, lineY1 };
GfxDrawLine(&dpi, { darkLineLeftTop1, darkLineRightBottom1 }, darkColour);
GfxDrawLine(dpi, { darkLineLeftTop1, darkLineRightBottom1 }, darkColour);
auto darkLineLeftTop2 = ScreenCoordsXY{ strRight, lineY1 };
auto darkLineRightBottom2 = ScreenCoordsXY{ right, lineY1 };
GfxDrawLine(&dpi, { darkLineLeftTop2, darkLineRightBottom2 }, darkColour);
GfxDrawLine(dpi, { darkLineLeftTop2, darkLineRightBottom2 }, darkColour);
}
else
{
// Draw light horizontal rule
auto lightLineLeftTop1 = ScreenCoordsXY{ left, lineY0 };
auto lightLineRightBottom1 = ScreenCoordsXY{ right, lineY0 };
GfxDrawLine(&dpi, { lightLineLeftTop1, lightLineRightBottom1 }, lightColour);
GfxDrawLine(dpi, { lightLineLeftTop1, lightLineRightBottom1 }, lightColour);
// Draw dark horizontal rule
auto darkLineLeftTop1 = ScreenCoordsXY{ left, lineY1 };
auto darkLineRightBottom1 = ScreenCoordsXY{ right, lineY1 };
GfxDrawLine(&dpi, { darkLineLeftTop1, darkLineRightBottom1 }, darkColour);
GfxDrawLine(dpi, { darkLineLeftTop1, darkLineRightBottom1 }, darkColour);
}
}