From ee059415c18d188eefcd392bd66f8a25df785aeb Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 26 Feb 2007 23:28:04 +0000 Subject: [PATCH] Allow using a memory dc (or a buffered dc) as the target of a wx.GraphicsContext. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44573 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/graphics.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mac/carbon/graphics.cpp b/src/mac/carbon/graphics.cpp index 0a22635202..03b56be847 100755 --- a/src/mac/carbon/graphics.cpp +++ b/src/mac/carbon/graphics.cpp @@ -2013,7 +2013,16 @@ wxGraphicsRenderer* wxGraphicsRenderer::GetDefaultRenderer() wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxWindowDC& dc) { - return new wxMacCoreGraphicsContext(this,(CGContextRef)dc.GetWindow()->MacGetCGContextRef() ); + wxMemoryDC* mdc = wxDynamicCast(&dc, wxMemoryDC); + if ( mdc ) + { + return new wxMacCoreGraphicsContext(this, + (CGContextRef)mdc->GetGraphicsContext()->GetNativeContext()); + } + else + { + return new wxMacCoreGraphicsContext(this,(CGContextRef)dc.GetWindow()->MacGetCGContextRef() ); + } } wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeContext( void * context )