Implement + and - between wxRealPoint and wxSize.

These operators are part of the documented interface for wxRealPoint
but were never implemented.  This commit implements them.
This commit is contained in:
David Miguel Susano Pinto 2024-01-04 01:19:09 +00:00
parent 8ccbd7e95d
commit 66e7d0bce8

View file

@ -490,12 +490,30 @@ inline wxRealPoint operator+(const wxRealPoint& p1, const wxRealPoint& p2)
return wxRealPoint(p1.x + p2.x, p1.y + p2.y);
}
inline wxRealPoint operator-(const wxRealPoint& p1, const wxRealPoint& p2)
{
return wxRealPoint(p1.x - p2.x, p1.y - p2.y);
}
inline wxRealPoint operator+(const wxRealPoint& pt, const wxSize& sz)
{
return wxRealPoint(pt.x + sz.GetWidth(), pt.y + sz.GetHeight());
}
inline wxRealPoint operator-(const wxRealPoint& pt, const wxSize& sz)
{
return wxRealPoint(pt.x - sz.GetWidth(), pt.y - sz.GetHeight());
}
inline wxRealPoint operator+(const wxSize& sz, const wxRealPoint& pt)
{
return wxRealPoint(sz.GetWidth() + pt.x, sz.GetHeight() + pt.y);
}
inline wxRealPoint operator-(const wxSize& sz, const wxRealPoint& pt)
{
return wxRealPoint(sz.GetWidth() - pt.x, sz.GetHeight() - pt.y);
}
inline wxRealPoint operator/(const wxRealPoint& p, int i)
{