Index: src/pathops/SkOpEdgeBuilder.cpp |
diff --git a/src/pathops/SkOpEdgeBuilder.cpp b/src/pathops/SkOpEdgeBuilder.cpp |
index e3dc1398655273d6236da70e086433c5d82d0bc8..a180387b3611a575bb3fdca072632e0cbe358173 100644 |
--- a/src/pathops/SkOpEdgeBuilder.cpp |
+++ b/src/pathops/SkOpEdgeBuilder.cpp |
@@ -114,7 +114,18 @@ int SkOpEdgeBuilder::preFetch() { |
continue; // skip degenerate points |
} |
break; |
- case SkPath::kConic_Verb: { |
+ case SkPath::kConic_Verb: |
+ if (true) { |
reed1
2015/04/15 20:06:24
do we need to keep the "else" code?
|
+ force_small_to_zero(&pts[1]); |
+ force_small_to_zero(&pts[2]); |
+ curve[1] = pts[1]; |
+ curve[2] = pts[2]; |
+ verb = SkReduceOrder::Conic(curve, iter.conicWeight(), pts); |
+ if (verb == SkPath::kMove_Verb) { |
+ continue; // skip degenerate points |
+ } |
+ break; |
+ } else { |
const SkPoint* quadPts = quadder.computeQuads(pts, iter.conicWeight(), |
quadderTol); |
const int nQuads = quadder.countQuads(); |
@@ -124,8 +135,9 @@ int SkOpEdgeBuilder::preFetch() { |
fPathPts.append(nQuads * 2, &quadPts[1]); |
curve[0] = pts[2]; |
lastCurve = true; |
+ verb = SkPath::kQuad_Verb; |
+ continue; |
} |
- continue; |
case SkPath::kCubic_Verb: |
force_small_to_zero(&pts[1]); |
force_small_to_zero(&pts[2]); |
@@ -148,6 +160,9 @@ int SkOpEdgeBuilder::preFetch() { |
*fPathVerbs.append() = verb; |
int ptCount = SkPathOpsVerbToPoints(verb); |
fPathPts.append(ptCount, &pts[1]); |
+ if (verb == SkPath::kConic_Verb) { |
+ *fWeights.append() = iter.conicWeight(); |
+ } |
curve[0] = pts[ptCount]; |
lastCurve = true; |
} while (verb != SkPath::kDone_Verb); |
@@ -167,6 +182,7 @@ bool SkOpEdgeBuilder::walk(SkChunkAlloc* allocator) { |
uint8_t* verbPtr = fPathVerbs.begin(); |
uint8_t* endOfFirstHalf = &verbPtr[fSecondHalf]; |
SkPoint* pointsPtr = fPathPts.begin() - 1; |
+ SkScalar* weightPtr = fWeights.begin(); |
SkPath::Verb verb; |
while ((verb = (SkPath::Verb) *verbPtr) != SkPath::kDone_Verb) { |
if (verbPtr == endOfFirstHalf) { |
@@ -195,6 +211,9 @@ bool SkOpEdgeBuilder::walk(SkChunkAlloc* allocator) { |
case SkPath::kQuad_Verb: |
fCurrentContour->addQuad(pointsPtr, fAllocator); |
break; |
+ case SkPath::kConic_Verb: |
+ fCurrentContour->addConic(pointsPtr, *weightPtr++, fAllocator); |
+ break; |
case SkPath::kCubic_Verb: { |
// split self-intersecting cubics in two before proceeding |
// if the cubic is convex, it doesn't self intersect. |