test: info now reports usable display bounds and DPI (thanks, Eric!).

Fixes Bugzilla #3652.
This commit is contained in:
Ryan C. Gordon 2017-05-18 16:29:10 -04:00
parent 81ab6c98fd
commit cff9e5a876
1 changed files with 11 additions and 1 deletions

View File

@ -706,7 +706,9 @@ SDLTest_CommonInit(SDLTest_CommonState * state)
} }
if (state->verbose & VERBOSE_MODES) { if (state->verbose & VERBOSE_MODES) {
SDL_Rect bounds; SDL_Rect bounds, usablebounds;
float hdpi = 0;
float vdpi = 0;
SDL_DisplayMode mode; SDL_DisplayMode mode;
int bpp; int bpp;
Uint32 Rmask, Gmask, Bmask, Amask; Uint32 Rmask, Gmask, Bmask, Amask;
@ -721,7 +723,15 @@ SDLTest_CommonInit(SDLTest_CommonState * state)
SDL_zero(bounds); SDL_zero(bounds);
SDL_GetDisplayBounds(i, &bounds); SDL_GetDisplayBounds(i, &bounds);
SDL_zero(usablebounds);
SDL_GetDisplayUsableBounds(i, &usablebounds);
SDL_GetDisplayDPI(i, NULL, &hdpi, &vdpi);
SDL_Log("Bounds: %dx%d at %d,%d\n", bounds.w, bounds.h, bounds.x, bounds.y); SDL_Log("Bounds: %dx%d at %d,%d\n", bounds.w, bounds.h, bounds.x, bounds.y);
SDL_Log("Usable bounds: %dx%d at %d,%d\n", usablebounds.w, usablebounds.h, usablebounds.x, usablebounds.y);
SDL_Log("DPI: %fx%f\n", hdpi, vdpi);
SDL_GetDesktopDisplayMode(i, &mode); SDL_GetDesktopDisplayMode(i, &mode);
SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask,