(OSX) Use backingScaleFactor

This commit is contained in:
Twinaphex 2015-04-21 13:02:57 +02:00
parent 000e61dc66
commit c539a66b53

View File

@ -353,6 +353,7 @@ static bool cocoagl_gfx_ctx_get_metrics(void *data, enum display_metric_types ty
float display_height = display_pixel_size.height; float display_height = display_pixel_size.height;
float physical_width = display_physical_size.width; float physical_width = display_physical_size.width;
float physical_height = display_physical_size.height; float physical_height = display_physical_size.height;
float scale = screen.backingScaleFactor;
#elif defined(HAVE_COCOATOUCH) #elif defined(HAVE_COCOATOUCH)
float scale = cocoagl_gfx_ctx_get_native_scale(); float scale = cocoagl_gfx_ctx_get_native_scale();
CGRect screen_rect = [[UIScreen mainScreen] bounds]; CGRect screen_rect = [[UIScreen mainScreen] bounds];
@ -375,7 +376,7 @@ static bool cocoagl_gfx_ctx_get_metrics(void *data, enum display_metric_types ty
break; break;
case DISPLAY_METRIC_DPI: case DISPLAY_METRIC_DPI:
/* 25.4 mm in an inch. */ /* 25.4 mm in an inch. */
*value = (display_width/ physical_width) * 25.4f; *value = (display_width/ physical_width) * 25.4f * scale;
break; break;
case DISPLAY_METRIC_NONE: case DISPLAY_METRIC_NONE:
default: default: