mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-30 10:15:36 +01:00
Pass ImageId by value instead by const-ref
ImageId struct is 8-bytes large and can fit in CPU register. Passing it by value lets compiler pass it in register instead of forcing to reference it from memory. In my tests this brings [dome park](https://github.com/OpenRCT2/OpenRCT2/files/6134362/dome-export.zip) benchgfx results from 42.16s down to 41.08s, or by 2.5%.
This commit is contained in:
@@ -708,18 +708,18 @@ void X8DrawingContext::DrawLine(rct_drawpixelinfo* dpi, uint32_t colour, const S
|
||||
gfx_draw_line_software(dpi, line, colour);
|
||||
}
|
||||
|
||||
void X8DrawingContext::DrawSprite(rct_drawpixelinfo* dpi, const ImageId& imageId, int32_t x, int32_t y)
|
||||
void X8DrawingContext::DrawSprite(rct_drawpixelinfo* dpi, const ImageId imageId, int32_t x, int32_t y)
|
||||
{
|
||||
gfx_draw_sprite_software(dpi, imageId, { x, y });
|
||||
}
|
||||
|
||||
void X8DrawingContext::DrawSpriteRawMasked(
|
||||
rct_drawpixelinfo* dpi, int32_t x, int32_t y, const ImageId& maskImage, const ImageId& colourImage)
|
||||
rct_drawpixelinfo* dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage)
|
||||
{
|
||||
gfx_draw_sprite_raw_masked_software(dpi, { x, y }, maskImage, colourImage);
|
||||
}
|
||||
|
||||
void X8DrawingContext::DrawSpriteSolid(rct_drawpixelinfo* dpi, const ImageId& image, int32_t x, int32_t y, uint8_t colour)
|
||||
void X8DrawingContext::DrawSpriteSolid(rct_drawpixelinfo* dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour)
|
||||
{
|
||||
uint8_t palette[256];
|
||||
std::fill_n(palette, sizeof(palette), colour);
|
||||
@@ -730,7 +730,7 @@ void X8DrawingContext::DrawSpriteSolid(rct_drawpixelinfo* dpi, const ImageId& im
|
||||
}
|
||||
|
||||
void X8DrawingContext::DrawGlyph(
|
||||
rct_drawpixelinfo* dpi, const ImageId& image, int32_t x, int32_t y, const PaletteMap& paletteMap)
|
||||
rct_drawpixelinfo* dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& paletteMap)
|
||||
{
|
||||
gfx_draw_sprite_palette_set_software(dpi, image, { x, y }, paletteMap);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user