1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 07:14:31 +01:00

Use const ImageId in drawing functions

This commit is contained in:
Gymnasiast
2022-09-28 23:00:58 +02:00
parent d352ca3d01
commit cedccf9b0e
15 changed files with 68 additions and 80 deletions

View File

@@ -802,9 +802,9 @@ static void WidgetDrawImage(rct_drawpixelinfo* dpi, rct_window& w, WidgetIndex w
const auto& widget = w.widgets[widgetIndex];
// Get the image
int32_t image = widget.image;
if (image == SPR_NONE)
if (static_cast<int32_t>(widget.image) == SPR_NONE)
return;
auto image = ImageId::FromUInt32(widget.image);
// Resolve the absolute ltrb
auto screenCoords = w.windowPos + ScreenCoordsXY{ widget.left, widget.top };
@@ -815,7 +815,7 @@ static void WidgetDrawImage(rct_drawpixelinfo* dpi, rct_window& w, WidgetIndex w
if (widget.type == WindowWidgetType::ColourBtn || widget.type == WindowWidgetType::TrnBtn
|| widget.type == WindowWidgetType::Tab)
if (WidgetIsPressed(w, widgetIndex) || WidgetIsActiveTool(w, widgetIndex))
image++;
image = image.WithIndexOffset(1);
if (WidgetIsDisabled(w, widgetIndex))
{
@@ -831,17 +831,17 @@ static void WidgetDrawImage(rct_drawpixelinfo* dpi, rct_window& w, WidgetIndex w
}
else
{
if (image & IMAGE_TYPE_REMAP_2_PLUS)
if (image.HasSecondary())
{
// ?
}
if (image & IMAGE_TYPE_TRANSPARENT)
image &= ~IMAGE_TYPE_TRANSPARENT;
if (image.IsBlended())
image = image.WithBlended(false);
else
image |= colour << 19;
image = image.WithPrimary(colour);
gfx_draw_sprite(dpi, ImageId::FromUInt32(image), screenCoords);
gfx_draw_sprite(dpi, image, screenCoords);
}
}