Reset conicWeights in SkPath::consumeDegenerateSegments when rewinding to last Move op
Without this patch the iterator can end up running off the end of the conic weights if there is a mixture of degenerate and non-degenerate ops
Note: we might want to suppress the generation of degenerate conics and lines in SkPath::addRRect
BUG=459897
Review URL: https://codereview.chromium.org/954453003
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index de3d297..0b796fc 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -1660,6 +1660,7 @@
// forward before the next move is seen
const uint8_t* lastMoveVerb = 0;
const SkPoint* lastMovePt = 0;
+ const SkScalar* lastMoveWeight = NULL;
SkPoint lastPt = fLastPt;
while (fVerbs != fVerbStop) {
unsigned verb = *(fVerbs - 1); // fVerbs is one beyond the current verb
@@ -1668,6 +1669,7 @@
// Keep a record of this most recent move
lastMoveVerb = fVerbs;
lastMovePt = fPts;
+ lastMoveWeight = fConicWeights;
lastPt = fPts[0];
fVerbs--;
fPts++;
@@ -1688,6 +1690,7 @@
if (lastMoveVerb) {
fVerbs = lastMoveVerb;
fPts = lastMovePt;
+ fConicWeights = lastMoveWeight;
return;
}
return;
@@ -1703,6 +1706,7 @@
if (lastMoveVerb) {
fVerbs = lastMoveVerb;
fPts = lastMovePt;
+ fConicWeights = lastMoveWeight;
return;
}
return;
@@ -1718,6 +1722,7 @@
if (lastMoveVerb) {
fVerbs = lastMoveVerb;
fPts = lastMovePt;
+ fConicWeights = lastMoveWeight;
return;
}
return;