fix ugly scaling on Retina Macs

This commit is contained in:
hunterk 2015-06-12 12:45:29 -05:00
parent 5da6aeafd8
commit b4e4af604e
2 changed files with 8 additions and 3 deletions

View File

@ -43,5 +43,7 @@
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>RApplication</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>

View File

@ -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)