From: subhransu mohanty Date: Mon, 3 Sep 2018 09:36:19 +0000 (+0900) Subject: lottie: moderize using clang-tidy 'modernize-return-braced-init-list' X-Git-Tag: submit/tizen/20180917.042405~39 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=59778f7c2d098c4a0aeea721bde65031127023b1;p=platform%2Fcore%2Fuifw%2Flottie-player.git lottie: moderize using clang-tidy 'modernize-return-braced-init-list' Change-Id: I4186243915c8bda61aade79e55f87e286801d2da --- diff --git a/src/vector/vbezier.h b/src/vector/vbezier.h index 4323616..f41e532 100644 --- a/src/vector/vbezier.h +++ b/src/vector/vbezier.h @@ -18,10 +18,10 @@ public: inline void split(VBezier *firstHalf, VBezier *secondHalf) const; float tAtLength(float len) const; void splitAtLength(float len, VBezier *left, VBezier *right); - VPointF pt1() const { return VPointF(x1, y1); } - VPointF pt2() const { return VPointF(x2, y2); } - VPointF pt3() const { return VPointF(x3, y3); } - VPointF pt4() const { return VPointF(x4, y4); } + VPointF pt1() const { return {x1, y1}; } + VPointF pt2() const { return {x2, y2}; } + VPointF pt3() const { return {x3, y3}; } + VPointF pt4() const { return {x4, y4}; } private: VPointF derivative(float t) const; @@ -62,7 +62,7 @@ inline VPointF VBezier::pointAt(float t) const b = b * m_t + c * t; y = a * m_t + b * t; } - return VPointF(x, y); + return {x, y}; } inline void VBezier::parameterSplitLeft(float t, VBezier *left) diff --git a/src/vector/vline.h b/src/vector/vline.h index 47ddff4..5ac6eb3 100644 --- a/src/vector/vline.h +++ b/src/vector/vline.h @@ -19,8 +19,8 @@ public: } float length() const { return length(mX1, mY1, mX2, mY2);} void splitAtLength(float length, VLine &left, VLine &right) const; - VPointF p1() const { return VPointF(mX1, mY1); } - VPointF p2() const { return VPointF(mX2, mY2); } + VPointF p1() const { return {mX1, mY1}; } + VPointF p2() const { return {mX2, mY2}; } static float length(float x1, float y1, float x2, float y2); diff --git a/src/vector/vmatrix.cpp b/src/vector/vmatrix.cpp index 5fff287..08be579 100644 --- a/src/vector/vmatrix.cpp +++ b/src/vector/vmatrix.cpp @@ -582,7 +582,7 @@ VRect VMatrix::map(const VRect &rect) const h = -h; y -= h; } - return VRect(x, y, w, h); + return {x, y, w, h}; } else if (t < MatrixType::Project) { // see mapToPolygon for explanations of the algorithm. float x = 0, y = 0; @@ -665,7 +665,7 @@ VPointF VMatrix::map(const VPointF &p) const y *= w; } } - return VPointF(x, y); + return {x, y}; } static std::string type_helper(VMatrix::MatrixType t) { diff --git a/src/vector/vpath.cpp b/src/vector/vpath.cpp index 08e0938..ad30a2a 100644 --- a/src/vector/vpath.cpp +++ b/src/vector/vpath.cpp @@ -350,7 +350,7 @@ static VPointF curvesForArc(const VRectF &rect, float startAngle, int *point_count) { if (rect.isNull()) { - return VPointF(); + return {}; } float x = rect.x(); diff --git a/src/vector/vpoint.h b/src/vector/vpoint.h index 2ee01f0..a2bee12 100644 --- a/src/vector/vpoint.h +++ b/src/vector/vpoint.h @@ -15,7 +15,7 @@ public: inline float & ry() noexcept { return my; } inline void setX(float x) { mx = x; } inline void setY(float y) { my = y; } - inline VPointF operator-() noexcept { return VPointF(-mx, -my); } + inline VPointF operator-() noexcept { return {-mx, -my}; } inline VPointF & operator+=(const VPointF &p) noexcept; inline VPointF & operator-=(const VPointF &p) noexcept; friend const VPointF operator+(const VPointF &p1, const VPointF &p2) @@ -43,7 +43,7 @@ inline bool fuzzyCompare(const VPointF &p1, const VPointF &p2) inline VPointF operator-(const VPointF &p1, const VPointF &p2) { - return VPointF(p1.mx - p2.mx, p1.my - p2.my); + return {p1.mx - p2.mx, p1.my - p2.my}; } inline const VPointF operator*(const VPointF &p, float c) @@ -116,7 +116,7 @@ inline VDebug &operator<<(VDebug &os, const VPoint &o) inline VPoint operator-(const VPoint &p1, const VPoint &p2) { - return VPoint(p1.mx - p2.mx, p1.my - p2.my); + return {p1.mx - p2.mx, p1.my - p2.my}; } constexpr inline bool VPoint::operator==(const VPoint &o) const diff --git a/src/vector/vrect.h b/src/vector/vrect.h index eea0b81..f946e9b 100644 --- a/src/vector/vrect.h +++ b/src/vector/vrect.h @@ -115,7 +115,7 @@ V_CONSTEXPR inline int VRect::height() const inline VRect VRect::translated(int dx, int dy) const { - return VRect(x1 + dx, y1 + dy, x2 - x1, y2 - y1); + return {x1 + dx, y1 + dy, x2 - x1, y2 - y1}; } inline void VRect::translate(int dx, int dy) @@ -165,7 +165,7 @@ public: V_CONSTEXPR inline float y() const; V_CONSTEXPR inline VPointF center() const { - return VPointF(x1 + (x2 - x1) / 2.f, y1 + (y2 - y1) / 2.f); + return {x1 + (x2 - x1) / 2.f, y1 + (y2 - y1) / 2.f}; } inline void setLeft(float l) { x1 = l; } inline void setTop(float t) { y1 = t; } diff --git a/src/vector/vregion.cpp b/src/vector/vregion.cpp index f482330..71aa1ea 100644 --- a/src/vector/vregion.cpp +++ b/src/vector/vregion.cpp @@ -1785,7 +1785,7 @@ const VRegionData shared_empty; inline VRect box_to_rect(box_type_t *box) { - return VRect(box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1); + return {box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1}; } void VRegion::cleanUp(VRegionData *x) @@ -1984,7 +1984,7 @@ int VRegion::rectCount() const VRect VRegion::rectAt(int index) const { VRegionPrivate *reg = d->rgn; - if (!reg) return VRect(); + if (!reg) return {}; box_type_t *box = PIXREGION_RECTS(reg) + index; @@ -2052,7 +2052,7 @@ bool VRegion::operator==(const VRegion &r) const VRect VRegion::boundingRect() const noexcept { - if (isEmpty()) return VRect(); + if (isEmpty()) return {}; return box_to_rect(&d->rgn->extents); }