]> git.saurik.com Git - wxWidgets.git/commitdiff
supporting native content scaling on OSX
authorStefan Csomor <csomor@advancedconcepts.ch>
Tue, 25 Jun 2013 12:43:44 +0000 (12:43 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Tue, 25 Jun 2013 12:43:44 +0000 (12:43 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74284 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/carbon/dcclient.cpp

index 97929e1093ce915b43497cd4c338fa6408e4c00e..bd3bd1ed752b3306ad8d2f45cfc11e312face830 100644 (file)
@@ -58,10 +58,17 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window )
     if ( cg == NULL )
     {
         SetGraphicsContext( wxGraphicsContext::Create( window ) ) ;
     if ( cg == NULL )
     {
         SetGraphicsContext( wxGraphicsContext::Create( window ) ) ;
+        m_contentScaleFactor = window->GetContentScaleFactor();
         SetDeviceOrigin(-window->MacGetLeftBorderSize() , -window->MacGetTopBorderSize());
     }
     else
     {
         SetDeviceOrigin(-window->MacGetLeftBorderSize() , -window->MacGetTopBorderSize());
     }
     else
     {
+        // determine content scale
+        CGRect userrect = CGRectMake(0, 0, 10, 10);
+        CGRect devicerect;
+        devicerect = CGContextConvertRectToDeviceSpace(cg, userrect);
+        m_contentScaleFactor = devicerect.size.height / userrect.size.height;
+
         CGContextSaveGState( cg );
         m_release = true ;
         // make sure the context is having its origin at the wx-window coordinates of the
         CGContextSaveGState( cg );
         m_release = true ;
         // make sure the context is having its origin at the wx-window coordinates of the