1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 20:13:07 +01:00

Part of #12096: ScreenRect on gfx_fill_rect in windows/Ride.cpp (#12239)

This commit is contained in:
frutiemax
2020-07-13 16:49:12 -04:00
committed by GitHub
parent b39a0037f0
commit 84a4c4e473

View File

@@ -3154,7 +3154,7 @@ static void window_ride_vehicle_scrollpaint(rct_window* w, rct_drawpixelinfo* dp
rct_ride_entry* rideEntry = ride->GetRideEntry();
// Background
gfx_fill_rect(dpi, dpi->x, dpi->y, dpi->x + dpi->width, dpi->y + dpi->height, PALETTE_INDEX_12);
gfx_fill_rect(dpi, { { dpi->x, dpi->y }, { dpi->x + dpi->width, dpi->y + dpi->height } }, PALETTE_INDEX_12);
rct_widget* widget = &window_ride_vehicle_widgets[WIDX_VEHICLE_TRAINS_PREVIEW];
int32_t startX = std::max(2, (widget->width() - ((ride->num_vehicles - 1) * 36)) / 2 - 25);
@@ -4966,8 +4966,10 @@ static void window_ride_colour_paint(rct_window* w, rct_drawpixelinfo* dpi)
widget = &window_ride_colour_widgets[WIDX_TRACK_PREVIEW];
if (widget->type != WWT_EMPTY)
gfx_fill_rect(
dpi, w->windowPos.x + widget->left + 1, w->windowPos.y + widget->top + 1, w->windowPos.x + widget->right - 1,
w->windowPos.y + widget->bottom - 1, PALETTE_INDEX_12);
dpi,
{ { w->windowPos + ScreenCoordsXY{ widget->left + 1, widget->top + 1 } },
{ w->windowPos + ScreenCoordsXY{ widget->right - 1, widget->bottom - 1 } } },
PALETTE_INDEX_12);
auto trackColour = ride_get_track_colour(ride, w->ride_colour);
@@ -5072,7 +5074,7 @@ static void window_ride_colour_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi
auto vehicleColour = ride_get_vehicle_colour(ride, w->vehicleIndex);
// Background colour
gfx_fill_rect(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, PALETTE_INDEX_12);
gfx_fill_rect(dpi, { { dpi->x, dpi->y }, { dpi->x + dpi->width - 1, dpi->y + dpi->height - 1 } }, PALETTE_INDEX_12);
// ?
auto screenCoords = ScreenCoordsXY{ vehiclePreviewWidget->width() / 2, vehiclePreviewWidget->height() - 15 };
@@ -6182,11 +6184,13 @@ static void window_ride_graphs_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi
{
if (x + 80 >= dpi->x)
{
gfx_fill_rect(dpi, x + 0, dpi->y, x + 0, dpi->y + dpi->height - 1, lightColour);
gfx_fill_rect(dpi, x + 16, dpi->y, x + 16, dpi->y + dpi->height - 1, darkColour);
gfx_fill_rect(dpi, x + 32, dpi->y, x + 32, dpi->y + dpi->height - 1, darkColour);
gfx_fill_rect(dpi, x + 48, dpi->y, x + 48, dpi->y + dpi->height - 1, darkColour);
gfx_fill_rect(dpi, x + 64, dpi->y, x + 64, dpi->y + dpi->height - 1, darkColour);
auto coord1 = ScreenCoordsXY{ x, dpi->y };
auto coord2 = ScreenCoordsXY{ x, dpi->y + dpi->height - 1 };
gfx_fill_rect(dpi, { coord1, coord2 }, lightColour);
gfx_fill_rect(dpi, { coord1 + ScreenCoordsXY{ 16, 0 }, coord2 + ScreenCoordsXY{ 16, 0 } }, darkColour);
gfx_fill_rect(dpi, { coord1 + ScreenCoordsXY{ 32, 0 }, coord2 + ScreenCoordsXY{ 32, 0 } }, darkColour);
gfx_fill_rect(dpi, { coord1 + ScreenCoordsXY{ 48, 0 }, coord2 + ScreenCoordsXY{ 48, 0 } }, darkColour);
gfx_fill_rect(dpi, { coord1 + ScreenCoordsXY{ 64, 0 }, coord2 + ScreenCoordsXY{ 64, 0 } }, darkColour);
}
time += 5;
}
@@ -6208,7 +6212,7 @@ static void window_ride_graphs_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi
{
// Minor / major line
int32_t colour = yUnit == 0 ? lightColour : darkColour;
gfx_fill_rect(dpi, dpi->x, y, dpi->x + dpi->width - 1, y, colour);
gfx_fill_rect(dpi, { { dpi->x, y }, { dpi->x + dpi->width - 1, y } }, colour);
int16_t scaled_yUnit = yUnit;
// Scale modifier
@@ -6284,7 +6288,7 @@ static void window_ride_graphs_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi
const bool previousMeasurement = x > measurement->current_item;
// Draw the current line in gray.
gfx_fill_rect(dpi, x, top, x, bottom, previousMeasurement ? PALETTE_INDEX_17 : PALETTE_INDEX_21);
gfx_fill_rect(dpi, { { x, top }, { x, bottom } }, previousMeasurement ? PALETTE_INDEX_17 : PALETTE_INDEX_21);
// Draw red over extreme values (if supported by graph type).
if (listType == GRAPH_VERTICAL || listType == GRAPH_LATERAL)
@@ -6294,17 +6298,17 @@ static void window_ride_graphs_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi
// Line exceeds negative threshold (at bottom of graph).
if (bottom >= intensityThresholdNegative)
{
const auto redLineTop = std::max(top, intensityThresholdNegative);
const auto redLineBottom = std::max(bottom, intensityThresholdNegative);
gfx_fill_rect(dpi, x, redLineTop, x, redLineBottom, redLineColour);
const auto redLineTop = ScreenCoordsXY{ x, std::max(top, intensityThresholdNegative) };
const auto redLineBottom = ScreenCoordsXY{ x, std::max(bottom, intensityThresholdNegative) };
gfx_fill_rect(dpi, { redLineTop, redLineBottom }, redLineColour);
}
// Line exceeds positive threshold (at top of graph).
if (top <= intensityThresholdPositive)
{
const auto redLineTop = std::min(top, intensityThresholdPositive);
const auto redLineBottom = std::min(bottom, intensityThresholdPositive);
gfx_fill_rect(dpi, x, redLineTop, x, redLineBottom, redLineColour);
const auto redLineTop = ScreenCoordsXY{ x, std::min(top, intensityThresholdPositive) };
const auto redLineBottom = ScreenCoordsXY{ x, std::min(bottom, intensityThresholdPositive) };
gfx_fill_rect(dpi, { redLineTop, redLineBottom }, redLineColour);
}
}
}