X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/277ccdafe111a97a22431a4acc81b9e9ef7c2f8a..453091c26978d6da004ab46c78c719d7f9444ae3:/src/mac/carbon/graphics.cpp diff --git a/src/mac/carbon/graphics.cpp b/src/mac/carbon/graphics.cpp old mode 100755 new mode 100644 index 7bc04419a1..b2bcb0788a --- a/src/mac/carbon/graphics.cpp +++ b/src/mac/carbon/graphics.cpp @@ -17,6 +17,7 @@ #ifndef WX_PRECOMP #include "wx/dcclient.h" + #include "wx/dcmemory.h" #include "wx/log.h" #include "wx/region.h" #endif @@ -754,6 +755,10 @@ public : virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, wxDouble tx=0.0, wxDouble ty=0.0); + // gets the component valuess of the matrix + virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL, + wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const; + // makes this the inverse matrix virtual void Invert(); @@ -825,6 +830,18 @@ void wxMacCoreGraphicsMatrixData::Set(wxDouble a, wxDouble b, wxDouble c, wxDoub m_matrix = CGAffineTransformMake(a,b,c,d,tx,ty); } +// gets the component valuess of the matrix +void wxMacCoreGraphicsMatrixData::Get(wxDouble* a, wxDouble* b, wxDouble* c, + wxDouble* d, wxDouble* tx, wxDouble* ty) const +{ + if (a) *a = m_matrix.a; + if (b) *b = m_matrix.b; + if (c) *c = m_matrix.c; + if (d) *d = m_matrix.d; + if (tx) *tx= m_matrix.tx; + if (ty) *ty= m_matrix.ty; +} + // makes this the inverse matrix void wxMacCoreGraphicsMatrixData::Invert() { @@ -1181,7 +1198,7 @@ public: virtual void DrawPath( const wxGraphicsPath &path, int fillStyle = wxODDEVEN_RULE ); virtual bool ShouldOffset() const - { + { int penwidth = 0 ; if ( !m_pen.IsNull() ) { @@ -1339,6 +1356,7 @@ bool wxMacCoreGraphicsContext::SetLogicalFunction( int function ) if ( CGContextSetBlendMode != NULL ) { CGContextSetBlendMode( m_cgContext, kCGBlendModeNormal ); + CGContextSetShouldAntialias( m_cgContext, true ); } #endif } @@ -1349,6 +1367,7 @@ bool wxMacCoreGraphicsContext::SetLogicalFunction( int function ) { // change color to white CGContextSetBlendMode( m_cgContext, kCGBlendModeExclusion ); + CGContextSetShouldAntialias( m_cgContext, false ); retval = true; } #endif @@ -1818,6 +1837,9 @@ void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *wid *width = FixedToInt(textAfter - textBefore); ::ATSUDisposeTextLayout(atsuLayout); +#if SIZEOF_WCHAR_T == 4 + free( ubuf ) ; +#endif } void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const @@ -1876,6 +1898,9 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr } ::ATSUDisposeTextLayout(atsuLayout); +#if SIZEOF_WCHAR_T == 4 + free( ubuf ) ; +#endif } void * wxMacCoreGraphicsContext::GetNativeContext() @@ -1989,7 +2014,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 )