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
wxPoint wxWindowBase::ConvertPixelsToDialog(const wxPoint& pt)
{
wxPoint wxWindowBase::ConvertPixelsToDialog(const wxPoint& pt)
{
- int charWidth = GetCharWidth();
- int charHeight = GetCharHeight();
wxPoint pt2 = wxDefaultPosition;
if (pt.x != wxDefaultCoord)
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)
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)
{
return pt2;
}
wxPoint wxWindowBase::ConvertDialogToPixels(const wxPoint& pt)
{
- int charWidth = GetCharWidth();
- int charHeight = GetCharHeight();
wxPoint pt2 = wxDefaultPosition;
if (pt.x != wxDefaultCoord)
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)
if (pt.y != wxDefaultCoord)
- pt2.y = (int) ((pt.y * charHeight) / 8);
+ pt2.y = (int) ((pt.y * GetCharHeight()) / 8);