From 2670613f6c60192c8ca1578c3a3d2bfdca2852d1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 18 Jan 2021 00:50:07 +0100 Subject: [PATCH] Don't use nativeScale/scale for OSX --- gfx/drivers_context/cocoa_gl_ctx.m | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gfx/drivers_context/cocoa_gl_ctx.m b/gfx/drivers_context/cocoa_gl_ctx.m index 24a7cd6adb..a581e2c03e 100644 --- a/gfx/drivers_context/cocoa_gl_ctx.m +++ b/gfx/drivers_context/cocoa_gl_ctx.m @@ -314,6 +314,8 @@ static void cocoagl_gfx_ctx_show_mouse(void *data, bool state) #endif } +#ifndef OSX +/* NOTE: nativeScale only available on iOS 8.0 and up. */ float cocoagl_gfx_ctx_get_native_scale(void) { SEL selector; @@ -341,6 +343,7 @@ float cocoagl_gfx_ctx_get_native_scale(void) return ret; } +#endif #ifdef OSX static void cocoagl_gfx_ctx_update_title(void *data) @@ -459,7 +462,6 @@ static void cocoagl_gfx_ctx_input_driver(void *data, static void cocoagl_gfx_ctx_get_video_size_osx10_7_and_up(void *data, unsigned* width, unsigned* height) { - float screenscale = cocoagl_gfx_ctx_get_native_scale(); #if defined(HAVE_COCOA_METAL) NSView *g_view = apple_platform.renderView; #elif defined(HAVE_COCOA) @@ -469,15 +471,14 @@ static void cocoagl_gfx_ctx_get_video_size_osx10_7_and_up(void *data, GLsizei backingPixelWidth = CGRectGetWidth(cgrect); GLsizei backingPixelHeight = CGRectGetHeight(cgrect); CGRect size = CGRectMake(0, 0, backingPixelWidth, backingPixelHeight); - *width = CGRectGetWidth(size) * screenscale; - *height = CGRectGetHeight(size) * screenscale; + *width = CGRectGetWidth(size); + *height = CGRectGetHeight(size); } #endif static void cocoagl_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned* height) { - float screenscale = cocoagl_gfx_ctx_get_native_scale(); #ifdef OSX #if defined(HAVE_COCOA_METAL) NSView *g_view = apple_platform.renderView; @@ -488,11 +489,14 @@ static void cocoagl_gfx_ctx_get_video_size(void *data, GLsizei backingPixelWidth = CGRectGetWidth(cgrect); GLsizei backingPixelHeight = CGRectGetHeight(cgrect); CGRect size = CGRectMake(0, 0, backingPixelWidth, backingPixelHeight); + *width = CGRectGetWidth(size); + *height = CGRectGetHeight(size); #else + float screenscale = cocoagl_gfx_ctx_get_native_scale(); CGRect size = g_view.bounds; -#endif *width = CGRectGetWidth(size) * screenscale; *height = CGRectGetHeight(size) * screenscale; +#endif } static gfx_ctx_proc_t cocoagl_gfx_ctx_get_proc_address(const char *symbol_name)