lottie: moderize using clang-tidy 'modernize-return-braced-init-list' 51/188251/1
authorsubhransu mohanty <sub.mohanty@samsung.com>
Mon, 3 Sep 2018 09:36:19 +0000 (18:36 +0900)
committersubhransu mohanty <sub.mohanty@samsung.com>
Mon, 3 Sep 2018 09:36:19 +0000 (18:36 +0900)
Change-Id: I4186243915c8bda61aade79e55f87e286801d2da

src/vector/vbezier.h
src/vector/vline.h
src/vector/vmatrix.cpp
src/vector/vpath.cpp
src/vector/vpoint.h
src/vector/vrect.h
src/vector/vregion.cpp

index 4323616..f41e532 100644 (file)
@@ -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)
index 47ddff4..5ac6eb3 100644 (file)
@@ -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);
 
index 5fff287..08be579 100644 (file)
@@ -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)
 {
index 08e0938..ad30a2a 100644 (file)
@@ -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();
index 2ee01f0..a2bee12 100644 (file)
@@ -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
index eea0b81..f946e9b 100644 (file)
@@ -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; }
index f482330..71aa1ea 100644 (file)
@@ -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);
 }