From: sub.mohanty@samsung.com Date: Sun, 21 Jul 2019 06:24:28 +0000 (+0900) Subject: vector: changed conversion constructor to conversion operator X-Git-Tag: submit/tizen/20190723.044916~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c1cd39e44bef6a16563f578a998a66c7f7f58063;p=platform%2Fcore%2Fuifw%2Flottie-player.git vector: changed conversion constructor to conversion operator --- diff --git a/src/vector/vrect.h b/src/vector/vrect.h index 3d13a4c..1b1f59b 100644 --- a/src/vector/vrect.h +++ b/src/vector/vrect.h @@ -29,7 +29,7 @@ public: VRect() = default; VRect(int x, int y, int w, int h):x1(x),y1(y),x2(x+w),y2(y+h){} explicit VRect(VPoint pt, VSize sz):VRect(pt.x(), pt.y(), sz.width(), sz.height()){} - explicit VRect(const VRectF &r); + operator VRectF() const; V_CONSTEXPR bool empty() const {return x1 >= x2 || y1 >= y2;} V_CONSTEXPR int left() const {return x1;} V_CONSTEXPR int top() const {return y1;} @@ -120,8 +120,9 @@ public: VRectF(double x, double y, double w, double h): x1(float(x)),y1(float(y)), x2(float(x+w)),y2(float(y+h)){} - - explicit VRectF(const VRect &r):VRectF(r.x(), r.y(), r.width(), r.height()){} + operator VRect() const { + return {int(left()), int(right()), int(width()), int(height())}; + } V_CONSTEXPR bool empty() const {return x1 >= x2 || y1 >= y2;} V_CONSTEXPR float left() const {return x1;} @@ -157,8 +158,11 @@ private: float y2{0}; }; -inline VRect::VRect(const VRectF &r):x1(int(r.left())),y1(int(r.top())), - x2(int(r.right())),y2(int(r.bottom())){} +inline VRect::operator VRectF() const +{ + return {double(left()), double(right()), double(width()), double(height())}; +} + V_END_NAMESPACE #endif // VRECT_H