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
This commit is contained in:
@@ -2463,26 +2463,22 @@ void wxWindowBase::DoUpdateWindowUI(wxUpdateUIEvent& event)
|
|||||||
|
|
||||||
wxPoint wxWindowBase::ConvertPixelsToDialog(const wxPoint& pt)
|
wxPoint wxWindowBase::ConvertPixelsToDialog(const wxPoint& pt)
|
||||||
{
|
{
|
||||||
int charWidth = GetCharWidth();
|
|
||||||
int charHeight = GetCharHeight();
|
|
||||||
wxPoint pt2 = wxDefaultPosition;
|
wxPoint pt2 = wxDefaultPosition;
|
||||||
if (pt.x != wxDefaultCoord)
|
if (pt.x != wxDefaultCoord)
|
||||||
pt2.x = (int) ((pt.x * 4) / charWidth);
|
pt2.x = (int) ((pt.x * 4) / GetCharWidth());
|
||||||
if (pt.y != wxDefaultCoord)
|
if (pt.y != wxDefaultCoord)
|
||||||
pt2.y = (int) ((pt.y * 8) / charHeight);
|
pt2.y = (int) ((pt.y * 8) / GetCharHeight());
|
||||||
|
|
||||||
return pt2;
|
return pt2;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPoint wxWindowBase::ConvertDialogToPixels(const wxPoint& pt)
|
wxPoint wxWindowBase::ConvertDialogToPixels(const wxPoint& pt)
|
||||||
{
|
{
|
||||||
int charWidth = GetCharWidth();
|
|
||||||
int charHeight = GetCharHeight();
|
|
||||||
wxPoint pt2 = wxDefaultPosition;
|
wxPoint pt2 = wxDefaultPosition;
|
||||||
if (pt.x != wxDefaultCoord)
|
if (pt.x != wxDefaultCoord)
|
||||||
pt2.x = (int) ((pt.x * charWidth) / 4);
|
pt2.x = (int) ((pt.x * GetCharWidth()) / 4);
|
||||||
if (pt.y != wxDefaultCoord)
|
if (pt.y != wxDefaultCoord)
|
||||||
pt2.y = (int) ((pt.y * charHeight) / 8);
|
pt2.y = (int) ((pt.y * GetCharHeight()) / 8);
|
||||||
|
|
||||||
return pt2;
|
return pt2;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user