diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index d111e77a1..75adfab5a 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -619,6 +619,17 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) SDL_SetRenderTarget(renderer, NULL); } + /* Update the DPI scale if the window has been resized. */ + if (window && renderer->GetOutputSize) { + int window_w, window_h; + int output_w, output_h; + if (renderer->GetOutputSize(renderer, &output_w, &output_h) == 0) { + SDL_GetWindowSize(renderer->window, &window_w, &window_h); + renderer->dpi_scale.x = (float)window_w / output_w; + renderer->dpi_scale.y = (float)window_h / output_h; + } + } + if (renderer->logical_w) { UpdateLogicalSize(renderer); } else {