diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h index 14b648b092..f7d39c017b 100644 --- a/include/wx/gdicmn.h +++ b/include/wx/gdicmn.h @@ -292,8 +292,8 @@ public: wxSize& operator*=(long i) { x *= i; y *= i; return *this; } wxSize& operator/=(unsigned long i) { x /= i; y /= i; return *this; } wxSize& operator*=(unsigned long i) { x *= i; y *= i; return *this; } - wxSize& operator/=(double i) { x = int(x/i); y = int(y/i); return *this; } - wxSize& operator*=(double i) { x = int(x*i); y = int(y*i); return *this; } + wxSize& operator/=(double i) { x = wxRound(x/i); y = wxRound(y/i); return *this; } + wxSize& operator*=(double i) { x = wxRound(x*i); y = wxRound(y*i); return *this; } void IncTo(const wxSize& sz) { if ( sz.x > x ) x = sz.x; if ( sz.y > y ) y = sz.y; } @@ -318,8 +318,8 @@ public: void DecBy(int d) { DecBy(d, d); } - wxSize& Scale(float xscale, float yscale) - { x = (int)(x*xscale); y = (int)(y*yscale); return *this; } + wxSize& Scale(double xscale, double yscale) + { x = wxRound(x*xscale); y = wxRound(y*yscale); return *this; } // accessors void Set(int xx, int yy) { x = xx; y = yy; } @@ -428,12 +428,12 @@ inline wxSize operator*(unsigned long i, const wxSize& s) inline wxSize operator*(const wxSize& s, double i) { - return wxSize(int(s.x * i), int(s.y * i)); + return wxSize(wxRound(s.x * i), wxRound(s.y * i)); } inline wxSize operator*(double i, const wxSize& s) { - return wxSize(int(s.x * i), int(s.y * i)); + return wxSize(wxRound(s.x * i), wxRound(s.y * i)); } @@ -547,12 +547,12 @@ inline wxRealPoint operator*(unsigned long i, const wxRealPoint& s) inline wxRealPoint operator*(const wxRealPoint& s, double i) { - return wxRealPoint(int(s.x * i), int(s.y * i)); + return wxRealPoint(s.x * i, s.y * i); } inline wxRealPoint operator*(double i, const wxRealPoint& s) { - return wxRealPoint(int(s.x * i), int(s.y * i)); + return wxRealPoint(s.x * i, s.y * i); } @@ -567,7 +567,7 @@ public: wxPoint() : x(0), y(0) { } wxPoint(int xx, int yy) : x(xx), y(yy) { } - wxPoint(const wxRealPoint& pt) : x(int(pt.x)), y(int(pt.y)) { } + wxPoint(const wxRealPoint& pt) : x(wxRound(pt.x)), y(wxRound(pt.y)) { } // no copy ctor or assignment operator - the defaults are ok diff --git a/include/wx/unichar.h b/include/wx/unichar.h index bbd75466bf..5d731754b1 100644 --- a/include/wx/unichar.h +++ b/include/wx/unichar.h @@ -93,14 +93,14 @@ public: static wxUint16 HighSurrogate(wxUint32 value) { wxASSERT_MSG(IsSupplementary(value), "wxUniChar::HighSurrogate() must be called on a supplementary character"); - return 0xD800 | ((value - 0x10000) >> 10); + return static_cast(0xD800 | ((value - 0x10000) >> 10)); } // Returns the low surrogate code unit for the supplementary character static wxUint16 LowSurrogate(wxUint32 value) { wxASSERT_MSG(IsSupplementary(value), "wxUniChar::LowSurrogate() must be called on a supplementary character"); - return 0xDC00 | ((value - 0x10000) & 0x03FF); + return static_cast(0xDC00 | ((value - 0x10000) & 0x03FF)); } // Returns true if the character is a BMP character: diff --git a/interface/wx/gdicmn.h b/interface/wx/gdicmn.h index 5d18c2aa7a..6e98d29d88 100644 --- a/interface/wx/gdicmn.h +++ b/interface/wx/gdicmn.h @@ -1014,7 +1014,7 @@ public: @return A reference to this object (so that you can concatenate other operations in the same line). */ - wxSize& Scale(float xscale, float yscale); + wxSize& Scale(double xscale, double yscale); /** Sets the width and height members.