shape: Refactoring to use initialize list
authorJunsuChoi <jsuya.choi@samsung.com>
Fri, 19 Feb 2021 07:12:11 +0000 (16:12 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Fri, 19 Feb 2021 08:35:13 +0000 (17:35 +0900)
Member data should be initialized in-class or in a constructor initialization list

src/lib/tvgShapeImpl.h

index c50f938..67aba9c 100644 (file)
@@ -41,11 +41,11 @@ struct ShapeStroke
     ShapeStroke() {}
 
     ShapeStroke(const ShapeStroke* src)
+     : width(src->width),
+       dashCnt(src->dashCnt),
+       cap(src->cap),
+       join(src->join)
     {
-        width = src->width;
-        dashCnt = src->dashCnt;
-        cap = src->cap;
-        join = src->join;
         memcpy(color, src->color, sizeof(color));
         dashPattern = static_cast<float*>(malloc(sizeof(float) * dashCnt));
         memcpy(dashPattern, src->dashPattern, sizeof(float) * dashCnt);