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
This commit is contained in:
@@ -2128,19 +2128,19 @@ int wxWindowMSW::GetCharWidth() const
|
|||||||
void wxWindowMSW::GetTextExtent(const wxString& string,
|
void wxWindowMSW::GetTextExtent(const wxString& string,
|
||||||
int *x, int *y,
|
int *x, int *y,
|
||||||
int *descent, int *externalLeading,
|
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()") );
|
_T("invalid font in GetTextExtent()") );
|
||||||
|
|
||||||
wxFont fontToUse;
|
HFONT hfontToUse;
|
||||||
if (theFont)
|
if ( fontToUse )
|
||||||
fontToUse = *theFont;
|
hfontToUse = GetHfontOf(*fontToUse);
|
||||||
else
|
else
|
||||||
fontToUse = GetFont();
|
hfontToUse = GetHfontOf(GetFont());
|
||||||
|
|
||||||
WindowHDC hdc(GetHwnd());
|
WindowHDC hdc(GetHwnd());
|
||||||
SelectInHDC selectFont(hdc, GetHfontOf(fontToUse));
|
SelectInHDC selectFont(hdc, hfontToUse);
|
||||||
|
|
||||||
SIZE sizeRect;
|
SIZE sizeRect;
|
||||||
TEXTMETRIC tm;
|
TEXTMETRIC tm;
|
||||||
|
Reference in New Issue
Block a user