From ac9be0110f689f3c23427264112cace0cd8237d7 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 22 Jun 2025 00:03:44 +1000 Subject: [PATCH] FullscreenUI: Snap CenterImage() to integer coordinates --- src/util/imgui_fullscreen.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/imgui_fullscreen.cpp b/src/util/imgui_fullscreen.cpp index 0df307747..5988081dd 100644 --- a/src/util/imgui_fullscreen.cpp +++ b/src/util/imgui_fullscreen.cpp @@ -660,16 +660,16 @@ ImRect ImGuiFullscreen::CenterImage(const ImVec2& fit_size, const ImVec2& image_ if (fit_ar > image_ar) { // center horizontally - const float width = fit_size.y * image_ar; - const float offset = (fit_size.x - width) / 2.0f; + const float width = ImFloor(fit_size.y * image_ar); + const float offset = ImFloor((fit_size.x - width) * 0.5f); const float height = fit_size.y; ret = ImRect(ImVec2(offset, 0.0f), ImVec2(offset + width, height)); } else { // center vertically - const float height = fit_size.x / image_ar; - const float offset = (fit_size.y - height) / 2.0f; + const float height = ImFloor(fit_size.x / image_ar); + const float offset = ImFloor((fit_size.y - height) * 0.5f); const float width = fit_size.x; ret = ImRect(ImVec2(0.0f, offset), ImVec2(width, offset + height)); }