Fix double-scaling by locking page layout to logical presentation

Pages computed layout from SDL_GetWindowSize() (real window
coordinates) while SDL_SetRenderLogicalPresentation() independently
remapped every draw call into a 1920x1080 space. The two coordinate
systems only agreed when the window happened to be exactly 1920x1080;
at any other size, layout coordinates were transformed a second time,
so content shrank/grew quadratically toward the top-left on resize or
on non-1080p monitors. Commenting the call out masked the bug by
making rendering 1:1 with the window, but then nothing scaled: fonts
and margins stayed fixed-pixel while backgrounds cover-fit, and HiDPI
displays drew at point resolution and relied on blurry compositor
upsampling.

Restore SDL_SetRenderLogicalPresentation(1920x1080, LETTERBOX) as the
single source of scaling, and route all twelve layout sites through a
new radiantwave::getLayoutSize() helper (src/logical_size.h) that
returns the renderer's logical size, so pages always lay out against
the design resolution regardless of window or monitor geometry. Add
SDL_WINDOW_HIGH_PIXEL_DENSITY so HiDPI displays render at native pixel
density instead of being upscaled by the OS. Cached per-page textures
become resolution-independent since layout no longer depends on window
size.
This commit is contained in:
NeilClack
2026-08-21 09:29:23 -05:00
parent 8e930ef8d9
commit 3c9de0bee2
14 changed files with 47 additions and 18 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
#include "proclamation_options_page.h"
#include "app_state.h"
#include "network/proclamation_sync.h"
#include "logical_size.h"
#include <SDL3/SDL.h>
#include <algorithm>
#include <cctype>
@@ -552,7 +553,7 @@ void ProclamationOptionsPage::update(float dt)
void ProclamationOptionsPage::render(SDL_Renderer* renderer)
{
int winW, winH;
SDL_GetWindowSize(SDL_GetRenderWindow(renderer), &winW, &winH);
radiantwave::getLayoutSize(renderer, &winW, &winH);
float fw = static_cast<float>(winW);
float fh = static_cast<float>(winH);