: wxGCDCImpl( owner )
{
m_window = window;
-
+
m_ok = true ;
m_window->GetSize( &m_width , &m_height);
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
if ( window->MacGetLeftBorderSize() != 0 || window->MacGetTopBorderSize() != 0 )
CGContextTranslateCTM( cg , -window->MacGetLeftBorderSize() , -window->MacGetTopBorderSize() );
- SetGraphicsContext( wxGraphicsContext::CreateFromNative( cg ) );
+ wxGraphicsContext* context = wxGraphicsContext::CreateFromNative( cg );
+ context->EnableOffset(true);
+ SetGraphicsContext( context );
}
DoSetClippingRegion( 0 , 0 , m_width , m_height ) ;
ControlRef handle = (ControlRef) m_window->GetHandle();
if ( !handle )
return wxNullBitmap;
-
+
HIRect rect;
CGImageRef image;
CGContextRef context;
int height = subrect != NULL ? subrect->height : (int)rect.size.height ;
wxBitmap bmp = wxBitmap(width, height, 32);
-
+
context = (CGContextRef)bmp.GetHBITMAP();
-
+
CGContextSaveGState(context);
-
+
CGContextTranslateCTM( context, 0, height );
CGContextScaleCTM( context, 1, -1 );
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 ) ;
}
wxClientDCImpl::~wxClientDCImpl()
{
+ if( GetGraphicsContext() && GetGraphicsContext()->GetNativeContext() )
+ Flush();
}
/*