Avoid copying the font object unnecessarily in wxTextMeasureBase

This change slightly modifies the parent commit by avoiding an
unnecessary copy of wxFont which, while cheap, is not quite free and
can be easily avoided here.

See https://github.com/wxWidgets/wxWidgets/pull/2471
This commit is contained in:
Vadim Zeitlin
2021-08-20 21:32:55 +02:00
parent eb76f400d2
commit ca9a48598d

View File

@@ -263,7 +263,7 @@ bool wxTextMeasureBase::DoGetPartialTextExtents(const wxString& text,
int totalWidth = 0;
// reset the cache if font or horizontal scale have changed
const wxFont font = GetFont();
const wxFont& font = GetFont();
if ( !s_fontWidthCache.m_widths ||
!wxIsSameDouble(s_fontWidthCache.m_scaleX, scaleX) ||
(s_fontWidthCache.m_font != font) )