X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a7868cdf6a8782a04a46791dd63de2ade825a8bc..83e8b44cc0bf8a2a8f162c67162f9ed68accd15f:/src/mac/carbon/graphics.cpp?ds=sidebyside diff --git a/src/mac/carbon/graphics.cpp b/src/mac/carbon/graphics.cpp index a79c96bfc9..3778c0d47c 100755 --- a/src/mac/carbon/graphics.cpp +++ b/src/mac/carbon/graphics.cpp @@ -796,7 +796,7 @@ bool wxMacCoreGraphicsMatrixData::IsEqual( const wxGraphicsMatrixData* t) const { const CGAffineTransform* tm = (CGAffineTransform*) t->GetNativeMatrix(); #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - if ( CGAffineTransformEqualToTransform ) + if ( CGAffineTransformEqualToTransform!=NULL ) { return CGAffineTransformEqualToTransform(m_matrix, *((CGAffineTransform*) t->GetNativeMatrix())); } @@ -1050,7 +1050,7 @@ void wxMacCoreGraphicsPathData::GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wx bool wxMacCoreGraphicsPathData::Contains( wxDouble x, wxDouble y, int fillStyle) const { #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - if ( CGPathContainsPoint ) + if ( CGPathContainsPoint!=NULL ) { return CGPathContainsPoint( m_path, NULL, CGPointMake(x,y), fillStyle == wxODDEVEN_RULE ); } @@ -1494,7 +1494,33 @@ void wxMacCoreGraphicsContext::DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDo CGImageRef image = (CGImageRef)( bmp.CGImageCreate() ); HIRect r = CGRectMake( x , y , w , h ); - HIViewDrawCGImage( m_cgContext , &r , image ); + if ( bmp.GetDepth() == 1 ) + { + // is is a mask, the '1' in the mask tell where to draw the current brush + if ( !m_brush.IsNull() ) + { + if ( ((wxMacCoreGraphicsBrushData*)m_brush.GetRefData())->IsShading() ) + { + // TODO clip to mask + /* + CGContextSaveGState( m_cgContext ); + CGContextAddPath( m_cgContext , (CGPathRef) path.GetNativePath() ); + CGContextClip( m_cgContext ); + CGContextDrawShading( m_cgContext, ((wxMacCoreGraphicsBrushData*)m_brush.GetRefData())->GetShading() ); + CGContextRestoreGState( m_cgContext); + */ + } + else + { + ((wxMacCoreGraphicsBrushData*)m_brush.GetRefData())->Apply(this); + HIViewDrawCGImage( m_cgContext , &r , image ); + } + } + } + else + { + HIViewDrawCGImage( m_cgContext , &r , image ); + } CGImageRelease( image ); } @@ -1843,6 +1869,8 @@ public : virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ); virtual wxGraphicsContext * CreateContext( wxWindow* window ); + + virtual wxGraphicsContext * CreateMeasuringContext(); // Path @@ -1908,6 +1936,11 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( wxWindow* window ) return new wxMacCoreGraphicsContext(this, window ); } +wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateMeasuringContext() +{ + return new wxMacCoreGraphicsContext(this); +} + // Path wxGraphicsPath wxMacCoreGraphicsRenderer::CreatePath()