[Commits] SDL: test: info now reports usable display bounds and DPI (thank...

libsdl.org revision control commits-owner at libsdl.org
Thu May 18 13:31:24 PDT 2017


details:   https://hg.libsdl.org/SDL/rev/c2f18f1f7e97
changeset: 11012:c2f18f1f7e97
user:      Ryan C. Gordon <icculus at icculus.org>
date:      Thu May 18 16:29:10 2017 -0400
description:
test: info now reports usable display bounds and DPI (thanks, Eric!).

Fixes Bugzilla #3652.

diffstat:

 src/test/SDL_test_common.c |  12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diffs (30 lines):

diff -r d3ac11b79213 -r c2f18f1f7e97 src/test/SDL_test_common.c
--- a/src/test/SDL_test_common.c	Thu May 18 16:27:36 2017 -0400
+++ b/src/test/SDL_test_common.c	Thu May 18 16:29:10 2017 -0400
@@ -706,7 +706,9 @@
         }
 
         if (state->verbose & VERBOSE_MODES) {
-            SDL_Rect bounds;
+            SDL_Rect bounds, usablebounds;
+            float hdpi = 0;
+            float vdpi = 0;
             SDL_DisplayMode mode;
             int bpp;
             Uint32 Rmask, Gmask, Bmask, Amask;
@@ -721,7 +723,15 @@
 
                 SDL_zero(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("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_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask,


More information about the commits mailing list