X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0b2a860f0d3ee4724e3c0c5d2ba67a982c220b4a..d485bda109d5ef0fef36a3f737549e9b9f54baab:/src/x11/dcclient.cpp?ds=sidebyside diff --git a/src/x11/dcclient.cpp b/src/x11/dcclient.cpp index 945b8d5e6c..46a9657a24 100644 --- a/src/x11/dcclient.cpp +++ b/src/x11/dcclient.cpp @@ -621,7 +621,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 +641,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) ) { @@ -1658,7 +1658,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()) { @@ -1721,7 +1723,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 +1758,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 );