]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/graphics.cpp
remove unneccessary header dependencies on wx/thread.h
[wxWidgets.git] / src / mac / carbon / graphics.cpp
index c255dda34fb01c11440685ab622cf96917d12708..48cd16a9cf42cbd797ba908539d3e5e745864a3c 100644 (file)
@@ -759,7 +759,7 @@ wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* rendere
 
     wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") );
 #endif
-#if WXMAC_USE_CG_TEXT
+#if wxMAC_USE_CG_TEXT
 #endif
 }
 
@@ -774,7 +774,7 @@ wxMacCoreGraphicsFontData::~wxMacCoreGraphicsFontData()
         m_macATSUIStyle = NULL;
     }
 #endif
-#if WXMAC_USE_CG_TEXT
+#if wxMAC_USE_CG_TEXT
 #endif
 }
 
@@ -1774,7 +1774,7 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub
         return;
     }
 #endif
-#if WXMAC_USE_CG_TEXT
+#if wxMAC_USE_CG_TEXT
     // TODO core graphics text implementation here
 #endif
 }
@@ -1903,7 +1903,7 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub
         return;
     }
 #endif
-#if WXMAC_USE_CG_TEXT
+#if wxMAC_USE_CG_TEXT
     // default implementation takes care of rotation and calls non rotated DrawText afterwards
     wxGraphicsContext::DrawText( str, x, y, angle );
 #endif
@@ -2014,7 +2014,7 @@ void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *wid
         return;
     }
 #endif
-#if WXMAC_USE_CG_TEXT
+#if wxMAC_USE_CG_TEXT
     // TODO core graphics text implementation here
 #endif
 }
@@ -2104,7 +2104,7 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr
 #endif
     }
 #endif
-#if WXMAC_USE_CG_TEXT
+#if wxMAC_USE_CG_TEXT
     // TODO core graphics text implementation here
 #endif
 }
@@ -2166,6 +2166,7 @@ public :
     // Context
 
     virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc);
+    virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc);
 
     virtual wxGraphicsContext * CreateContextFromNativeContext( void * context );
 
@@ -2218,18 +2219,26 @@ wxGraphicsRenderer* wxGraphicsRenderer::GetDefaultRenderer()
     return &gs_MacCoreGraphicsRenderer;
 }
 
-wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxWindowDC& dc)
+wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxWindowDC& dc )
 {
-    wxMemoryDC* mdc = wxDynamicCast(&dc, wxMemoryDC);
-    if ( mdc )
-    {
-        return new wxMacCoreGraphicsContext(this, 
-            (CGContextRef)mdc->GetGraphicsContext()->GetNativeContext());
-    }
-    else
-    {
-        return new wxMacCoreGraphicsContext(this,(CGContextRef)dc.GetWindow()->MacGetCGContextRef() );
-    }
+    const wxDCImpl* impl = dc.GetImpl();
+    wxWindowDCImpl *win_impl = wxDynamicCast( impl, wxWindowDCImpl );
+    if (win_impl)
+        return new wxMacCoreGraphicsContext( this,
+           (CGContextRef)(win_impl->GetWindow()->MacGetCGContextRef()) );
+           
+    return NULL;
+}
+
+wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxMemoryDC& dc )
+{
+    const wxDCImpl* impl = dc.GetImpl();
+    wxMemoryDCImpl *mem_impl = wxDynamicCast( impl, wxMemoryDCImpl );
+    if (mem_impl)
+        return new wxMacCoreGraphicsContext( this, 
+            (CGContextRef)(mem_impl->GetGraphicsContext()->GetNativeContext()) );
+            
+    return NULL;
 }
 
 wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeContext( void * context )