WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromCGImage( CGImageRef image, double scale = 1.0 );
CGImageRef WXDLLIMPEXP_CORE wxOSXCreateCGImageFromNSImage( WX_NSImage nsimage, double *scale = NULL );
CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromNSImage( WX_NSImage nsimage);
+double WXDLLIMPEXP_CORE wxOSXGetMainScreenContentScaleFactor();
wxBitmap WXDLLIMPEXP_CORE wxOSXCreateSystemBitmap(const wxString& id, const wxString &client, const wxSize& size);
WXWindow WXDLLIMPEXP_CORE wxOSXGetMainWindow();
CGContextRef hbitmap = NULL;
if (nsimage != nil)
{
- CGFloat scale = [[NSScreen mainScreen] backingScaleFactor];
+ double scale = wxOSXGetMainScreenContentScaleFactor();
NSSize imageSize = [nsimage size];
return hbitmap;
}
+double WXDLLIMPEXP_CORE wxOSXGetMainScreenContentScaleFactor()
+{
+#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
+ if ( [ [NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)] )
+ return [[NSScreen mainScreen] backingScaleFactor];
+ else
+#endif
+ return 1.0;
+}
+
CGImageRef wxOSXCreateCGImageFromNSImage( WX_NSImage nsimage, double *scaleptr )
{
// based on http://www.mail-archive.com/cocoa-dev@lists.apple.com/msg18065.html