From: Youngbok Shin Date: Thu, 2 Aug 2018 04:43:59 +0000 (+0900) Subject: lottie/vector: add clone method to copy data without increasing ref count X-Git-Tag: submit/tizen/20180917.042405~144 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a9def49291ac3cfb5894e24140d5db95ea0b43b1;p=platform%2Fcore%2Fuifw%2Flottie-player.git lottie/vector: add clone method to copy data without increasing ref count It helps to improve performance by avoiding copy job from writing COW data. Change-Id: I72d1c7106fc4fe53fa6db05e7ed8c74f1b70fe95 --- diff --git a/src/lottie/lottieitem.cpp b/src/lottie/lottieitem.cpp index 5533379..c3ff6a7 100644 --- a/src/lottie/lottieitem.cpp +++ b/src/lottie/lottieitem.cpp @@ -692,7 +692,7 @@ void LOTPathDataItem::update(int frameNo, const VMatrix &parentMatrix, // 3. compute the final path with parentMatrix if ((flag & DirtyFlagBit::Matrix) || mPathChanged) { - mFinalPath = tempPath; + mFinalPath.clone(tempPath); mFinalPath.transform(parentMatrix); mPathChanged = true; } diff --git a/src/vector/vpath.h b/src/vector/vpath.h index 2d1858d..3292675 100644 --- a/src/vector/vpath.h +++ b/src/vector/vpath.h @@ -45,6 +45,7 @@ public: float length() const; const std::vector &elements() const; const std::vector & points() const; + void clone(const VPath &srcPath); private: struct VPathData { @@ -210,6 +211,11 @@ inline const std::vector &VPath::points() const return d->points(); } +inline void VPath::clone(const VPath &srcPath) +{ + d.write() = srcPath.d.read(); +} + V_END_NAMESPACE #endif // VPATH_H