From: Václav Slavík Date: Tue, 19 Jan 2010 16:32:31 +0000 (+0000) Subject: Don't query metrics that won't be used. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e27619029d56533297ca5d79f614646d8c8354a2 Don't query metrics that won't be used. If ConvertPixelsToDialog() or ConvertDialogToPixels() was called with one of the two input values set to -1, the respective font metric was queried needlessly. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63192 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 6b8a69a150..a1ad50de45 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -2463,26 +2463,22 @@ void wxWindowBase::DoUpdateWindowUI(wxUpdateUIEvent& event) wxPoint wxWindowBase::ConvertPixelsToDialog(const wxPoint& pt) { - int charWidth = GetCharWidth(); - int charHeight = GetCharHeight(); wxPoint pt2 = wxDefaultPosition; if (pt.x != wxDefaultCoord) - pt2.x = (int) ((pt.x * 4) / charWidth); + pt2.x = (int) ((pt.x * 4) / GetCharWidth()); if (pt.y != wxDefaultCoord) - pt2.y = (int) ((pt.y * 8) / charHeight); + pt2.y = (int) ((pt.y * 8) / GetCharHeight()); return pt2; } wxPoint wxWindowBase::ConvertDialogToPixels(const wxPoint& pt) { - int charWidth = GetCharWidth(); - int charHeight = GetCharHeight(); wxPoint pt2 = wxDefaultPosition; if (pt.x != wxDefaultCoord) - pt2.x = (int) ((pt.x * charWidth) / 4); + pt2.x = (int) ((pt.x * GetCharWidth()) / 4); if (pt.y != wxDefaultCoord) - pt2.y = (int) ((pt.y * charHeight) / 8); + pt2.y = (int) ((pt.y * GetCharHeight()) / 8); return pt2; }