Rearranged DPI calc so that on calc failure, returns 1. (#547)

This commit is contained in:
Adam 2021-09-26 10:21:57 -04:00 committed by Francesco Abbate
parent ed3ea35ed5
commit 6aa316e3c3
1 changed files with 5 additions and 6 deletions

View File

@ -18,13 +18,12 @@
SDL_Window *window;
static double get_scale(void) {
#ifdef __APPLE__
return 1.0;
#else
float dpi = 96.0;
SDL_GetDisplayDPI(0, NULL, &dpi, NULL);
return dpi / 96.0;
#ifndef __APPLE__
float dpi;
if (SDL_GetDisplayDPI(0, NULL, &dpi, NULL) == 0)
return dpi / 96.0;
#endif
return 1.0;
}