From f86f1bedd7a4df8a5ec82842783019b89a86d3ca Mon Sep 17 00:00:00 2001 From: Youngbok Shin Date: Fri, 24 Aug 2018 19:27:20 +0900 Subject: [PATCH] lottie/vdasher: remove connected dash lines between pathes Since managing multiple pathes by a painter or a stroke, multiple pathes will be drawn in one "dashed" function call. And its vdasher's moveTo() function only do the job properly when there is only one moveTo call. Now, the moveTo() function initialize internal properties properly. Change-Id: I4dd45d480f27dce734ce2ef8d1ff38774c589e64 --- src/vector/vdasher.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vector/vdasher.cpp b/src/vector/vdasher.cpp index cd7df43..d5f7ba9 100644 --- a/src/vector/vdasher.cpp +++ b/src/vector/vdasher.cpp @@ -70,6 +70,7 @@ VDasher::VDasher(const float *dashArray, int size) void VDasher::moveTo(const VPointF &p) { mIsCurrentOperationGap = false; + mNewSegment = false; mStartPt = p; mCurPt = p; @@ -101,8 +102,7 @@ void VDasher::moveTo(const VPointF &p) normalizeLen -= mDashArray[i].gap; } } else { - mCurrentDashIndex = 0; - mCurrentDashLength = mDashArray[0].length; + mCurrentDashLength = mDashArray[mCurrentDashIndex].length; } } @@ -229,6 +229,7 @@ VPath VDasher::dashed(const VPath &path) if (path.isEmpty()) return VPath(); mDashedPath = VPath(); + mCurrentDashIndex = 0; const std::vector &elms = path.elements(); const std::vector & pts = path.points(); const VPointF * ptPtr = pts.data(); -- 2.34.1