From 4d335c4855bed1b6102a58a6bc8983f0233d6350 Mon Sep 17 00:00:00 2001 From: Eric Warmenhoven Date: Mon, 2 Dec 2024 10:52:38 -0500 Subject: [PATCH] iOS: Fix CAMetalLayer nativeScale confusion (#17225) --- gfx/drivers_context/cocoa_vk_ctx.m | 3 +-- ui/drivers/ui_cocoatouch.m | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gfx/drivers_context/cocoa_vk_ctx.m b/gfx/drivers_context/cocoa_vk_ctx.m index 9e732dc319..3a74efd345 100755 --- a/gfx/drivers_context/cocoa_vk_ctx.m +++ b/gfx/drivers_context/cocoa_vk_ctx.m @@ -131,8 +131,7 @@ static void cocoa_vk_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned* height) { float screenscale = cocoa_screen_get_native_scale(); - MTKView *g_view = apple_platform.renderView; - CGRect size = g_view.bounds; + CGRect size = [apple_platform.renderView bounds]; *width = CGRectGetWidth(size) * screenscale; *height = CGRectGetHeight(size) * screenscale; } diff --git a/ui/drivers/ui_cocoatouch.m b/ui/drivers/ui_cocoatouch.m index dc9c681ed6..39fb5260cc 100644 --- a/ui/drivers/ui_cocoatouch.m +++ b/ui/drivers/ui_cocoatouch.m @@ -527,7 +527,7 @@ enum - (void)setupMetalLayer { self.metalLayer.device = MTLCreateSystemDefaultDevice(); - self.metalLayer.contentsScale = [UIScreen mainScreen].scale; + self.metalLayer.contentsScale = [UIScreen mainScreen].nativeScale; self.metalLayer.opaque = YES; }