From fb2daa2f5fc753e5ec9d996deac973214b71eb85 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 6 Sep 2025 11:21:36 -0700 Subject: [PATCH] Updated the documentation for SDL_GetRenderLogicalPresentation() Fixes https://github.com/libsdl-org/SDL/issues/13791 --- include/SDL3/SDL_render.h | 8 ++++---- src/render/SDL_render.c | 9 +++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h index 135fd42437..018f18cff3 100644 --- a/include/SDL3/SDL_render.h +++ b/include/SDL3/SDL_render.h @@ -1477,15 +1477,15 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderLogicalPresentation(SDL_Renderer * * Get device independent resolution and presentation mode for rendering. * * This function gets the width and height of the logical rendering output, or - * the output size in pixels if a logical resolution is not enabled. + * 0 if a logical resolution is not enabled. * * Each render target has its own logical presentation state. This function * gets the state for the current render target. * * \param renderer the rendering context. - * \param w an int to be filled with the width. - * \param h an int to be filled with the height. - * \param mode the presentation mode used. + * \param w an int filled with the logical presentation width. + * \param h an int filled with the logical presentation height. + * \param mode a variable filled with the logical presentation mode being used. * \returns true on success or false on failure; call SDL_GetError() for more * information. * diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 6adbe10f7d..5bbd691ef0 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -2757,9 +2757,14 @@ bool SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_ CHECK_RENDERER_MAGIC(renderer, false); SDL_RenderViewState *view = renderer->view; + if (mode == SDL_LOGICAL_PRESENTATION_DISABLED) { + view->logical_w = 0; + view->logical_h = 0; + } else { + view->logical_w = w; + view->logical_h = h; + } view->logical_presentation_mode = mode; - view->logical_w = w; - view->logical_h = h; UpdateLogicalPresentation(renderer);