From ca9a48598de1d93f46ed6729f57e28421cb0b5e5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 20 Aug 2021 21:32:55 +0200 Subject: [PATCH] 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 --- src/common/textmeasurecmn.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/textmeasurecmn.cpp b/src/common/textmeasurecmn.cpp index 28427d8fc9..60ce44b507 100644 --- a/src/common/textmeasurecmn.cpp +++ b/src/common/textmeasurecmn.cpp @@ -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) )