From a50ca98e2b9ca10368b62e93b6a0977dc68fd584 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Sat, 13 Nov 2021 14:48:36 +0100 Subject: [PATCH] Fixed bug #4625 - SDL_RenderSetLogicalSize issues viewport becomes -2147483648x-2147483648 when logical_w/h is greater than window size. division should be done with floats --- src/render/SDL_render.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 5c037c443..1f8471872 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -2266,9 +2266,9 @@ UpdateLogicalSize(SDL_Renderer *renderer) if (renderer->integer_scale) { if (want_aspect > real_aspect) { - scale = (float)(w / renderer->logical_w); + scale = (float)w / renderer->logical_w; } else { - scale = (float)(h / renderer->logical_h); + scale = (float)h / renderer->logical_h; } viewport.w = (int)SDL_floor(renderer->logical_w * scale); viewport.x = (w - viewport.w) / 2;