From 522321b7c91f48459f03c9575e5ae032ca38ce12 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Tue, 1 Oct 2024 12:40:17 -0400 Subject: [PATCH] test: Fix testcustomcursor on high-DPI displays Use the backbuffer dimensions and scale the chessboard pattern to draw it filling the window on scaled displays. --- test/testcustomcursor.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/testcustomcursor.c b/test/testcustomcursor.c index 20012ad4e9..d7f6e3edca 100644 --- a/test/testcustomcursor.c +++ b/test/testcustomcursor.c @@ -341,10 +341,11 @@ static void loop(void) SDL_FRect rect; int x, y, row; int window_w = 0, window_h = 0; + const float scale = SDL_GetWindowPixelDensity(state->windows[i]); - SDL_GetWindowSize(state->windows[i], &window_w, &window_h); - rect.w = 128.0f; - rect.h = 128.0f; + SDL_GetWindowSizeInPixels(state->windows[i], &window_w, &window_h); + rect.w = 128.0f * scale; + rect.h = 128.0f * scale; for (y = 0, row = 0; y < window_h; y += (int)rect.h, ++row) { bool black = ((row % 2) == 0) ? true : false; for (x = 0; x < window_w; x += (int)rect.w) {