]> git.saurik.com Git - wxWidgets.git/commitdiff
creating graphics context with the correct origin
authorStefan Csomor <csomor@advancedconcepts.ch>
Fri, 20 Oct 2006 17:25:54 +0000 (17:25 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Fri, 20 Oct 2006 17:25:54 +0000 (17:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42175 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/graphics.cpp

index 5b3d1105cdff2ed2adc97423b459c9a56d0d4ff4..29c61ab26b5e7d0e399bf01d5b3a03bac7f7ff75 100755 (executable)
@@ -1275,7 +1275,16 @@ wxGraphicsContext* wxGraphicsContext::Create( const wxWindowDC &dc )
 
 wxGraphicsContext* wxGraphicsContext::Create( wxWindow * window )
 {
 
 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 )
 }
 
 wxGraphicsContext* wxGraphicsContext::CreateFromNative( void * context )