support getting device resolution on all osx ports
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74303 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
e788ceb8fa
commit
bc7a3ceeba
@ -42,7 +42,6 @@ OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage(
|
||||
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();
|
||||
|
@ -122,7 +122,9 @@ WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithCFData( CFDataRe
|
||||
WXDLLIMPEXP_CORE CGDataConsumerRef wxMacCGDataConsumerCreateWithCFData( CFMutableDataRef data );
|
||||
WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithMemoryBuffer( const wxMemoryBuffer& buf );
|
||||
|
||||
CGColorSpaceRef WXDLLIMPEXP_CORE wxMacGetGenericRGBColorSpace(void);
|
||||
WXDLLIMPEXP_CORE CGColorSpaceRef wxMacGetGenericRGBColorSpace(void);
|
||||
|
||||
WXDLLIMPEXP_CORE double wxOSXGetMainScreenContentScaleFactor();
|
||||
|
||||
class wxWindowMac;
|
||||
// to
|
||||
|
@ -381,6 +381,33 @@ wxBitmap wxOSXCreateSystemBitmap(const wxString& name, const wxString &client, c
|
||||
#endif
|
||||
}
|
||||
|
||||
double wxOSXGetMainScreenContentScaleFactor()
|
||||
{
|
||||
double scale;
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 40000
|
||||
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
|
||||
{
|
||||
scale=[[UIScreen mainScreen] scale];
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
scale=1.0;
|
||||
}
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
|
||||
double wxOSXGetMainScreenContentScaleFactor()
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if wxOSX_USE_COCOA
|
||||
@ -446,7 +473,7 @@ CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromNSImage( WX_NSImage ns
|
||||
return hbitmap;
|
||||
}
|
||||
|
||||
double WXDLLIMPEXP_CORE wxOSXGetMainScreenContentScaleFactor()
|
||||
double wxOSXGetMainScreenContentScaleFactor()
|
||||
{
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
|
||||
if ( [ [NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)] )
|
||||
|
@ -1857,13 +1857,11 @@ bool wxBundleResourceHandler::LoadFile(wxBitmap *bitmap,
|
||||
|
||||
wxCFRef<CFURLRef> imageURL;
|
||||
|
||||
#if wxOSX_USE_COCOA
|
||||
if ( wxOSXGetMainScreenContentScaleFactor() > 1.9 )
|
||||
{
|
||||
imageURL.reset(CFBundleCopyResourceURL(CFBundleGetMainBundle(), resname2x, restype, NULL));
|
||||
scale = 2.0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( imageURL.get() == NULL )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user