Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

simulator: Adjust scaling using keyboard shortcuts

Press 0-3 to to adjust current zoom level
to 50% (0), 100% (1), 200% (2), or 300% (3).

Press 4 to switch between "best" (linear)
and nearest pixel sampling.

Change-Id: Id10d361659855a0ad9c97e6b341f498f72709ef5

+52 -19
+24
firmware/target/hosted/sdl/button-sdl.c
··· 351 351 switch (key) 352 352 { 353 353 #ifdef SIMULATOR 354 + case SDLK_0: 355 + display_zoom = 0.5; 356 + case SDLK_1: 357 + display_zoom = display_zoom ?: 1; 358 + case SDLK_2: 359 + display_zoom = display_zoom ?: 2; 360 + case SDLK_3: 361 + display_zoom = display_zoom ?: 3; 362 + case SDLK_4: 363 + if (pressed) 364 + { 365 + display_zoom = 0; 366 + return; 367 + } 368 + if (!display_zoom) 369 + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, 370 + strcmp(SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY) ?: 371 + "best", "best") ? "best": "nearest"); 372 + 373 + sdl_window_needs_update(); 374 + #if !defined(__WIN32) && !defined (__APPLE__) 375 + button_queue_post(SDLK_UNKNOWN, 0); /* update window on main thread */ 376 + #endif 377 + return; 354 378 case USB_KEY: 355 379 if (!pressed) 356 380 {
+27 -19
firmware/target/hosted/sdl/lcd-sdl.c
··· 65 65 #define SNAP_MARGIN 50 66 66 int sdl_update_window(void) 67 67 { 68 + int w, h; 69 + 68 70 if (!window_needs_update) 69 71 return false; 70 72 window_needs_update = false; 71 73 72 - #if defined (__APPLE__) || defined(__WIN32) /* Constrain aspect ratio */ 74 + sdl_get_window_dimensions(&w, &h); 75 + 73 76 if (!(SDL_GetWindowFlags(window) & (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_FULLSCREEN))) 74 77 { 75 - float aspect_ratio; 76 - int w, h; 78 + if (display_zoom) 79 + { 80 + SDL_SetWindowSize(window, display_zoom * w, display_zoom * h); 81 + } 82 + #if defined(__APPLE__) || defined(__WIN32) 83 + else /* Constrain aspect ratio on Windows and MacOS */ 84 + { 77 85 78 - sdl_get_window_dimensions(&w, &h); 79 - aspect_ratio = (float) h / w; 86 + float aspect_ratio = (float) h / w; 87 + int original_height = h; 88 + int original_width = w; 80 89 81 - int original_height = h; 82 - int original_width = w; 83 - 84 - SDL_GetWindowSize(window, &w, &h); 85 - if (w != original_width || h != original_height) 86 - { 87 - if (abs(original_width - w) < SNAP_MARGIN) 90 + SDL_GetWindowSize(window, &w, &h); 91 + if (w != original_width || h != original_height) 88 92 { 89 - w = original_width; 90 - h = original_height; 93 + if (abs(original_width - w) < SNAP_MARGIN) 94 + { 95 + w = original_width; 96 + h = original_height; 97 + } 98 + else 99 + h = w * aspect_ratio; 100 + 101 + SDL_SetWindowSize(window, w, h); 91 102 } 92 - else 93 - h = w * aspect_ratio; 94 - 95 - SDL_SetWindowSize(window, w, h); 96 103 } 104 + #endif 97 105 } 98 - #endif 106 + display_zoom = 0; 99 107 sdl_render(); 100 108 return true; 101 109 }
+1
firmware/target/hosted/sdl/system-sdl.c
··· 113 113 panicf("%s", SDL_GetError()); 114 114 115 115 SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, display_zoom == 1 ? "best" : "nearest"); 116 + display_zoom = 0; /* keeps track of user requesting a scale level change */ 116 117 SDL_RenderSetLogicalSize(sdlRenderer, width, height); 117 118 118 119 if ((gui_surface = SDL_CreateRGBSurface(0, width, height, depth,