From bbe22b3be7c653b3ce1185844eb7d1a8cce0039b Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sun, 9 Feb 2020 16:34:02 +0000 Subject: [PATCH] Fix credits when using software scaling --- SourceX/DiabloUI/credits.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SourceX/DiabloUI/credits.cpp b/SourceX/DiabloUI/credits.cpp index d405d6443..4b1a56fec 100644 --- a/SourceX/DiabloUI/credits.cpp +++ b/SourceX/DiabloUI/credits.cpp @@ -224,7 +224,11 @@ void CreditsRenderer::Render() while (lines_.back().index + 1 != lines_end) lines_.push_back(PrepareLine(lines_.back().index + 1)); - SDL_SetClipRect(GetOutputSurface(), &VIEWPORT); + SDL_Rect viewport = VIEWPORT; + ScaleOutputRect(&viewport); + SDL_SetClipRect(GetOutputSurface(), &viewport); + + // We use unscaled coordinates for calculation throughout. decltype(SDL_Rect().y) dest_y = VIEWPORT.y - (offset_y - lines_begin * LINE_H); for (std::size_t i = 0; i < lines_.size(); ++i, dest_y += LINE_H) { auto &line = lines_[i];