Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestWM with scale 2 uses only a quarter of the window #11076

Open
Dragon-Baroque opened this issue Oct 5, 2024 · 2 comments
Open

TestWM with scale 2 uses only a quarter of the window #11076

Dragon-Baroque opened this issue Oct 5, 2024 · 2 comments
Assignees
Milestone

Comments

@Dragon-Baroque
Copy link
Contributor

SDL3 as of 1ca45c5,
Linux, Video driver X11 ( default ) or Wayland ( by SDL_VIDEO_DRIVER ) :

testwm --scale 2 printouts are truncated to the upper left quarter of the window :

TestWM

@Sackzement
Copy link
Contributor

Sackzement commented Oct 5, 2024

Seems like the render viewport needs to be adjusted to the scale:

SDL/test/testwm.c

Lines 228 to 233 in 1ca45c5

SDL_Rect viewport;
SDL_FRect menurect;
SDL_SetRenderViewport(renderer, NULL);
SDL_GetRenderSafeArea(renderer, &viewport);
SDL_SetRenderViewport(renderer, &viewport);

diff --git a/test/testwm.c b/test/testwm.c
index c92cd98bb..fd792e4e5 100644
--- a/test/testwm.c
+++ b/test/testwm.c
@@ -230,6 +230,10 @@ static void loop(void)
 
             SDL_SetRenderViewport(renderer, NULL);
             SDL_GetRenderSafeArea(renderer, &viewport);
+            if (state->scale != 0.0f) {
+                viewport.w = (int)(viewport.w * state->scale);
+                viewport.h = (int)(viewport.h * state->scale);
+            }
             SDL_SetRenderViewport(renderer, &viewport);
 
             SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);

This is just a guess. No idea if this is the intended way to fix this.

@slouken
Copy link
Collaborator

slouken commented Oct 5, 2024

This is just a guess. No idea if this is the intended way to fix this.

Nope, thanks but it needs to be fixed inside SDL.

Thanks!

@slouken slouken added this to the 3.2.0 milestone Oct 5, 2024
@slouken slouken assigned slouken and icculus and unassigned slouken Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants