lottie: modernize using clang-tidy 'modernize-use-default-member-init' 52/188252/1
authorsubhransu mohanty <sub.mohanty@samsung.com>
Mon, 3 Sep 2018 09:50:54 +0000 (18:50 +0900)
committersubhransu mohanty <sub.mohanty@samsung.com>
Mon, 3 Sep 2018 09:50:54 +0000 (18:50 +0900)
Change-Id: I6ee31ae694d9f9cfb6cabbe160a980cd5277d1a7

src/lottie/lottiemodel.cpp
src/lottie/lottiemodel.h
src/vector/vbrush.h
src/vector/velapsedtimer.h
src/vector/vpoint.h
src/vector/vrect.h

index 58b7f4b..7c75c07 100644 (file)
@@ -5,7 +5,6 @@
 
 class LottieRepeaterProcesser : public LOTDataVisitor {
 public:
-    LottieRepeaterProcesser() : mRepeaterFound(false) {}
     void visit(LOTCompositionData *) override {}
     void visit(LOTLayerData *) override {}
     void visit(LOTTransformData *) override {}
@@ -46,7 +45,7 @@ public:
     }
 
 public:
-    bool mRepeaterFound;
+    bool mRepeaterFound{false};
 };
 
 
index 4abf4e5..b4bbddf 100644 (file)
@@ -74,15 +74,15 @@ enum class LayerType {
 class LottieColor
 {
 public:
-    LottieColor():r(1),g(1), b(1){}
+    LottieColor() = default;
     LottieColor(float red, float green , float blue):r(red), g(green),b(blue){}
     VColor toColor(float a=1){ return VColor((255 * r), (255 * g), (255 * b), (255 * a));}
     friend inline LottieColor operator+(const LottieColor &c1, const LottieColor &c2);
     friend inline LottieColor operator-(const LottieColor &c1, const LottieColor &c2);
 public:
-    float r;
-    float g;
-    float b;
+    float r{1};
+    float g{1};
+    float b{1};
 };
 
 inline LottieColor operator-(const LottieColor &c1, const LottieColor &c2)
@@ -185,18 +185,14 @@ template<typename T>
 class LOTKeyFrame
 {
 public:
-    LOTKeyFrame(): mStartFrame(0),
-                   mEndFrame(0),
-                   mInterpolator(nullptr){}
-
     T value(int frameNo) const {
         float progress = mInterpolator->value(float(frameNo - mStartFrame) / float(mEndFrame - mStartFrame));
         return mValue.value(progress);
     }
 
 public:
-    int                 mStartFrame;
-    int                 mEndFrame;
+    int                 mStartFrame{0};
+    int                 mEndFrame{0};
     std::shared_ptr<VInterpolator> mInterpolator;
     LOTKeyFrameValue<T>  mValue;
 };
index f2e6d21..ca03a1d 100644 (file)
@@ -53,14 +53,14 @@ public:
 class VBrush {
 public:
     enum class Type { NoBrush, Solid, LinearGradient, RadialGradient, Texture };
-    VBrush() : mType(Type::NoBrush) {}
+    VBrush() = default;
     VBrush(const VColor &color);
     VBrush(const VGradient *gradient);
     VBrush(int r, int g, int b, int a);
     inline VBrush::Type type() const { return mType; }
 
 public:
-    VBrush::Type     mType;
+    VBrush::Type     mType{Type::NoBrush};
     VColor           mColor;
     const VGradient *mGradient;
 };
index f8d2f9a..77dc0da 100644 (file)
@@ -6,7 +6,6 @@
 
 class VElapsedTimer {
 public:
-    VElapsedTimer() : m_valid(false) {}
     double      elapsed() const;
     bool        hasExpired(double millsec);
     void        start();
@@ -15,6 +14,6 @@ public:
 
 private:
     std::chrono::high_resolution_clock::time_point clock;
-    bool                                           m_valid;
+    bool                                           m_valid{false};
 };
 #endif  // VELAPSEDTIMER_H
index a2bee12..3eb8ed5 100644 (file)
@@ -7,7 +7,7 @@ V_BEGIN_NAMESPACE
 
 class VPointF {
 public:
-    constexpr inline VPointF() noexcept : mx(0), my(0) {}
+    VPointF() = default;
     constexpr inline VPointF(float x, float y) noexcept : mx(x), my(y) {}
     constexpr inline float x() const noexcept { return mx; }
     constexpr inline float y() const noexcept { return my; }
@@ -32,8 +32,8 @@ public:
     friend inline const VPointF operator/(float val, const VPointF &);
 
 private:
-    float mx;
-    float my;
+    float mx{0};
+    float my{0};
 };
 
 inline bool fuzzyCompare(const VPointF &p1, const VPointF &p2)
@@ -88,7 +88,7 @@ inline VPointF &VPointF::operator-=(const VPointF &p) noexcept
 
 class VPoint {
 public:
-    constexpr inline VPoint() noexcept : mx(0), my(0) {}
+    VPoint() = default;
     constexpr inline VPoint(int x, int y) noexcept : mx(x), my(y) {}
     constexpr inline int  x() const noexcept { return mx; }
     constexpr inline int  y() const noexcept { return my; }
@@ -105,8 +105,8 @@ public:
     inline friend VDebug &operator<<(VDebug &os, const VPoint &o);
 
 private:
-    int mx;
-    int my;
+    int mx{0};
+    int my{0};
 };
 inline VDebug &operator<<(VDebug &os, const VPoint &o)
 {
@@ -140,7 +140,7 @@ inline VPoint &VPoint::operator-=(const VPoint &p) noexcept
 
 class VSize {
 public:
-    constexpr inline VSize() noexcept : mw(0), mh(0) {}
+    VSize() = default;
     constexpr inline VSize(int w, int h) noexcept : mw(w), mh(h) {}
     bool isEmpty() const {return (mw <= 0 || mh <= 0);}
     constexpr inline int  width() const noexcept { return mw; }
@@ -157,8 +157,8 @@ public:
     inline friend VDebug &operator<<(VDebug &os, const VSize &o);
 
 private:
-    int mw;
-    int mh;
+    int mw{0};
+    int mh{0};
 };
 inline VDebug &operator<<(VDebug &os, const VSize &o)
 {
index f946e9b..b6c4d96 100644 (file)
@@ -7,7 +7,7 @@ V_BEGIN_NAMESPACE
 
 class VRect {
 public:
-    V_CONSTEXPR             VRect() : x1(0), y1(0), x2(-1), y2(-1) {}
+    VRect() = default;
     V_CONSTEXPR             VRect(int left, int top, int width, int height);
     V_CONSTEXPR inline bool isEmpty() const;
     V_CONSTEXPR inline bool isNull() const;
@@ -37,10 +37,10 @@ public:
     friend VDebug &                operator<<(VDebug &os, const VRect &o);
 
 private:
-    int x1;
-    int y1;
-    int x2;
-    int y2;
+    int x1{0};
+    int y1{0};
+    int x2{-1};
+    int y2{-1};
 };
 
 inline bool VRect::intersects(const VRect &r)
@@ -144,7 +144,7 @@ V_CONSTEXPR inline VRect::VRect(int left, int top, int width, int height)
 
 class VRectF {
 public:
-    V_CONSTEXPR VRectF() : x1(0), y1(0), x2(-1), y2(-1) {}
+    VRectF() = default;
     VRectF(float left, float top, float width, float height)
     {
         x1 = left;
@@ -182,10 +182,10 @@ public:
     }
 
 private:
-    float x1;
-    float y1;
-    float x2;
-    float y2;
+    float x1{0};
+    float y1{0};
+    float x2{-1};
+    float y2{-1};
 };
 
 V_CONSTEXPR inline bool VRectF::isEmpty() const