X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f69e200970580080565c8aadc10893c29e46abeb..b1f0abe45eb527ed765be19440329ede84b6e35e:/src/gtk/dcclient.cpp diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 707f88fbc5..e38f88b998 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -1147,7 +1147,21 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, } else { - gdk_draw_pixmap( m_window, m_penGC, use_bitmap.GetPixmap(), 0, 0, xx, yy, -1, -1 ); +#if GTK_CHECK_VERSION(2,2,0) + if (use_bitmap.HasPixbuf()) + { + gdk_draw_pixbuf(m_window, m_penGC, + use_bitmap.GetPixbuf(), + 0, 0, xx, yy, -1, -1, + GDK_RGB_DITHER_NORMAL, xx, yy); + } + else +#endif + { + gdk_draw_pixmap(m_window, m_penGC, + use_bitmap.GetPixmap(), + 0, 0, xx, yy, -1, -1); + } } // remove mask again if any @@ -1473,6 +1487,8 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) const wxCharBuffer data = wxConvUTF8.cWC2MB( text ); #else const wxWCharBuffer wdata = wxConvLocal.cMB2WC( text ); + if ( !wdata ) + return; const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata ); #endif size_t datalen = strlen((const char*)data); @@ -1695,10 +1711,17 @@ void wxWindowDC::DoGetTextExtent(const wxString &string, wxCoord *descent, wxCoord *externalLeading, wxFont *theFont) const { + if ( width ) + *width = 0; + if ( height ) + *height = 0; + if ( descent ) + *descent = 0; + if ( externalLeading ) + *externalLeading = 0; + if (string.IsEmpty()) { - if (width) (*width) = 0; - if (height) (*height) = 0; return; } @@ -1714,7 +1737,11 @@ void wxWindowDC::DoGetTextExtent(const wxString &string, #else const wxWCharBuffer wdata = wxConvLocal.cMB2WC( string ); if ( !wdata ) + { + if (width) (*width) = 0; + if (height) (*height) = 0; return; + } const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata ); const char *dataUTF8 = (const char *)data; #endif @@ -1741,21 +1768,25 @@ void wxWindowDC::DoGetTextExtent(const wxString &string, pango_layout_iter_free(iter); *descent = h - PANGO_PIXELS(baseline); } - if (externalLeading) - *externalLeading = 0; // ?? // Reset old font description if (theFont) pango_layout_set_font_description( m_layout, m_fontdesc ); #else // GTK+ 1.x wxFont fontToUse = m_font; - if (theFont) fontToUse = *theFont; + if (theFont) + fontToUse = *theFont; GdkFont *font = fontToUse.GetInternalFont( m_scaleY ); - if (width) (*width) = wxCoord(gdk_string_width( font, string.mbc_str() ) / m_scaleX); - if (height) (*height) = wxCoord((font->ascent + font->descent) / m_scaleY); - if (descent) (*descent) = wxCoord(font->descent / m_scaleY); - if (externalLeading) (*externalLeading) = 0; // ?? + if ( !font ) + return; + + if (width) + *width = wxCoord(gdk_string_width( font, string.mbc_str() ) / m_scaleX); + if (height) + *height = wxCoord((font->ascent + font->descent) / m_scaleY); + if (descent) + *descent = wxCoord(font->descent / m_scaleY); #endif // GTK+ 2/1 }