From 844ec191f0e828f7a166bc15cec315cd7f3b9572 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 15 Jul 2020 01:21:59 +0200 Subject: [PATCH] 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. --- src/common/textmeasurecmn.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/textmeasurecmn.cpp b/src/common/textmeasurecmn.cpp index f553f7f474..e060fb18b5 100644 --- a/src/common/textmeasurecmn.cpp +++ b/src/common/textmeasurecmn.cpp @@ -123,18 +123,18 @@ void wxTextMeasureBase::GetMultiLineTextExtent(const wxString& text, *width = 0; *height = 0; + MeasuringGuard guard(*this); + // 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. if ( text.find('\n') == wxString::npos ) { - GetTextExtent(text, width, height); + CallGetTextExtent(text, width, height); if ( heightOneLine ) *heightOneLine = *height; return; } - MeasuringGuard guard(*this); - wxCoord widthLine, heightLine = 0, heightLineDefault = 0; wxString::const_iterator lineStart = text.begin();