X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1cc7d13a08ae3ebf253c1543f45a3bfdd64ffe80..6631cbd98e7d1139a45841b519ae8aa753a15fbc:/src/common/dcgraph.cpp diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp index 14584924ba..96516c4e52 100644 --- a/src/common/dcgraph.cpp +++ b/src/common/dcgraph.cpp @@ -30,8 +30,12 @@ #include "wx/dcclient.h" -#ifdef __WXMAC__ -#include "wx/mac/private.h" +#ifdef __WXOSX__ +#ifdef __WXOSX_IPHONE__ + #include +#else + #include +#endif #endif //----------------------------------------------------------------------------- @@ -65,6 +69,11 @@ wxGCDC::wxGCDC( const wxMemoryDC& dc) : { } +wxGCDC::wxGCDC( const wxPrinterDC& dc) : + wxDC( new wxGCDCImpl( this, dc ) ) +{ +} + wxGCDC::wxGCDC() : wxDC( new wxGCDCImpl( this ) ) { @@ -127,6 +136,13 @@ wxGCDCImpl::wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc ) : SetGraphicsContext( wxGraphicsContext::Create(dc) ); } +wxGCDCImpl::wxGCDCImpl( wxDC *owner, const wxPrinterDC& dc ) : + wxDCImpl( owner ) +{ + Init(); + SetGraphicsContext( wxGraphicsContext::Create(dc) ); +} + void wxGCDCImpl::Init() { m_ok = false; @@ -197,7 +213,7 @@ void wxGCDCImpl::EndPage() void wxGCDCImpl::Flush() { -#ifdef __WXMAC__ +#ifdef __WXOSX__ CGContextFlush( (CGContextRef) m_graphicContext->GetNativeContext() ); #endif } @@ -225,10 +241,10 @@ void wxGCDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h } } -void wxGCDCImpl::DoSetClippingRegionAsRegion( const wxRegion ®ion ) +void wxGCDCImpl::DoSetDeviceClippingRegion( const wxRegion ®ion ) { // region is in device coordinates - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoSetClippingRegionAsRegion - invalid DC") ); + wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoSetDeviceClippingRegion - invalid DC") ); if (region.Empty()) { @@ -351,11 +367,13 @@ void wxGCDCImpl::ComputeScaleAndOrigin() if ( m_graphicContext ) { m_matrixCurrent = m_graphicContext->CreateMatrix(); - m_matrixCurrent.Translate( m_deviceOriginX, m_deviceOriginY ); - m_matrixCurrent.Scale( m_scaleX, m_scaleY ); + // the logical origin sets the origin to have new coordinates - m_matrixCurrent.Translate( -m_logicalOriginX, -m_logicalOriginY ); - + m_matrixCurrent.Translate( m_deviceOriginX - m_logicalOriginX * m_signX * m_scaleX, + m_deviceOriginY-m_logicalOriginY * m_signY * m_scaleY); + + m_matrixCurrent.Scale( m_scaleX * m_signX, m_scaleY * m_signY ); + m_graphicContext->SetTransform( m_matrixOriginal ); m_graphicContext->ConcatTransform( m_matrixCurrent ); } @@ -537,21 +555,19 @@ void wxGCDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h, { wxGraphicsPath path = m_graphicContext->CreatePath(); path.MoveToPoint( 0, 0 ); - path.AddLineToPoint( h / 2.0 * cos(DegToRad(sa)) , h / 2.0 * sin(DegToRad(-sa)) ); - path.AddLineToPoint( h / 2.0 * cos(DegToRad(ea)) , h / 2.0 * sin(DegToRad(-ea)) ); + path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea ); path.AddLineToPoint( 0, 0 ); m_graphicContext->FillPath( path ); path = m_graphicContext->CreatePath(); path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea ); - m_graphicContext->FillPath( path ); m_graphicContext->StrokePath( path ); } else { wxGraphicsPath path = m_graphicContext->CreatePath(); - path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea ); - m_graphicContext->DrawPath( path ); + path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea ); + m_graphicContext->DrawPath( path ); } m_graphicContext->PopState();