X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/02e2609962760aad5e859244ff2e4c4c15d1c739..e733c4ce1e24cf7e4b0b0d8362fc59aaa7a7641c:/src/x11/dcclient.cpp diff --git a/src/x11/dcclient.cpp b/src/x11/dcclient.cpp index 6ef0cb4f33..1b4f0c303b 100644 --- a/src/x11/dcclient.cpp +++ b/src/x11/dcclient.cpp @@ -4,7 +4,6 @@ // Author: Julian Smart, Robert Roebling // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ // Copyright: (c) Julian Smart, Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -621,7 +620,7 @@ void wxWindowDCImpl::DoDrawPoint( wxCoord x, wxCoord y ) CalcBoundingBox (x, y); } -void wxWindowDCImpl::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset ) +void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset ) { wxCHECK_RET( IsOk(), wxT("invalid window dc") ); @@ -641,7 +640,7 @@ void wxWindowDCImpl::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCo delete[] xpoints; } -void wxWindowDCImpl::DoDrawPolygon( int n, wxPoint points[], +void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode WXUNUSED(fillStyle) ) { @@ -1570,7 +1569,7 @@ void wxWindowDCImpl::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) PangoLayout *layout = pango_layout_new(m_context); pango_layout_set_font_description(layout, m_fontdesc); - const wxCharBuffer data = wxConvUTF8.cWC2MB( text ); + const wxScopedCharBuffer data(text.utf8_str()); pango_layout_set_text(layout, data, data.length()); // Measure layout. @@ -1658,7 +1657,9 @@ void wxWindowDCImpl::DoGetTextExtent( const wxString &string, wxCoord *width, wx wxCoord *descent, wxCoord *externalLeading, const wxFont *font ) const { - wxCHECK_RET( IsOk(), wxT("invalid dc") ); + // Do not test for DC validity here, querying text extents is supposed to + // work even with a non-initialized wxMemoryDC. And the code below does + // actually work in this case. if (string.empty()) { @@ -1675,7 +1676,7 @@ void wxWindowDCImpl::DoGetTextExtent( const wxString &string, wxCoord *width, wx else pango_layout_set_font_description(layout, m_fontdesc); - const wxCharBuffer data = wxConvUTF8.cWC2MB( string ); + const wxScopedCharBuffer data(string.utf8_str()); pango_layout_set_text(layout, data, data.length()); // Measure text. @@ -1721,7 +1722,8 @@ void wxWindowDCImpl::DoGetTextExtent( const wxString &string, wxCoord *width, wx wxCoord wxWindowDCImpl::GetCharWidth() const { - wxCHECK_MSG( IsOk(), 0, wxT("invalid dc") ); + // Do not test for DC validity here for the same reasons as in + // DoGetTextExtent() above. #if wxUSE_UNICODE PangoLayout *layout = pango_layout_new( m_context ); @@ -1755,7 +1757,8 @@ wxCoord wxWindowDCImpl::GetCharWidth() const wxCoord wxWindowDCImpl::GetCharHeight() const { - wxCHECK_MSG( IsOk(), 0, wxT("invalid dc") ); + // Do not test for DC validity here for the same reasons as in + // DoGetTextExtent() above. #if wxUSE_UNICODE PangoLayout *layout = pango_layout_new( m_context ); @@ -2318,7 +2321,7 @@ void wxWindowDCImpl::ComputeScaleAndOrigin() wxDCImpl::ComputeScaleAndOrigin(); - /* CMB: if scale has changed call SetPen to recalulate the line width */ + /* CMB: if scale has changed call SetPen to recalculate the line width */ if ((m_scaleX != origScaleX || m_scaleY != origScaleY) && (m_pen.IsOk())) {