A micro-optimization: avoid ::GetTextMetrics() call if we don't use its
results (as is the case if neither descent nor external leading were
requested).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62926
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
}
#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400)
- TEXTMETRIC tm;
- ::GetTextMetrics(GetHdc(), &tm);
-
if (x)
*x = sizeRect.cx;
if (y)
*y = sizeRect.cy;
- if (descent)
- *descent = tm.tmDescent;
- if (externalLeading)
- *externalLeading = tm.tmExternalLeading;
+
+ if ( descent || externalLeading )
+ {
+ TEXTMETRIC tm;
+ ::GetTextMetrics(GetHdc(), &tm);
+
+ if (descent)
+ *descent = tm.tmDescent;
+ if (externalLeading)
+ *externalLeading = tm.tmExternalLeading;
+ }
if ( hfontOld )
{