From: Stefan Csomor Date: Fri, 20 Oct 2006 17:25:54 +0000 (+0000) Subject: creating graphics context with the correct origin X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/7471064e1d9916e3a81d747c4c130fb7ba19539b?hp=80f0a1be1310f868972d1ea4386dd7bb1445f85e creating graphics context with the correct origin git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42175 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/graphics.cpp b/src/mac/carbon/graphics.cpp index 5b3d1105cd..29c61ab26b 100755 --- a/src/mac/carbon/graphics.cpp +++ b/src/mac/carbon/graphics.cpp @@ -1275,7 +1275,16 @@ wxGraphicsContext* wxGraphicsContext::Create( const wxWindowDC &dc ) wxGraphicsContext* wxGraphicsContext::Create( wxWindow * window ) { - return new wxMacCoreGraphicsContext( (WindowRef) window->MacGetTopLevelWindowRef() ); + wxGraphicsContext* ctx = new wxMacCoreGraphicsContext( (WindowRef) window->MacGetTopLevelWindowRef() ); + CGContextRef cg = (CGContextRef) ctx->GetNativeContext() ; + CGContextRestoreGState( cg ); + int x , y; + x = y = 0; + window->MacWindowToRootWindow( &x , &y ); + CGContextTranslateCTM( cg, x, y ); + CGContextSaveGState( cg ); + return ctx; + } wxGraphicsContext* wxGraphicsContext::CreateFromNative( void * context )