lottie/vdasher: remove connected dash lines between pathes 87/187587/2
authorYoungbok Shin <youngb.shin@samsung.com>
Fri, 24 Aug 2018 10:27:20 +0000 (19:27 +0900)
committerYoungbok Shin <youngb.shin@samsung.com>
Mon, 27 Aug 2018 05:31:51 +0000 (14:31 +0900)
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

index cd7df43..d5f7ba9 100644 (file)
@@ -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<VPath::Element> &elms = path.elements();
     const std::vector<VPointF> &       pts = path.points();
     const VPointF *                    ptPtr = pts.data();