From 73be12817496a159eff7d99fdf57a4d94e887a8d Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Wed, 18 May 2011 07:32:58 +0000 Subject: [PATCH] making sure clip (device coordinages) is applied before any transforms, fixes #13216 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67761 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/carbon/graphics.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/osx/carbon/graphics.cpp b/src/osx/carbon/graphics.cpp index cab2c06212..0b845f0afa 100644 --- a/src/osx/carbon/graphics.cpp +++ b/src/osx/carbon/graphics.cpp @@ -1703,16 +1703,10 @@ bool wxMacCoreGraphicsContext::EnsureIsValid() if ( m_cgContext ) { CGContextSaveGState( m_cgContext ); - CGContextConcatCTM( m_cgContext, m_windowTransform ); - CGContextSetTextMatrix( m_cgContext, CGAffineTransformIdentity ); - m_contextSynthesized = true; #if wxOSX_USE_COCOA_OR_CARBON if ( m_clipRgn.get() ) { - // the clip region is in device coordinates, so we convert this again to user coordinates wxCFRef hishape( HIShapeCreateMutableCopy( m_clipRgn ) ); - CGPoint transformedOrigin = CGPointApplyAffineTransform( CGPointZero,m_windowTransform); - HIShapeOffset( hishape, -transformedOrigin.x, -transformedOrigin.y ); // if the shape is empty, HIShapeReplacePathInCGContext doesn't work if ( HIShapeIsEmpty(hishape)) { @@ -1726,6 +1720,9 @@ bool wxMacCoreGraphicsContext::EnsureIsValid() } } #endif + CGContextConcatCTM( m_cgContext, m_windowTransform ); + CGContextSetTextMatrix( m_cgContext, CGAffineTransformIdentity ); + m_contextSynthesized = true; CGContextSaveGState( m_cgContext ); #if 0 // turn on for debugging of clientdc @@ -1955,6 +1952,7 @@ void wxMacCoreGraphicsContext::Clip( wxDouble x, wxDouble y, wxDouble w, wxDoubl // the clipping itself must be stored as device coordinates, otherwise // we cannot apply it back correctly r.origin= CGPointApplyAffineTransform( r.origin, m_windowTransform ); + r.size= CGSizeApplyAffineTransform(r.size, m_windowTransform); m_clipRgn.reset(HIShapeCreateWithRect(&r)); #else // allow usage as measuring context -- 2.45.2