Use CallGetTextExtent() directly in GetMultiLineTextExtent()

There is no need to pass by GetTextExtent() now that we already make
sure width/height are non-null in this function, so just construct the
MeasuringGuard slightly earlier and call CallGetTextExtent() directly.

No real changes.
This commit is contained in:
Vadim Zeitlin
2020-07-15 01:21:59 +02:00
parent 55c71fdac9
commit 844ec191f0

View File

@@ -123,18 +123,18 @@ void wxTextMeasureBase::GetMultiLineTextExtent(const wxString& text,
*width = 0; *width = 0;
*height = 0; *height = 0;
MeasuringGuard guard(*this);
// It's noticeably faster to handle the case of a string which isn't // It's noticeably faster to handle the case of a string which isn't
// actually multiline specially here, to skip iteration above in this case. // actually multiline specially here, to skip iteration above in this case.
if ( text.find('\n') == wxString::npos ) if ( text.find('\n') == wxString::npos )
{ {
GetTextExtent(text, width, height); CallGetTextExtent(text, width, height);
if ( heightOneLine ) if ( heightOneLine )
*heightOneLine = *height; *heightOneLine = *height;
return; return;
} }
MeasuringGuard guard(*this);
wxCoord widthLine, heightLine = 0, heightLineDefault = 0; wxCoord widthLine, heightLine = 0, heightLineDefault = 0;
wxString::const_iterator lineStart = text.begin(); wxString::const_iterator lineStart = text.begin();