X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/058e3f1b54586781545ed872358ee43053dad8b6..d3fa4bc22e84e3ca4d88cc1772f2d414140a1017:/src/osx/carbon/dcclient.cpp diff --git a/src/osx/carbon/dcclient.cpp b/src/osx/carbon/dcclient.cpp index 21f3c245bd..bd3bd1ed75 100644 --- a/src/osx/carbon/dcclient.cpp +++ b/src/osx/carbon/dcclient.cpp @@ -58,9 +58,17 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) if ( cg == NULL ) { SetGraphicsContext( wxGraphicsContext::Create( window ) ) ; + m_contentScaleFactor = window->GetContentScaleFactor(); + 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 @@ -157,7 +165,11 @@ wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *window ) : m_window->GetClientSize( &m_width , &m_height); if ( !m_window->IsShownOnScreen() ) m_width = m_height = 0; - SetDeviceOrigin( origin.x, origin.y ); + + int x0,y0; + DoGetDeviceOrigin(&x0,&y0); + SetDeviceOrigin( origin.x + x0, origin.y + y0 ); + DoSetClippingRegion( 0 , 0 , m_width , m_height ) ; }