X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7b8d24ad99363a4328125516baaf45b2a2f27fce..9914bfbb77f48baf869b63aff58feb2b145ff4d3:/src/msw/dc.cpp diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 15f83c4955..675447fe3a 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -965,7 +965,7 @@ void wxMSWDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wx // Windows draws the filled rectangles without outline (i.e. drawn with a // transparent pen) one pixel smaller in both directions and we want them // to have the same size regardless of which pen is used - adjust - if ( m_pen.GetStyle() == wxPENSTYLE_TRANSPARENT ) + if ( m_pen.IsOk() && m_pen.GetStyle() == wxPENSTYLE_TRANSPARENT ) { x2++; y2++; @@ -1772,17 +1772,21 @@ void wxMSWDCImpl::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y } #endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - TEXTMETRIC tm; - ::GetTextMetrics(GetHdc(), &tm); - if (x) *x = sizeRect.cx; if (y) *y = sizeRect.cy; - if (descent) - *descent = tm.tmDescent; - if (externalLeading) - *externalLeading = tm.tmExternalLeading; + + if ( descent || externalLeading ) + { + TEXTMETRIC tm; + ::GetTextMetrics(GetHdc(), &tm); + + if (descent) + *descent = tm.tmDescent; + if (externalLeading) + *externalLeading = tm.tmExternalLeading; + } if ( hfontOld ) {