From e044841350133ce453d5ea6955b2a663c3d3dd9e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 16 Jan 2008 01:43:00 +0000 Subject: [PATCH] don't create unnecessary temporary wxFont (patch theFont) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51229 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/window.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index d035da942b..01404611b6 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -2128,19 +2128,19 @@ int wxWindowMSW::GetCharWidth() const void wxWindowMSW::GetTextExtent(const wxString& string, int *x, int *y, int *descent, int *externalLeading, - const wxFont *theFont) const + const wxFont *fontToUse) const { - wxASSERT_MSG( !theFont || theFont->Ok(), + wxASSERT_MSG( !fontToUse || fontToUse->Ok(), _T("invalid font in GetTextExtent()") ); - wxFont fontToUse; - if (theFont) - fontToUse = *theFont; + HFONT hfontToUse; + if ( fontToUse ) + hfontToUse = GetHfontOf(*fontToUse); else - fontToUse = GetFont(); + hfontToUse = GetHfontOf(GetFont()); WindowHDC hdc(GetHwnd()); - SelectInHDC selectFont(hdc, GetHfontOf(fontToUse)); + SelectInHDC selectFont(hdc, hfontToUse); SIZE sizeRect; TEXTMETRIC tm; -- 2.45.2