adding the 0.5 offset for odd pen widths
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41937 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -266,8 +266,23 @@ void wxMacCGContext::Clip( const wxRegion ®ion )
|
|||||||
void wxMacCGContext::StrokePath( const wxGraphicPath *p )
|
void wxMacCGContext::StrokePath( const wxGraphicPath *p )
|
||||||
{
|
{
|
||||||
const wxMacCGPath* path = dynamic_cast< const wxMacCGPath*>( p ) ;
|
const wxMacCGPath* path = dynamic_cast< const wxMacCGPath*>( p ) ;
|
||||||
|
|
||||||
|
int width = m_pen.GetWidth();
|
||||||
|
if ( width == 0 )
|
||||||
|
width = 1 ;
|
||||||
|
if ( m_pen.GetStyle() == wxTRANSPARENT )
|
||||||
|
width = 0 ;
|
||||||
|
|
||||||
|
bool offset = ( width % 2 ) == 1 ;
|
||||||
|
|
||||||
|
if ( offset )
|
||||||
|
CGContextTranslateCTM( m_cgContext, 0.5, 0.5 );
|
||||||
|
|
||||||
CGContextAddPath( m_cgContext , path->GetPath() ) ;
|
CGContextAddPath( m_cgContext , path->GetPath() ) ;
|
||||||
CGContextStrokePath( m_cgContext ) ;
|
CGContextStrokePath( m_cgContext ) ;
|
||||||
|
|
||||||
|
if ( offset )
|
||||||
|
CGContextTranslateCTM( m_cgContext, -0.5, -0.5 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacCGContext::DrawPath( const wxGraphicPath *p , int fillStyle )
|
void wxMacCGContext::DrawPath( const wxGraphicPath *p , int fillStyle )
|
||||||
@@ -283,8 +298,22 @@ void wxMacCGContext::DrawPath( const wxGraphicPath *p , int fillStyle )
|
|||||||
mode = kCGPathEOFillStroke ;
|
mode = kCGPathEOFillStroke ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int width = m_pen.GetWidth();
|
||||||
|
if ( width == 0 )
|
||||||
|
width = 1 ;
|
||||||
|
if ( m_pen.GetStyle() == wxTRANSPARENT )
|
||||||
|
width = 0 ;
|
||||||
|
|
||||||
|
bool offset = ( width % 2 ) == 1 ;
|
||||||
|
|
||||||
|
if ( offset )
|
||||||
|
CGContextTranslateCTM( m_cgContext, 0.5, 0.5 );
|
||||||
|
|
||||||
CGContextAddPath( m_cgContext , path->GetPath() ) ;
|
CGContextAddPath( m_cgContext , path->GetPath() ) ;
|
||||||
CGContextDrawPath( m_cgContext , mode ) ;
|
CGContextDrawPath( m_cgContext , mode ) ;
|
||||||
|
|
||||||
|
if ( offset )
|
||||||
|
CGContextTranslateCTM( m_cgContext, -0.5, -0.5 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacCGContext::FillPath( const wxGraphicPath *p , const wxColor &fillColor , int fillStyle )
|
void wxMacCGContext::FillPath( const wxGraphicPath *p , const wxColor &fillColor , int fillStyle )
|
||||||
|
Reference in New Issue
Block a user