Make wxRescaleCoord() safer by requiring explicitly using From/To

This should help with accidentally exchanging the order of parameters
and makes the code using this function more readable.

No real changes.
This commit is contained in:
Vadim Zeitlin
2021-07-13 17:46:02 +01:00
parent 7843c99d5b
commit 035c29e6a2
5 changed files with 96 additions and 29 deletions

View File

@@ -3142,10 +3142,10 @@ public:
// Scale the value by the ratio between new and old DPIs carried by this
// event.
int ScaleX(int x) const;
int ScaleY(int y) const;
wxSize Scale(wxSize sz) const;
wxSize Scale(wxSize sz) const { return wxSize(ScaleX(sz.x), ScaleY(sz.y)); }
int ScaleX(int x) const { return Scale(wxSize(x, -1)).x; }
int ScaleY(int y) const { return Scale(wxSize(-1, y)).y; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxDPIChangedEvent(*this); }