renderer: code refactoring
authorHermet Park <chuneon.park@samsung.com>
Thu, 11 Mar 2021 04:52:16 +0000 (13:52 +0900)
committerHermet Park <chuneon.park@samsung.com>
Thu, 11 Mar 2021 04:52:32 +0000 (13:52 +0900)
keep it clean & neat.

src/renderer/include/thorvg_renderer.hpp
src/renderer/src/thorvg_renderer.cpp

index 032ccee20c0ca3b3b9393acb1d2060caf1c3f1a5..c7888829f541561a637faf535bc5b94461a60b3f 100644 (file)
@@ -10,10 +10,9 @@ using namespace std;
 
 namespace rive
 {
-   struct TvgPoint
+   struct Point
    {
       float x, y;
-      TvgPoint(int _x, int _y) : x(_x), y(_y) { }
    };
 
    struct TvgPaint
@@ -24,9 +23,8 @@ namespace rive
       tvg::StrokeJoin join;
       tvg::StrokeCap  cap;
       RenderPaintStyle style;
-      bool isFill;
-      bool isStroke;
-      TvgPaint() : isFill(false), isStroke(false) {}
+      bool isFill = false;
+      bool isStroke = false;
    };
 
    class TvgRenderPath : public RenderPath
@@ -34,8 +32,8 @@ namespace rive
    private:
       Shape *m_Path;
       vector<PathCommand> m_PathType;
-      vector<TvgPoint> m_PathPoints;
-      bool m_Pushed;
+      vector<Point> m_PathPoints;
+      bool m_Pushed = false;
 
    public:
       TvgRenderPath();
index 5b1da7f986ff4b2d1958e2070aa4bc0607986d58..8f5a66bbba81c7c73c5424423f774a5255b14180 100644 (file)
@@ -4,7 +4,7 @@
 
 using namespace rive;
 
-TvgRenderPath::TvgRenderPath() : m_Pushed(false)
+TvgRenderPath::TvgRenderPath()
 {
        this->m_Path = tvg::Shape::gen().release();
 }
@@ -62,21 +62,21 @@ void TvgRenderPath::reset()
 void TvgRenderPath::moveTo(float x, float y)
 {
    m_PathType.push_back(PathCommand::MoveTo);
-   m_PathPoints.push_back(TvgPoint(x, y));
+   m_PathPoints.push_back({x, y});
 }
 
 void TvgRenderPath::lineTo(float x, float y)
 {
    m_PathType.push_back(PathCommand::LineTo);
-   m_PathPoints.push_back(TvgPoint(x, y));
+   m_PathPoints.push_back({x, y});
 }
 
 void TvgRenderPath::cubicTo(float ox, float oy, float ix, float iy, float x, float y)
 {
    m_PathType.push_back(PathCommand::CubicTo);
-   m_PathPoints.push_back(TvgPoint(ox, oy));
-   m_PathPoints.push_back(TvgPoint(ix, iy));
-   m_PathPoints.push_back(TvgPoint(x, y));
+   m_PathPoints.push_back({ox, oy});
+   m_PathPoints.push_back({ix, iy});
+   m_PathPoints.push_back({x, y});
 }
 
 void TvgRenderPath::close()