Fix #6647: Prevent changelog window from painting lines out of view. (#7611)

This commit is contained in:
Aaron van Geffen 2018-06-08 09:30:20 +02:00 committed by GitHub
parent a4e803c03f
commit b2b997c328
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -18,6 +18,7 @@
- Fix: [#5210] Default system dialog not accessible from saving landscape window.
- Fix: [#6134] Scenarios incorrectly categorised when using Polish version of RCT2.
- Fix: [#6141] CSS50.dat is never loaded.
- Fix: [#6647] Changelog window causes FPS drop.
- Fix: [#6938] Banner do not correctly capitalise non-ASCII characters.
- Fix: [#7176] Mechanics sometimes fall down from rides.
- Fix: [#7303] Visual glitch with virtual floor near map edges.

View File

@ -170,7 +170,9 @@ static void window_changelog_scrollgetsize(
[[maybe_unused]] rct_window * w, [[maybe_unused]] sint32 scrollIndex, sint32 * width, sint32 * height)
{
*width = _changelogLongestLineWidth + 4;
*height = (sint32)(_changelogLines.size() * 11);
const sint32 lineHeight = font_get_line_height(gCurrentFontSpriteBase);
*height = (sint32)(_changelogLines.size() * lineHeight);
}
static void window_changelog_invalidate(rct_window *w)
@ -196,12 +198,17 @@ static void window_changelog_scrollpaint(rct_window * w, rct_drawpixelinfo * dpi
gCurrentFontFlags = 0;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
const sint32 lineHeight = font_get_line_height(gCurrentFontSpriteBase);
sint32 x = 3;
sint32 y = 3;
sint32 y = 3 - lineHeight;
for (auto line : _changelogLines)
{
y += lineHeight;
if (y + lineHeight < dpi->y || y >= dpi->y + dpi->height)
continue;
gfx_draw_string(dpi, (char *)line, w->colours[0], x, y);
y += 11;
}
}