X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9535b4790b5e093a79208cf890f5d5f00590c054..f4bc1aa27cb33f679d7e9c1518a7855bbc1fa471:/src/osx/carbon/graphics.cpp?ds=inline diff --git a/src/osx/carbon/graphics.cpp b/src/osx/carbon/graphics.cpp index 07446d9a17..436b9f8dd1 100644 --- a/src/osx/carbon/graphics.cpp +++ b/src/osx/carbon/graphics.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/mac/carbon/dccg.cpp +// Name: src/osx/carbon/dccg.cpp // Purpose: wxDC class // Author: Stefan Csomor // Modified by: @@ -103,8 +103,13 @@ OSStatus wxMacDrawCGImage( #if wxOSX_USE_CARBON return HIViewDrawCGImage( inContext, inBounds, inImage ); #else - // todo flip - CGContextDrawImage(inContext, *inBounds, inImage ); + CGContextSaveGState(inContext); + CGContextTranslateCTM(inContext, inBounds->origin.x, inBounds->origin.y + inBounds->size.height); + CGRect r = *inBounds; + r.origin.x = r.origin.y = 0; + CGContextScaleCTM(inContext, 1, -1); + CGContextDrawImage(inContext, r, inImage ); + CGContextRestoreGState(inContext); return noErr; #endif } @@ -1941,8 +1946,7 @@ void wxMacCoreGraphicsContext::PopState() void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y ) { - if ( m_font.IsNull() ) - return; + wxCHECK_RET( !m_font.IsNull(), wxT("wxMacCoreGraphicsContext::DrawText - no valid font set") ); EnsureIsValid(); #if wxOSX_USE_CORE_TEXT @@ -1998,8 +2002,7 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle ) { - if ( m_font.IsNull() ) - return; + wxCHECK_RET( !m_font.IsNull(), wxT("wxMacCoreGraphicsContext::DrawText - no valid font set") ); EnsureIsValid(); #if wxOSX_USE_CORE_TEXT @@ -2103,7 +2106,7 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height, wxDouble *descent, wxDouble *externalLeading ) const { - wxCHECK_RET( !m_font.IsNull(), wxT("wxDC(cg)::DoGetTextExtent - no valid font set") ); + wxCHECK_RET( !m_font.IsNull(), wxT("wxMacCoreGraphicsContext::GetTextExtent - no valid font set") ); if ( width ) *width = 0; @@ -2207,6 +2210,8 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr widths.Empty(); widths.Add(0, text.length()); + wxCHECK_RET( !m_font.IsNull(), wxT("wxMacCoreGraphicsContext::DrawText - no valid font set") ); + if (text.empty()) return;