No real changes, just simplify wxGDIPlusContext::GetTextExtent() a bit.

Don't call Font::GetSize() and FontFamily::GetEmHeight() thrice, just do it
once and store the results. This makes the code both simpler and shorter and
marginally more efficient.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71822 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-06-20 17:54:49 +00:00
parent b437ff98b0
commit 6fafab0ea3

View File

@@ -1773,12 +1773,11 @@ void wxGDIPlusContext::GetTextExtent( const wxString &str, wxDouble *width, wxDo
// Notice that we must use the real font style or the results would be
// incorrect for italic/bold fonts.
const INT style = f->GetStyle();
REAL rDescent = ffamily.GetCellDescent(style) *
f->GetSize() / ffamily.GetEmHeight(style);
REAL rAscent = ffamily.GetCellAscent(style) *
f->GetSize() / ffamily.GetEmHeight(style);
REAL rHeight = ffamily.GetLineSpacing(style) *
f->GetSize() / ffamily.GetEmHeight(style);
const REAL size = f->GetSize();
const REAL emHeight = ffamily.GetEmHeight(style);
REAL rDescent = ffamily.GetCellDescent(style) * size / emHeight;
REAL rAscent = ffamily.GetCellAscent(style) * size / emHeight;
REAL rHeight = ffamily.GetLineSpacing(style) * size / emHeight;
if ( height )
*height = rHeight * factorY;