mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-21 04:08:27 +00:00
Add full high DPI information to SDL_DisplayMode
SDL_DisplayMode now includes the pixel size, the screen size and the relationship between the two. For example, a 4K display at 200% scale could have a pixel size of 3840x2160, a screen size of 1920x1080, and a display scale of 2.0.
This commit is contained in:
parent
b23d20cd4d
commit
24fec13ac1
31 changed files with 370 additions and 345 deletions
|
@ -1130,7 +1130,7 @@ SDLTest_CommonInit(SDLTest_CommonState *state)
|
|||
SDL_GetMasksForPixelFormatEnum(mode.format, &bpp, &Rmask, &Gmask,
|
||||
&Bmask, &Amask);
|
||||
SDL_Log(" Current mode: %dx%d@%gHz, %d%% scale, %d bits-per-pixel (%s)\n",
|
||||
mode.w, mode.h, mode.refresh_rate, (int)(mode.display_scale * 100.0f), bpp,
|
||||
mode.pixel_w, mode.pixel_h, mode.refresh_rate, (int)(mode.display_scale * 100.0f), bpp,
|
||||
SDL_GetPixelFormatName(mode.format));
|
||||
if (Rmask || Gmask || Bmask) {
|
||||
SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32 "\n", Rmask);
|
||||
|
@ -1152,7 +1152,7 @@ SDLTest_CommonInit(SDLTest_CommonState *state)
|
|||
SDL_GetMasksForPixelFormatEnum(mode.format, &bpp, &Rmask,
|
||||
&Gmask, &Bmask, &Amask);
|
||||
SDL_Log(" Mode %d: %dx%d@%gHz, %d%% scale, %d bits-per-pixel (%s)\n",
|
||||
j, mode.w, mode.h, mode.refresh_rate, (int)(mode.display_scale * 100.0f), bpp,
|
||||
j, mode.pixel_w, mode.pixel_h, mode.refresh_rate, (int)(mode.display_scale * 100.0f), bpp,
|
||||
SDL_GetPixelFormatName(mode.format));
|
||||
if (Rmask || Gmask || Bmask) {
|
||||
SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32 "\n",
|
||||
|
@ -2246,7 +2246,7 @@ void SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, fl
|
|||
|
||||
if (0 == SDL_GetWindowDisplayMode(window, &mode)) {
|
||||
(void)SDL_snprintf(text, sizeof text, "SDL_GetWindowDisplayMode: %dx%d@%gHz %d%% scale, (%s)",
|
||||
mode.w, mode.h, mode.refresh_rate, (int)(mode.display_scale * 100.0f), SDL_GetPixelFormatName(mode.format));
|
||||
mode.pixel_w, mode.pixel_h, mode.refresh_rate, (int)(mode.display_scale * 100.0f), SDL_GetPixelFormatName(mode.format));
|
||||
SDLTest_DrawString(renderer, 0.0f, textY, text);
|
||||
textY += lineHeight;
|
||||
}
|
||||
|
@ -2276,14 +2276,14 @@ void SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, fl
|
|||
|
||||
if (0 == SDL_GetCurrentDisplayMode(windowDisplayIndex, &mode)) {
|
||||
(void)SDL_snprintf(text, sizeof text, "SDL_GetCurrentDisplayMode: %dx%d@%gHz %d%% scale, (%s)",
|
||||
mode.w, mode.h, mode.refresh_rate, (int)(mode.display_scale * 100.0f), SDL_GetPixelFormatName(mode.format));
|
||||
mode.pixel_w, mode.pixel_h, mode.refresh_rate, (int)(mode.display_scale * 100.0f), SDL_GetPixelFormatName(mode.format));
|
||||
SDLTest_DrawString(renderer, 0.0f, textY, text);
|
||||
textY += lineHeight;
|
||||
}
|
||||
|
||||
if (0 == SDL_GetDesktopDisplayMode(windowDisplayIndex, &mode)) {
|
||||
(void)SDL_snprintf(text, sizeof text, "SDL_GetDesktopDisplayMode: %dx%d@%gHz %d%% scale, (%s)",
|
||||
mode.w, mode.h, mode.refresh_rate, (int)(mode.display_scale * 100.0f), SDL_GetPixelFormatName(mode.format));
|
||||
mode.pixel_w, mode.pixel_h, mode.refresh_rate, (int)(mode.display_scale * 100.0f), SDL_GetPixelFormatName(mode.format));
|
||||
SDLTest_DrawString(renderer, 0.0f, textY, text);
|
||||
textY += lineHeight;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue