Add compound operators * and / to wxPoint and wxRealPoint

Also add unit tests for them as well as for the existing additive
compound operators.
This commit is contained in:
David Miguel Susano Pinto 2024-01-04 02:08:41 +00:00 committed by Vadim Zeitlin
parent 1300c56f0d
commit 68bef2fbf3
3 changed files with 52 additions and 0 deletions

View file

@ -472,6 +472,8 @@ public:
wxRealPoint& operator/=(int i) { x *= i; y *= i; return *this; }
wxRealPoint& operator*=(int i) { x /= i; y /= i; return *this; }
wxRealPoint& operator/=(double f) { x /= f; y /= f; return *this; }
wxRealPoint& operator*=(double f) { x *= f; y *= f; return *this; }
};
@ -620,6 +622,8 @@ public:
wxPoint& operator/=(int i) { x /= i, y /= i; return *this; }
wxPoint& operator*=(int i) { x *= i, y *= i; return *this; }
wxPoint& operator/=(double f) { x = wxRound(x/f); y = wxRound(y/f); return *this; }
wxPoint& operator*=(double f) { x = wxRound(x*f); y = wxRound(y*f); return *this; }
// check if both components are set/initialized
bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; }