lottie/vector: move VPath to raster/drawable methods 63/185763/1
authorYoungbok Shin <youngb.shin@samsung.com>
Thu, 2 Aug 2018 07:05:20 +0000 (16:05 +0900)
committerYoungbok Shin <youngb.shin@samsung.com>
Thu, 2 Aug 2018 07:05:20 +0000 (16:05 +0900)
It prevents to increase ref count of VPath meaninglessly.
It could be helpful to improve performance by avoiding alloc/dealloc/copy.

Change-Id: I597ca0ea99cdc10bfe9c83a644d20caeab6162b3

src/lottie/lottieitem.cpp
src/vector/vdrawable.cpp
src/vector/vraster.cpp
src/vector/vraster.h

index c3ff6a7..392c112 100644 (file)
@@ -184,7 +184,7 @@ void LOTMaskItem::update(int frameNo, const VMatrix &parentMatrix,
     VPath path = mLocalPath;
     path.transform(parentMatrix);
 
-    mRleTask = VRaster::instance().generateFillInfo(path, std::move(mRle));
+    mRleTask = VRaster::instance().generateFillInfo(std::move(path), std::move(mRle));
 }
 
 VRle LOTMaskItem::rle()
index c04783e..93e7da1 100644 (file)
@@ -6,16 +6,15 @@ void VDrawable::preprocess()
 {
     if (mFlag & (DirtyState::Path)) {
         if (mStroke.enable) {
-            VPath newPath = mPath;
             if (mStroke.dashArraySize) {
                 VDasher dasher(mStroke.dashArray, mStroke.dashArraySize);
-                newPath = dasher.dashed(mPath);
+                mPath = dasher.dashed(mPath);
             }
             mRleTask = VRaster::instance().generateStrokeInfo(
-                newPath, std::move(mRle), mStroke.cap, mStroke.join, mStroke.width,
+                std::move(mPath), std::move(mRle), mStroke.cap, mStroke.join, mStroke.width,
                 mStroke.meterLimit);
         } else {
-            mRleTask = VRaster::instance().generateFillInfo(mPath, std::move(mRle), mFillRule);
+            mRleTask = VRaster::instance().generateFillInfo(std::move(mPath), std::move(mRle), mFillRule);
         }
         mFlag &= ~DirtyFlag(DirtyState::Path);
     }
index 6921984..b327d55 100644 (file)
@@ -356,12 +356,12 @@ public:
         return receiver;
     }
 
-    std::future<VRle> strokeRle(const VPath &path, VRle &&rle, CapStyle cap, JoinStyle join,
+    std::future<VRle> strokeRle(const VPath &&path, VRle &&rle, CapStyle cap, JoinStyle join,
                                 float width, float meterLimit)
     {
         RleTask *task = new RleTask();
         task->stroke = true;
-        task->path = path;
+        task->path = std::move(path);
         task->rle = std::move(rle);
         task->cap = cap;
         task->join = join;
@@ -370,10 +370,10 @@ public:
         return async(task);
     }
 
-    std::future<VRle> fillRle(const VPath &path, VRle &&rle, FillRule fillRule)
+    std::future<VRle> fillRle(const VPath &&path, VRle &&rle, FillRule fillRule)
     {
         RleTask *task = new RleTask();
-        task->path = path;
+        task->path = std::move(path);
         task->rle = std::move(rle);
         task->fillRule = fillRule;
         task->stroke = false;
@@ -387,7 +387,7 @@ VRaster::VRaster() {}
 
 VRaster::~VRaster() {}
 
-std::future<VRle> VRaster::generateFillInfo(const VPath &path, VRle &&rle,
+std::future<VRle> VRaster::generateFillInfo(const VPath &&path, VRle &&rle,
                                             FillRule     fillRule)
 {
     if (path.isEmpty()) {
@@ -395,10 +395,10 @@ std::future<VRle> VRaster::generateFillInfo(const VPath &path, VRle &&rle,
         promise.set_value(VRle());
         return promise.get_future();
     }
-    return raster_scheduler.fillRle(path, std::move(rle), fillRule);
+    return raster_scheduler.fillRle(std::move(path), std::move(rle), fillRule);
 }
 
-std::future<VRle> VRaster::generateStrokeInfo(const VPath &path, VRle &&rle, CapStyle cap,
+std::future<VRle> VRaster::generateStrokeInfo(const VPath &&path, VRle &&rle, CapStyle cap,
                                               JoinStyle join, float width,
                                               float meterLimit)
 {
@@ -407,7 +407,7 @@ std::future<VRle> VRaster::generateStrokeInfo(const VPath &path, VRle &&rle, Cap
         promise.set_value(VRle());
         return promise.get_future();
     }
-    return raster_scheduler.strokeRle(path, std::move(rle), cap, join, width, meterLimit);
+    return raster_scheduler.strokeRle(std::move(path), std::move(rle), cap, join, width, meterLimit);
 }
 
 V_END_NAMESPACE
index 5d47dfe..c41a4ae 100644 (file)
@@ -22,9 +22,9 @@ public:
     VRaster &operator=(VRaster const &) = delete;
     VRaster &operator=(VRaster &&) = delete;
 
-    std::future<VRle> generateFillInfo(const VPath &path, VRle &&rle,
+    std::future<VRle> generateFillInfo(const VPath &&path, VRle &&rle,
                                        FillRule fillRule = FillRule::Winding);
-    std::future<VRle> generateStrokeInfo(const VPath &path, VRle &&rle, CapStyle cap,
+    std::future<VRle> generateStrokeInfo(const VPath &&path, VRle &&rle, CapStyle cap,
                                          JoinStyle join, float width,
                                          float meterLimit);