1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 03:23:15 +01:00

Fix fuzzy horizontal-to-vertical line transitions in charts (#22962)

* Fix drawLine being off by one in horizontal-to-vertical transitions

* Rename no_pixels local to length

* Amend changelog
This commit is contained in:
Aaron van Geffen
2024-10-12 22:49:19 +02:00
committed by GitHub
parent 3792159196
commit af7a2de72c
2 changed files with 5 additions and 4 deletions

View File

@@ -2,6 +2,7 @@
------------------------------------------------------------------------
- Fix: [#22918] Zooming with keyboard moves the view off centre.
- Fix: [#22921] Wooden RollerCoaster flat to steep railings appear in front of track in front of them.
- Fix: [#22962] Fuzzy horizontal-to-vertical line transitions in charts.
0.4.15 (2024-10-06)
------------------------------------------------------------------------

View File

@@ -139,7 +139,7 @@ void GfxDrawLineSoftware(DrawPixelInfo& dpi, const ScreenLine& line, int32_t col
else
y_step = -1;
for (int32_t x = x1, x_start = x1, no_pixels = 1; x < x2; ++x, ++no_pixels)
for (int32_t x = x1, x_start = x1, length = 1; x < x2; ++x, ++length)
{
// Vertical lines are drawn 1 pixel at a time
if (steep)
@@ -150,11 +150,11 @@ void GfxDrawLineSoftware(DrawPixelInfo& dpi, const ScreenLine& line, int32_t col
{
// Non vertical lines are drawn with as many pixels in a horizontal line as possible
if (!steep)
GfxDrawLineOnBuffer(dpi, colour, { x_start, y }, no_pixels);
GfxDrawLineOnBuffer(dpi, colour, { x_start, y }, length);
// Reset non vertical line vars
x_start = x + 1;
no_pixels = 1;
length = 0; // NB: will be incremented in next iteration
y += y_step;
error += delta_x;
}
@@ -162,7 +162,7 @@ void GfxDrawLineSoftware(DrawPixelInfo& dpi, const ScreenLine& line, int32_t col
// Catch the case of the last line
if (x + 1 == x2 && !steep)
{
GfxDrawLineOnBuffer(dpi, colour, { x_start, y }, no_pixels);
GfxDrawLineOnBuffer(dpi, colour, { x_start, y }, length);
}
}
}