using old code for carbon only, new code for cocoa, fixing doubly apply flip of y axis

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75999 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2014-02-24 08:17:15 +00:00
parent c8b105a5f5
commit bd45a79a99

View File

@ -2250,23 +2250,21 @@ void wxMacCoreGraphicsContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDoubl
if (m_composition == wxCOMPOSITION_DEST) if (m_composition == wxCOMPOSITION_DEST)
return; return;
#if wxOSX_USE_CARBON
CGContextSaveGState( m_cgContext ); CGContextSaveGState( m_cgContext );
CGContextTranslateCTM( m_cgContext,(CGFloat) x ,(CGFloat) (y + h) ); CGContextTranslateCTM( m_cgContext,(CGFloat) x ,(CGFloat) (y + h) );
CGContextScaleCTM( m_cgContext, 1, -1 ); CGContextScaleCTM( m_cgContext, 1, -1 );
#if wxOSX_USE_COCOA_OR_CARBON
#if 1
CGRect r = CGRectMake( (CGFloat) 0.0 , (CGFloat) 0.0 , (CGFloat) w , (CGFloat) h ); CGRect r = CGRectMake( (CGFloat) 0.0 , (CGFloat) 0.0 , (CGFloat) w , (CGFloat) h );
PlotIconRefInContext( m_cgContext , &r , kAlignNone , kTransformNone , PlotIconRefInContext( m_cgContext , &r , kAlignNone , kTransformNone ,
NULL , kPlotIconRefNormalFlags , icon.GetHICON() ); NULL , kPlotIconRefNormalFlags , icon.GetHICON() );
#else CGContextRestoreGState( m_cgContext );
CGRect r = CGRectMake( (CGFloat) 0.0 , (CGFloat) 0.0 , (CGFloat) w , (CGFloat) h ); #elif wxOSX_USE_COCOA
CGRect r = CGRectMake( (CGFloat) x , (CGFloat) y , (CGFloat) w , (CGFloat) h );
const WX_NSImage nsImage = icon.GetNSImage(); const WX_NSImage nsImage = icon.GetNSImage();
CGImageRef cgImage = wxOSXGetCGImageFromNSImage( nsImage , &r, m_cgContext ); CGImageRef cgImage = wxOSXGetCGImageFromNSImage( nsImage , &r, m_cgContext );
wxMacDrawCGImage( m_cgContext, &r, cgImage); wxMacDrawCGImage( m_cgContext, &r, cgImage);
#endif #endif
#endif
CGContextRestoreGState( m_cgContext );
CheckInvariants(); CheckInvariants();
} }