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:
@@ -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) )
|
||||
|
Reference in New Issue
Block a user