From b4e4af604e852dcbcc3bda8a90e9b46049f3cc62 Mon Sep 17 00:00:00 2001 From: hunterk Date: Fri, 12 Jun 2015 12:45:29 -0500 Subject: [PATCH] fix ugly scaling on Retina Macs --- apple/OSX/RetroArch-Info.plist | 2 ++ gfx/drivers_context/cocoa_gl_ctx.m | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apple/OSX/RetroArch-Info.plist b/apple/OSX/RetroArch-Info.plist index 68ef9c4829..812e5ac793 100644 --- a/apple/OSX/RetroArch-Info.plist +++ b/apple/OSX/RetroArch-Info.plist @@ -43,5 +43,7 @@ MainMenu NSPrincipalClass RApplication + NSHighResolutionCapable + diff --git a/gfx/drivers_context/cocoa_gl_ctx.m b/gfx/drivers_context/cocoa_gl_ctx.m index 17af8a3724..eaddcefd78 100644 --- a/gfx/drivers_context/cocoa_gl_ctx.m +++ b/gfx/drivers_context/cocoa_gl_ctx.m @@ -151,6 +151,7 @@ static bool cocoagl_gfx_ctx_init(void *data) #if defined(HAVE_COCOA) CocoaView *g_view = (CocoaView*)nsview_get_ptr(); + [g_view setWantsBestResolutionOpenGLSurface:YES]; NSOpenGLPixelFormatAttribute attributes [] = { NSOpenGLPFAColorSize, 24, NSOpenGLPFADoubleBuffer, @@ -337,8 +338,10 @@ static void cocoagl_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned #if defined(HAVE_COCOA) CocoaView *g_view = (CocoaView*)nsview_get_ptr(); - CGRect cgrect = NSRectToCGRect([g_view frame]); - size = CGRectMake(0, 0, CGRectGetWidth(cgrect), CGRectGetHeight(cgrect)); + NSRect backingBounds = [g_view convertRectToBacking:[g_view bounds]]; + GLsizei backingPixelWidth = (GLSizei)(backingBounds.size.width), + backingPixelHeight = (GLSizei)(backingBounds.size.height); + size = CGRectMake(0, 0, backingPixelWidth, backingPixelHeight); #else size = g_view.bounds; #endif @@ -383,7 +386,7 @@ static bool cocoagl_gfx_ctx_get_metrics(void *data, enum display_metric_types ty #if MAC_OS_X_VERSION_10_6 float scale = screen.backingScaleFactor; #else - float scale = 1.0f; + float scale = 4.0f; #endif float dpi = (display_width/ physical_width) * 25.4f * scale; #elif defined(HAVE_COCOATOUCH)