From 7fce0de0b9674ca6cc65ebbb40b924b615d9fc9e Mon Sep 17 00:00:00 2001 From: "caryclark@google.com" Date: Thu, 29 Nov 2012 14:31:50 +0000 Subject: [PATCH] shape ops work in progress Complete rewrite of binary logic makes the result work and much easier to understand. git-svn-id: http://skia.googlecode.com/svn/trunk@6597 2bbb7eff-a529-9590-31e7-b0007b416f81 --- experimental/Intersection/ShapeOpRect4x4_Test.cpp | 16 +- experimental/Intersection/ShapeOps.cpp | 244 +++--- experimental/Intersection/Simplify.cpp | 490 ++++++----- experimental/Intersection/SimplifyNew_Test.cpp | 909 +++++++++++---------- experimental/Intersection/SimplifyRect4x4_Test.cpp | 24 +- experimental/Intersection/op.htm | 406 ++++----- 6 files changed, 1055 insertions(+), 1034 deletions(-) diff --git a/experimental/Intersection/ShapeOpRect4x4_Test.cpp b/experimental/Intersection/ShapeOpRect4x4_Test.cpp index 6eeb441..d228a33 100644 --- a/experimental/Intersection/ShapeOpRect4x4_Test.cpp +++ b/experimental/Intersection/ShapeOpRect4x4_Test.cpp @@ -33,21 +33,21 @@ static void* testShapeOps4x4RectsMain(void* data) char* str = pathStr; pathA.setFillType((SkPath::FillType) e); str += sprintf(str, " path.setFillType((SkPath::FillType) %d);\n", e); - pathA.addRect(state.a, state.a, state.b, state.b, (SkPath::Direction) 0); + pathA.addRect(state.a, state.a, state.b, state.b, SkPath::kCW_Direction); str += sprintf(str, " path.addRect(%d, %d, %d, %d," - " (SkPath::Direction) %d);\n", state.a, state.a, state.b, state.b, 0); - pathA.addRect(state.c, state.c, state.d, state.d, (SkPath::Direction) 0); + " SkPath::kCW_Direction);\n", state.a, state.a, state.b, state.b); + pathA.addRect(state.c, state.c, state.d, state.d, SkPath::kCW_Direction); str += sprintf(str, " path.addRect(%d, %d, %d, %d," - " (SkPath::Direction) %d);\n", state.c, state.c, state.d, state.d, 0); + " SkPath::kCW_Direction);\n", state.c, state.c, state.d, state.d); pathA.close(); pathB.setFillType((SkPath::FillType) f); str += sprintf(str, " pathB.setFillType((SkPath::FillType) %d);\n", f); - pathB.addRect(a, a, b, b, (SkPath::Direction) 0); + pathB.addRect(a, a, b, b, SkPath::kCW_Direction); str += sprintf(str, " pathB.addRect(%d, %d, %d, %d," - " (SkPath::Direction) %d);\n", a, a, b, b, 0); - pathB.addRect(c, c, d, d, (SkPath::Direction) 0); + " SkPath::kCW_Direction);\n", a, a, b, b); + pathB.addRect(c, c, d, d, SkPath::kCW_Direction); str += sprintf(str, " pathB.addRect(%d, %d, %d, %d," - " (SkPath::Direction) %d);\n", c, c, d, d, 0); + " SkPath::kCW_Direction);\n", c, c, d, d); pathB.close(); outputProgress(state, pathStr, kDifference_Op); testShapeOp(pathA, pathB, kDifference_Op); diff --git a/experimental/Intersection/ShapeOps.cpp b/experimental/Intersection/ShapeOps.cpp index 14bf848..cecfbff 100644 --- a/experimental/Intersection/ShapeOps.cpp +++ b/experimental/Intersection/ShapeOps.cpp @@ -17,19 +17,19 @@ namespace Op { // other code that walks winding in angles // OPTIMIZATION: Probably, the walked winding should be rolled into the angle structure // so it isn't duplicated by walkers like this one -static Segment* findChaseOp(SkTDArray& chase, int& tIndex, int& endIndex) { +static Segment* findChaseOp(SkTDArray& chase, int& nextStart, int& nextEnd) { while (chase.count()) { Span* span; chase.pop(&span); const Span& backPtr = span->fOther->span(span->fOtherIndex); Segment* segment = backPtr.fOther; - tIndex = backPtr.fOtherIndex; + nextStart = backPtr.fOtherIndex; SkTDArray angles; int done = 0; - if (segment->activeAngle(tIndex, done, angles)) { + if (segment->activeAngle(nextStart, done, angles)) { Angle* last = angles.end() - 1; - tIndex = last->start(); - endIndex = last->end(); + nextStart = last->start(); + nextEnd = last->end(); #if TRY_ROTATE *chase.insert(0) = span; #else @@ -42,8 +42,9 @@ static Segment* findChaseOp(SkTDArray& chase, int& tIndex, int& endIndex) } SkTDArray sorted; bool sortable = Segment::SortAngles(angles, sorted); + int angleCount = sorted.count(); #if DEBUG_SORT - sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0, 0); + sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0); #endif if (!sortable) { continue; @@ -51,87 +52,56 @@ static Segment* findChaseOp(SkTDArray& chase, int& tIndex, int& endIndex) // find first angle, initialize winding to computed fWindSum int firstIndex = -1; const Angle* angle; - int winding; do { angle = sorted[++firstIndex]; segment = angle->segment(); - winding = segment->windSum(angle); - } while (winding == SK_MinS32); - int spanWinding = segment->spanSign(angle->start(), angle->end()); - #if DEBUG_WINDING - SkDebugf("%s winding=%d spanWinding=%d\n", - __FUNCTION__, winding, spanWinding); + } while (segment->windSum(angle) == SK_MinS32); + #if DEBUG_SORT + segment->debugShowSort(__FUNCTION__, sorted, firstIndex); #endif - // turn span winding into contour winding - if (spanWinding * winding < 0) { - winding += spanWinding; + int sumMiWinding = segment->updateWindingReverse(angle); + int sumSuWinding = segment->updateOppWindingReverse(angle); + if (segment->operand()) { + SkTSwap(sumMiWinding, sumSuWinding); } - // we care about first sign and whether wind sum indicates this - // edge is inside or outside. Maybe need to pass span winding - // or first winding or something into this function? - // advance to first undone angle, then return it and winding - // (to set whether edges are active or not) int nextIndex = firstIndex + 1; - int angleCount = sorted.count(); int lastIndex = firstIndex != 0 ? firstIndex : angleCount; - angle = sorted[firstIndex]; - segment = angle->segment(); - int oWinding = segment->oppSum(angle); - #if DEBUG_SORT - segment->debugShowSort(__FUNCTION__, sorted, firstIndex, winding, oWinding); - #endif - winding -= segment->spanSign(angle); - oWinding -= segment->oppSign(angle); - bool firstOperand = segment->operand(); + Segment* first = NULL; do { SkASSERT(nextIndex != firstIndex); if (nextIndex == angleCount) { nextIndex = 0; } + int maxWinding, sumWinding, oppMaxWinding, oppSumWinding; angle = sorted[nextIndex]; segment = angle->segment(); - int deltaSum = segment->spanSign(angle); - int deltaOppSum = segment->oppSign(angle); - bool angleIsOp = segment->operand() ^ firstOperand; - int maxWinding; - if (angleIsOp) { - maxWinding = oWinding; - oWinding -= deltaSum; - winding -= deltaOppSum; - } else { - maxWinding = winding; - winding -= deltaSum; - oWinding -= deltaOppSum; - } - #if DEBUG_SORT - SkDebugf("%s id=%d maxWinding=%d winding=%d oWinding=%d sign=%d\n", __FUNCTION__, - segment->debugID(), maxWinding, winding, oWinding, angle->sign()); - #endif - tIndex = angle->start(); - endIndex = angle->end(); - int lesser = SkMin32(tIndex, endIndex); - const Span& nextSpan = segment->span(lesser); - if (!nextSpan.fDone) { - if (angleIsOp) { - SkTSwap(winding, oWinding); + int start = angle->start(); + int end = angle->end(); + segment->setUpWindings(start, end, sumMiWinding, sumSuWinding, + maxWinding, sumWinding, oppMaxWinding, oppSumWinding); + if (!segment->done(angle)) { + if (!first) { + first = segment; + nextStart = start; + nextEnd = end; } - if (useInnerWinding(maxWinding, winding)) { - maxWinding = winding; - } - segment->markWinding(lesser, maxWinding, oWinding); - break; + (void) segment->markAngle(maxWinding, sumWinding, oppMaxWinding, + oppSumWinding, true, angle); } } while (++nextIndex != lastIndex); - #if TRY_ROTATE - *chase.insert(0) = span; - #else - *chase.append() = span; - #endif - return segment; + if (first) { + #if TRY_ROTATE + *chase.insert(0) = span; + #else + *chase.append() = span; + #endif + return first; + } } return NULL; } +/* static bool windingIsActive(int winding, int oppWinding, int spanWinding, int oppSpanWinding, bool windingIsOp, ShapeOp op) { bool active = windingIsActive(winding, spanWinding); @@ -139,26 +109,28 @@ static bool windingIsActive(int winding, int oppWinding, int spanWinding, int op return false; } if (oppSpanWinding && windingIsActive(oppWinding, oppSpanWinding)) { - return op == kIntersect_Op || op == kUnion_Op; + switch (op) { + case kIntersect_Op: + case kUnion_Op: + return true; + case kDifference_Op: { + int absSpan = abs(spanWinding); + int absOpp = abs(oppSpanWinding); + return windingIsOp ? absSpan < absOpp : absSpan > absOpp; + } + case kXor_Op: + return spanWinding != oppSpanWinding; + default: + SkASSERT(0); + } } bool opActive = oppWinding != 0; return gOpLookup[op][opActive][windingIsOp]; } - -static int updateWindings(const Segment* current, int index, int endIndex, - int& spanWinding, int& oppWinding, int& oppSpanWinding) { - int winding = updateWindings(current, index, endIndex, spanWinding); - int lesser = SkMin32(index, endIndex); - oppWinding = current->oppSum(lesser); - oppSpanWinding = current->oppSign(index, endIndex); - if (oppSpanWinding && useInnerWinding(oppWinding - oppSpanWinding, oppWinding)) { - oppWinding -= oppSpanWinding; - } - return winding; -} +*/ static bool bridgeOp(SkTDArray& contourList, const ShapeOp op, - const int aXorMask, const int bXorMask, PathWrapper& simple) { + const int xorMask, const int xorOpMask, PathWrapper& simple) { bool firstContour = true; bool unsortable = false; bool closable = true; @@ -169,89 +141,69 @@ static bool bridgeOp(SkTDArray& contourList, const ShapeOp op, if (!current) { break; } - int contourWinding, oppContourWinding; if (firstContour) { - contourWinding = oppContourWinding = 0; + current->initWinding(index, endIndex, 0, 0); firstContour = false; } else { int minIndex = SkMin32(index, endIndex); int sumWinding = current->windSum(minIndex); - int oppSumWinding = current->oppSum(minIndex); - // FIXME: don't I have to adjust windSum to get contourWinding? if (sumWinding == SK_MinS32) { - sumWinding = current->computeSum(index, endIndex, &oppSumWinding); + sumWinding = current->computeSum(index, endIndex, true); } if (sumWinding == SK_MinS32) { - contourWinding = innerContourCheck(contourList, current, + int contourWinding = innerContourCheck(contourList, current, index, endIndex, false); - oppContourWinding = innerContourCheck(contourList, current, + int oppContourWinding = innerContourCheck(contourList, current, index, endIndex, true); - } else { - int spanWinding, oppWinding; - contourWinding = updateWindings(current, index, endIndex, spanWinding, - oppContourWinding, oppWinding); -#if DEBUG_WINDING - SkDebugf("%s contourWinding=%d oppContourWinding=%d spanWinding=%d oppWinding=%d\n", - __FUNCTION__, contourWinding, oppContourWinding, spanWinding, oppWinding); -#endif + current->initWinding(index, endIndex, contourWinding, oppContourWinding); } -#if DEBUG_WINDING - // SkASSERT(current->debugVerifyWinding(index, endIndex, contourWinding)); - SkDebugf("%s contourWinding=%d\n", __FUNCTION__, contourWinding); -#endif } - int winding = contourWinding; - int oppWinding = oppContourWinding; - int spanWinding = current->spanSign(index, endIndex); - int oppSpanWinding = current->oppSign(index, endIndex); SkTDArray chaseArray; do { - bool active = windingIsActive(winding, oppWinding, spanWinding, oppSpanWinding, - current->operand(), op); - #if DEBUG_WINDING - SkDebugf("%s active=%s winding=%d oppWinding=%d spanWinding=%d oppSpanWinding=%d\n", - __FUNCTION__, active ? "true" : "false", - winding, oppWinding, spanWinding, oppSpanWinding); - #endif - do { - #if DEBUG_ACTIVE_SPANS - if (!unsortable && current->done()) { - debugShowActiveSpans(contourList); - } - #endif - SkASSERT(unsortable || !current->done()); - int nextStart = index; - int nextEnd = endIndex; - Segment* next = current->findNextOp(chaseArray, active, - nextStart, nextEnd, winding, oppWinding, spanWinding, oppSpanWinding, - unsortable, op, aXorMask, bXorMask); - if (!next) { - SkASSERT(!unsortable); - if (active && !unsortable && simple.hasMove() - && current->verb() != SkPath::kLine_Verb - && !simple.isClosed()) { - current->addCurveTo(index, endIndex, simple, true); - SkASSERT(simple.isClosed()); + if (current->activeOp(index, endIndex, xorMask, xorOpMask, op)) { + bool active = true; + do { + #if DEBUG_ACTIVE_SPANS + if (!unsortable && current->done()) { + debugShowActiveSpans(contourList); } - break; - } - current->addCurveTo(index, endIndex, simple, active); - current = next; - index = nextStart; - endIndex = nextEnd; - } while (!simple.isClosed() - && ((active && !unsortable) || !current->done())); - if (active) { - if (!simple.isClosed()) { + #endif + SkASSERT(unsortable || !current->done()); + int nextStart = index; + int nextEnd = endIndex; + Segment* next = current->findNextOp(chaseArray, nextStart, nextEnd, + unsortable, op, xorMask, xorOpMask); + if (!next) { + SkASSERT(!unsortable); + if (!unsortable && simple.hasMove() + && current->verb() != SkPath::kLine_Verb + && !simple.isClosed()) { + current->addCurveTo(index, endIndex, simple, true); + SkASSERT(simple.isClosed()); + } + active = false; + break; + } + current->addCurveTo(index, endIndex, simple, true); + current = next; + index = nextStart; + endIndex = nextEnd; + } while (!simple.isClosed() && ((!unsortable) || !current->done())); + if (active && !simple.isClosed()) { SkASSERT(unsortable); int min = SkMin32(index, endIndex); if (!current->done(min)) { current->addCurveTo(index, endIndex, simple, true); - current->markDone(SkMin32(index, endIndex), winding ? winding : spanWinding); + current->markDoneBinary(min); } closable = false; } simple.close(); + } else { + Span* last = current->markAndChaseDoneBinary(index, endIndex); + if (last) { + *chaseArray.append() = last; + } } current = findChaseOp(chaseArray, index, endIndex); #if DEBUG_ACTIVE_SPANS @@ -260,8 +212,6 @@ static bool bridgeOp(SkTDArray& contourList, const ShapeOp op, if (!current) { break; } - winding = updateWindings(current, index, endIndex, spanWinding, oppWinding, - oppSpanWinding); } while (true); } while (true); return closable; @@ -277,10 +227,10 @@ void operate(const SkPath& one, const SkPath& two, ShapeOp op, SkPath& result) { SkTArray contours; // FIXME: add self-intersecting cubics' T values to segment Op::EdgeBuilder builder(one, contours); - const int aXorMask = builder.xorMask(); + const int xorMask = builder.xorMask(); builder.addOperand(two); - const int bXorMask = builder.xorMask(); builder.finish(); + const int xorOpMask = builder.xorMask(); SkTDArray contourList; makeContourList(contours, contourList); Op::Contour** currentPtr = contourList.begin(); @@ -307,8 +257,8 @@ void operate(const SkPath& one, const SkPath& two, ShapeOp op, SkPath& result) { #if DEBUG_SHOW_WINDING Op::Contour::debugShowWindingValues(contourList); #endif - coincidenceCheck(contourList, (aXorMask == kEvenOdd_Mask) - ^ (bXorMask == kEvenOdd_Mask), total); + coincidenceCheck(contourList, (xorMask == kEvenOdd_Mask) + ^ (xorOpMask == kEvenOdd_Mask), total); #if DEBUG_SHOW_WINDING Op::Contour::debugShowWindingValues(contourList); #endif @@ -319,5 +269,5 @@ void operate(const SkPath& one, const SkPath& two, ShapeOp op, SkPath& result) { #endif // construct closed contours Op::PathWrapper wrapper(result); - bridgeOp(contourList, op, aXorMask, bXorMask, wrapper); + bridgeOp(contourList, op, xorMask, xorOpMask, wrapper); } diff --git a/experimental/Intersection/Simplify.cpp b/experimental/Intersection/Simplify.cpp index 31e59cc..a221e6b 100644 --- a/experimental/Intersection/Simplify.cpp +++ b/experimental/Intersection/Simplify.cpp @@ -29,7 +29,7 @@ int gDebugMaxWindValue = SK_MaxS32; #define TRY_ROTATE 1 #define DEBUG_UNUSED 0 // set to expose unused functions -#define FORCE_RELEASE 0 // set force release to 1 for multiple thread -- no debugging +#define FORCE_RELEASE 1 // set force release to 1 for multiple thread -- no debugging #if FORCE_RELEASE || defined SK_RELEASE @@ -843,10 +843,7 @@ static const bool gOpLookup[][2][2] = { {{true , true }, {true , true }}, // a ^ b }; -static bool activeOp(bool angleIsOp, int otherNonZero, int otherCoin, ShapeOp op) { - if (otherNonZero != otherCoin) { - return op == kIntersect_Op || op == kUnion_Op; - } +static bool isActiveOp(bool angleIsOp, int otherNonZero, ShapeOp op) { return gOpLookup[op][otherNonZero][angleIsOp]; } @@ -1085,6 +1082,43 @@ public: SkASSERT(result.fY < SK_ScalarMax); } + bool activeOp(int index, int endIndex, int xorMiMask, int xorSuMask, ShapeOp op) { + int sumMiWinding = updateWinding(endIndex, index); + int sumSuWinding = updateOppWinding(endIndex, index); + if (fOperand) { + SkTSwap(sumMiWinding, sumSuWinding); + } + int maxWinding, sumWinding, oppMaxWinding, oppSumWinding; + return activeOp(xorMiMask, xorSuMask, index, endIndex, op, sumMiWinding, sumSuWinding, + maxWinding, sumWinding, oppMaxWinding, oppSumWinding); + } + + bool activeOp(int xorMiMask, int xorSuMask, + int index, int endIndex, ShapeOp op, + int& sumMiWinding, int& sumSuWinding, + int& maxWinding, int& sumWinding, int& oppMaxWinding, int& oppSumWinding) { + setUpWindings(index, endIndex, sumMiWinding, sumSuWinding, + maxWinding, sumWinding, oppMaxWinding, oppSumWinding); + int mask, oppMask; + if (operand()) { + mask = xorSuMask; + oppMask = xorMiMask; + } else { + mask = xorMiMask; + oppMask = xorSuMask; + } + if ((sumWinding & mask) && (maxWinding & mask)) { + return false; + } + int oppCoin = oppSign(index, endIndex) & oppMask; + if (oppCoin) { + return op == kIntersect_Op || op == kUnion_Op + || (oppSumWinding & oppMask && oppMaxWinding & oppMask); + } + bool oppNonZero = oppMaxWinding & oppMask; + return isActiveOp(operand(), oppNonZero, op); + } + void addAngle(SkTDArray& angles, int start, int end) const { SkASSERT(start != end); Angle* angle = angles.append(); @@ -1711,7 +1745,7 @@ public: other->addTwoAngles(next, oIndex, angles); } - int computeSum(int startIndex, int endIndex, int* oppoSum) { + int computeSum(int startIndex, int endIndex, bool binary) { SkTDArray angles; addTwoAngles(startIndex, endIndex, angles); buildAngles(endIndex, angles, false); @@ -1754,12 +1788,6 @@ public: if (inner) { winding += spanWinding; } - if (oppoSum) { - int oppoWinding = base->oppSign(angle); - if (useInnerWinding(oWinding + oppoWinding, oWinding)) { - oWinding += oppoWinding; - } - } #if DEBUG_SORT base->debugShowSort(__FUNCTION__, sorted, firstIndex, winding, oWinding); #endif @@ -1808,14 +1836,11 @@ public: if (oppoSign && useInnerWinding(oMaxWinding, oWinding)) { oMaxWinding = oWinding; } - segment->markAndChaseWinding(angle, maxWinding, oppoSum ? oMaxWinding : 0); + segment->markAndChaseWinding(angle, maxWinding, binary ? oMaxWinding : 0); } } } while (++nextIndex != lastIndex); int minIndex = SkMin32(startIndex, endIndex); - if (oppoSum) { - *oppoSum = oppSum(minIndex); - } return windSum(minIndex); } @@ -1927,38 +1952,27 @@ public: return fTs[min].fDone; } - bool done(const Angle& angle) const { - return done(SkMin32(angle.start(), angle.end())); + bool done(const Angle* angle) const { + return done(SkMin32(angle->start(), angle->end())); } - Segment* findNextOp(SkTDArray& chase, bool active, - int& nextStart, int& nextEnd, int& winding, int& oppWinding, - int& spanWinding, int& oppSpanWinding, bool& unsortable, ShapeOp op, - const int aXorMask, const int bXorMask) { + /* + The M and S variable name parts stand for the operators. + Mi stands for Minuend (see wiki subtraction, analogous to difference) + Su stands for Subtrahend + The Opp variable name part designates that the value is for the Opposite operator. + Opposite values result from combining coincident spans. + */ + + Segment* findNextOp(SkTDArray& chase, int& nextStart, int& nextEnd, + bool& unsortable, ShapeOp op, const int xorMiMask, const int xorSuMask) { const int startIndex = nextStart; - const int endIndex = nextEnd; - int outerWinding = winding; - int innerWinding = winding + spanWinding; - #if DEBUG_WINDING - SkDebugf("%s winding=%d spanWinding=%d outerWinding=%d innerWinding=%d oppWinding=%d\n", - __FUNCTION__, winding, spanWinding, outerWinding, innerWinding, oppWinding); - #endif - if (useInnerWinding(outerWinding, innerWinding)) { - outerWinding = innerWinding; - } - int outerOppWinding = oppWinding; - if (oppSpanWinding) { - int innerOppWinding = oppWinding + oppSpanWinding; - if (useInnerWinding(oppWinding, innerOppWinding)) { - outerOppWinding = innerOppWinding; - } - } + const int endIndex = nextEnd; SkASSERT(startIndex != endIndex); - int count = fTs.count(); - SkASSERT(startIndex < endIndex ? startIndex < count - 1 - : startIndex > 0); - int step = SkSign32(endIndex - startIndex); - int end = nextExactSpan(startIndex, step); + const int count = fTs.count(); + SkASSERT(startIndex < endIndex ? startIndex < count - 1 : startIndex > 0); + const int step = SkSign32(endIndex - startIndex); + const int end = nextExactSpan(startIndex, step); SkASSERT(end >= 0); Span* endSpan = &fTs[end]; Segment* other; @@ -1968,7 +1982,7 @@ public: #if DEBUG_WINDING SkDebugf("%s simple\n", __FUNCTION__); #endif - markDone(SkMin32(startIndex, endIndex), outerWinding, outerOppWinding); + markDoneBinary(SkMin32(startIndex, endIndex)); other = endSpan->fOther; nextStart = endSpan->fOtherIndex; double startT = other->fTs[nextStart].fT; @@ -1992,7 +2006,7 @@ public: int firstIndex = findStartingEdge(sorted, startIndex, end); SkASSERT(firstIndex >= 0); #if DEBUG_SORT - debugShowSort(__FUNCTION__, sorted, firstIndex, winding, oppWinding); + debugShowSort(__FUNCTION__, sorted, firstIndex); #endif if (!sortable) { unsortable = true; @@ -2003,180 +2017,60 @@ public: SkDebugf("%s firstIndex=[%d] sign=%d\n", __FUNCTION__, firstIndex, sorted[firstIndex]->sign()); #endif - int aSumWinding = winding; - int bSumWinding = oppWinding; - bool angleIsOp = sorted[firstIndex]->segment()->operand() ^ operand(); - const Angle* firstAngle = sorted[firstIndex]; - int angleSpan = spanSign(firstAngle); - int oppoSign = oppSign(firstAngle); - if (angleIsOp) { - bSumWinding -= angleSpan; - aSumWinding -= oppoSign; - } else { - aSumWinding -= angleSpan; - bSumWinding -= oppoSign; + int sumMiWinding = updateWinding(endIndex, startIndex); + int sumSuWinding = updateOppWinding(endIndex, startIndex); + if (operand()) { + SkTSwap(sumMiWinding, sumSuWinding); } int nextIndex = firstIndex + 1; int lastIndex = firstIndex != 0 ? firstIndex : angleCount; const Angle* foundAngle = NULL; bool foundDone = false; -#define TWO_CHANNEL_DONE 0 -#if TWO_CHANNEL_DONE - bool foundDone2 = false; -#define FOUND_DONE2 foundDone2 -#else -#define FOUND_DONE2 foundDone -#endif // iterate through the angle, and compute everyone's winding - bool aAltFlipped = false; - bool bAltFlipped = false; - bool foundFlipped = false; - int foundSum = SK_MinS32; - int foundOppWinding = SK_MinS32; Segment* nextSegment; - int aLastNonZeroSum = winding; - int bLastNonZeroSum = oppWinding; - bool foundOpp; do { + SkASSERT(nextIndex != firstIndex); if (nextIndex == angleCount) { nextIndex = 0; } const Angle* nextAngle = sorted[nextIndex]; nextSegment = nextAngle->segment(); - bool nextDone = nextSegment->done(*nextAngle); - bool nextTiny = nextSegment->tiny(*nextAngle); - angleIsOp = nextSegment->operand() ^ operand(); - int deltaSum = nextSegment->spanSign(nextAngle); - int oppDeltaSum = nextSegment->oppSign(nextAngle); - int maxWinding, xorMask, sumWinding, oMaxWinding, oSumWinding; - bool otherNonZero, altFlipped, otherCoin; - if (angleIsOp) { - maxWinding = bSumWinding; - if (bSumWinding) { - bLastNonZeroSum = bSumWinding; - } - bSumWinding -= deltaSum; - sumWinding = bSumWinding; - otherNonZero = aSumWinding & aXorMask; - xorMask = bXorMask; - bAltFlipped ^= bLastNonZeroSum * bSumWinding < 0; // flip if different signs - altFlipped = bAltFlipped; - oMaxWinding = aSumWinding; - aSumWinding -= oppDeltaSum; - oSumWinding = aSumWinding; - otherCoin = aSumWinding & aXorMask; - } else { - maxWinding = aSumWinding; - if (aSumWinding) { - aLastNonZeroSum = aSumWinding; - } - aSumWinding -= deltaSum; - sumWinding = aSumWinding; - otherNonZero = bSumWinding & bXorMask; - xorMask = aXorMask; - aAltFlipped ^= aLastNonZeroSum * aSumWinding < 0; // flip if different signs - altFlipped = aAltFlipped; - oMaxWinding = bSumWinding; - bSumWinding -= oppDeltaSum; - oSumWinding = bSumWinding; - otherCoin = bSumWinding & bXorMask; - } - if (oppDeltaSum && useInnerWinding(oMaxWinding, oSumWinding)) { - oMaxWinding = oSumWinding; - } - bool opIsActive = activeOp(nextSegment->operand(), otherNonZero, otherCoin, op); - if (!(sumWinding & xorMask)) { - if (!active) { - markAndChaseDone(startIndex, endIndex, outerWinding, outerOppWinding); - nextSegment->markAndChaseWinding(nextAngle, maxWinding, oMaxWinding); - #if DEBUG_WINDING - SkDebugf("%s [%d] inactive\n", __FUNCTION__, nextIndex); - #endif - return NULL; - } - if (opIsActive && (!foundAngle || foundDone)) { - foundAngle = nextAngle; - foundDone = nextDone && !nextTiny; - foundFlipped = altFlipped; - foundSum = 0; - foundOpp = angleIsOp; - foundOppWinding = oSumWinding; - } - continue; - } - if (opIsActive && !(maxWinding & xorMask) && (!foundAngle || FOUND_DONE2)) { - #if DEBUG_WINDING - if (foundAngle && FOUND_DONE2) { - SkDebugf("%s [%d] !foundAngle && foundDone2\n", __FUNCTION__, nextIndex); - } - #endif + int maxWinding, sumWinding, oppMaxWinding, oppSumWinding; + bool activeAngle = nextSegment->activeOp(xorMiMask, xorSuMask, nextAngle->start(), + nextAngle->end(), op, sumMiWinding, sumSuWinding, + maxWinding, sumWinding, oppMaxWinding, oppSumWinding); + if (activeAngle && (!foundAngle || foundDone)) { foundAngle = nextAngle; - FOUND_DONE2 = nextDone && !nextTiny; - foundFlipped = altFlipped; - foundSum = sumWinding; - foundOpp = angleIsOp; - foundOppWinding = oMaxWinding; + foundDone = nextSegment->done(nextAngle) && !nextSegment->tiny(nextAngle); } if (nextSegment->done()) { continue; } - // if the winding is non-zero, nextAngle does not connect to - // current chain. If we haven't done so already, mark the angle - // as done, record the winding value, and mark connected unambiguous - // segments as well. - if (nextSegment->windSum(nextAngle) == SK_MinS32) { - if (useInnerWinding(maxWinding, sumWinding)) { - maxWinding = sumWinding; - } - Span* last; - if (foundAngle) { - last = nextSegment->markAndChaseWinding(nextAngle, maxWinding, oMaxWinding); - } else { - last = nextSegment->markAndChaseDone(nextAngle, maxWinding, oMaxWinding); - } - if (last) { - *chase.append() = last; - } + if (nextSegment->windSum(nextAngle) != SK_MinS32) { + continue; + } + Span* last = nextSegment->markAngle(maxWinding, sumWinding, oppMaxWinding, + oppSumWinding, activeAngle, nextAngle); + if (last) { + *chase.append() = last; +#if DEBUG_WINDING + SkDebugf("%s chase.append id=%d\n", __FUNCTION__, + last->fOther->fTs[last->fOtherIndex].fOther->debugID()); +#endif } } while (++nextIndex != lastIndex); - markDone(SkMin32(startIndex, endIndex), outerWinding, outerOppWinding); + markDoneBinary(SkMin32(startIndex, endIndex)); if (!foundAngle) { return NULL; } - #if DEBUG_WINDING - int oldSpanSign = spanSign(nextStart, nextEnd); - #endif nextStart = foundAngle->start(); nextEnd = foundAngle->end(); nextSegment = foundAngle->segment(); - int flipped = foundFlipped ? -1 : 1; - int minStartEnd = SkMin32(nextStart, nextEnd); - spanWinding = SkSign32(spanWinding) * flipped * nextSegment->windValue(minStartEnd); - oppSpanWinding = SkSign32(oppSpanWinding) * flipped * nextSegment->oppValue(minStartEnd); #if DEBUG_WINDING - SkDebugf("%s foundFlipped=%d spanWinding=%d oldSpanSign=%d spanSign=%d\n", - __FUNCTION__, foundFlipped, spanWinding, oldSpanSign, - nextSegment->spanSign(foundAngle)); - SkDebugf("%s foundOpp=%d oppWinding=%d oppSpanWinding=%d foundOppWinding=%d winding=%d" - " foundSum=", __FUNCTION__, foundOpp, oppWinding, oppSpanWinding, foundOppWinding, - winding); - if (foundSum == SK_MinS32) { - SkDebugf("?"); - } else { - SkDebugf("%d", foundSum); - } - SkDebugf("\n"); + SkDebugf("%s from:[%d] to:[%d] start=%d end=%d\n", + __FUNCTION__, debugID(), nextSegment->debugID(), nextStart, nextEnd); #endif - if (oppWinding != foundOppWinding) { - oppWinding = foundOppWinding; - if (foundOpp) { - SkASSERT(foundSum != SK_MinS32); - winding = foundSum; - spanWinding = nextSegment->spanSign(foundAngle); - oppSpanWinding = nextSegment->oppSign(foundAngle); - } - } return nextSegment; } @@ -2293,8 +2187,8 @@ public: lastNonZeroSum = sumWinding; } nextSegment = nextAngle->segment(); - bool nextDone = nextSegment->done(*nextAngle); - bool nextTiny = nextSegment->tiny(*nextAngle); + bool nextDone = nextSegment->done(nextAngle); + bool nextTiny = nextSegment->tiny(nextAngle); sumWinding -= nextSegment->spanSign(nextAngle); altFlipped ^= lastNonZeroSum * sumWinding < 0; // flip if different signs #if 0 && DEBUG_WINDING @@ -2352,6 +2246,10 @@ public: } if (last) { *chase.append() = last; + #if DEBUG_WINDING + SkDebugf("%s chase.append id=%d\n", __FUNCTION__, + last->fOther->fTs[last->fOtherIndex].fOther->debugID()); + #endif } } } while (++nextIndex != lastIndex); @@ -2455,7 +2353,7 @@ public: } nextAngle = sorted[nextIndex]; nextSegment = nextAngle->segment(); - if (!nextSegment->done(*nextAngle)) { + if (!nextSegment->done(nextAngle)) { break; } if (++nextIndex == lastIndex) { @@ -2728,7 +2626,7 @@ public: return last; } - Span* innerChaseDone(int index, int step, int winding, int oppWinding) { + Span* innerChaseDoneBinary(int index, int step, int winding, int oppWinding) { int end = nextExactSpan(index, step); SkASSERT(end >= 0); if (multipleSpans(end)) { @@ -2738,11 +2636,25 @@ public: Segment* other = endSpan.fOther; index = endSpan.fOtherIndex; int otherEnd = other->nextExactSpan(index, step); - Span* last = other->innerChaseDone(index, step, winding, oppWinding); - other->markDone(SkMin32(index, otherEnd), winding, oppWinding); + Span* last = other->innerChaseDoneBinary(index, step, winding, oppWinding); + other->markDoneBinary(SkMin32(index, otherEnd), winding, oppWinding); return last; } + Span* innerChaseDoneBinary(int index, int step) { + int end = nextExactSpan(index, step); + SkASSERT(end >= 0); + if (multipleSpans(end)) { + return &fTs[end]; + } + const Span& endSpan = fTs[end]; + Segment* other = endSpan.fOther; + index = endSpan.fOtherIndex; + int otherEnd = other->nextExactSpan(index, step); + Span* last = other->innerChaseDoneBinary(index, step); + other->markDoneBinary(SkMin32(index, otherEnd)); + return last; + } Span* innerChaseWinding(int index, int step, int winding) { int end = nextExactSpan(index, step); @@ -2791,6 +2703,18 @@ public: fVerb = verb; } + void initWinding(int start, int end, int winding, int oppWinding) { + int local = spanSign(start, end); + if (local * winding >= 0) { + winding += local; + } + local = oppSign(start, end); + if (local * oppWinding >= 0) { + oppWinding += local; + } + markAndChaseWinding(start, end, winding, oppWinding); + } + bool intersected() const { return fTs.count() > 0; } @@ -2864,12 +2788,6 @@ public: return markAndChaseDone(index, endIndex, winding); } - Span* markAndChaseDone(const Angle* angle, int winding, int oppWinding) { - int index = angle->start(); - int endIndex = angle->end(); - return markAndChaseDone(index, endIndex, winding, oppWinding); - } - Span* markAndChaseDone(int index, int endIndex, int winding) { int step = SkSign32(endIndex - index); Span* last = innerChaseDone(index, step, winding); @@ -2877,10 +2795,19 @@ public: return last; } - Span* markAndChaseDone(int index, int endIndex, int winding, int oppWinding) { + Span* markAndChaseDoneBinary(const Angle* angle, int winding, int oppWinding) { + int index = angle->start(); + int endIndex = angle->end(); int step = SkSign32(endIndex - index); - Span* last = innerChaseDone(index, step, winding, oppWinding); - markDone(SkMin32(index, endIndex), winding, oppWinding); + Span* last = innerChaseDoneBinary(index, step, winding, oppWinding); + markDoneBinary(SkMin32(index, endIndex), winding, oppWinding); + return last; + } + + Span* markAndChaseDoneBinary(int index, int endIndex) { + int step = SkSign32(endIndex - index); + Span* last = innerChaseDoneBinary(index, step); + markDoneBinary(SkMin32(index, endIndex)); return last; } @@ -2893,10 +2820,8 @@ public: markWinding(min, winding); return last; } - - Span* markAndChaseWinding(const Angle* angle, int winding, int oppWinding) { - int index = angle->start(); - int endIndex = angle->end(); + + Span* markAndChaseWinding(int index, int endIndex, int winding, int oppWinding) { int min = SkMin32(index, endIndex); int step = SkSign32(endIndex - index); Span* last = innerChaseWinding(index, step, winding, oppWinding); @@ -2904,6 +2829,30 @@ public: return last; } + Span* markAndChaseWinding(const Angle* angle, int winding, int oppWinding) { + int start = angle->start(); + int end = angle->end(); + return markAndChaseWinding(start, end, winding, oppWinding); + } + + Span* markAngle(int maxWinding, int sumWinding, int oppMaxWinding, int oppSumWinding, + bool activeAngle, const Angle* angle) { + SkASSERT(angle->segment() == this); + if (useInnerWinding(maxWinding, sumWinding)) { + maxWinding = sumWinding; + } + if (oppMaxWinding != oppSumWinding && useInnerWinding(oppMaxWinding, oppSumWinding)) { + oppMaxWinding = oppSumWinding; + } + Span* last; + if (activeAngle) { + last = markAndChaseWinding(angle, maxWinding, oppMaxWinding); + } else { + last = markAndChaseDoneBinary(angle, maxWinding, oppMaxWinding); + } + return last; + } + // FIXME: this should also mark spans with equal (x,y) // This may be called when the segment is already marked done. While this // wastes time, it shouldn't do any more than spin through the T spans. @@ -2922,16 +2871,27 @@ public: } while (++index < fTs.count() && precisely_negative(fTs[index].fT - referenceT)); } - void markDone(int index, int winding, int oppWinding) { + void markDoneBinary(int index, int winding, int oppWinding) { // SkASSERT(!done()); SkASSERT(winding); double referenceT = fTs[index].fT; int lesser = index; while (--lesser >= 0 && precisely_negative(referenceT - fTs[lesser].fT)) { - markOneDone(__FUNCTION__, lesser, winding, oppWinding); + markOneDoneBinary(__FUNCTION__, lesser, winding, oppWinding); } do { - markOneDone(__FUNCTION__, index, winding, oppWinding); + markOneDoneBinary(__FUNCTION__, index, winding, oppWinding); + } while (++index < fTs.count() && precisely_negative(fTs[index].fT - referenceT)); + } + + void markDoneBinary(int index) { + double referenceT = fTs[index].fT; + int lesser = index; + while (--lesser >= 0 && precisely_negative(referenceT - fTs[lesser].fT)) { + markOneDoneBinary(__FUNCTION__, lesser); + } + do { + markOneDoneBinary(__FUNCTION__, index); } while (++index < fTs.count() && precisely_negative(fTs[index].fT - referenceT)); } @@ -2944,7 +2904,16 @@ public: fDoneSpans++; } - void markOneDone(const char* funName, int tIndex, int winding, int oppWinding) { + void markOneDoneBinary(const char* funName, int tIndex) { + Span* span = verifyOneWinding(funName, tIndex); + if (!span) { + return; + } + span->fDone = true; + fDoneSpans++; + } + + void markOneDoneBinary(const char* funName, int tIndex, int winding, int oppWinding) { Span* span = markOneWinding(funName, tIndex, winding, oppWinding); if (!span) { return; @@ -2990,6 +2959,19 @@ public: return &span; } + Span* verifyOneWinding(const char* funName, int tIndex) { + Span& span = fTs[tIndex]; + if (span.fDone) { + return NULL; + } + #if DEBUG_MARK_DONE + debugShowNewWinding(funName, span, span.fWindSum, span.fOppSum); + #endif + SkASSERT(span.fWindSum != SK_MinS32); + SkASSERT(span.fOppSum != SK_MinS32); + return &span; + } + // note that just because a span has one end that is unsortable, that's // not enough to mark it done. The other end may be sortable, allowing the // span to be added. @@ -3157,6 +3139,23 @@ public: fTs.reset(); } + void setUpWindings(int index, int endIndex, int& sumMiWinding, int& sumSuWinding, + int& maxWinding, int& sumWinding, int& oppMaxWinding, int& oppSumWinding) { + int deltaSum = spanSign(index, endIndex); + int oppDeltaSum = oppSign(index, endIndex); + if (operand()) { + maxWinding = sumSuWinding; + sumWinding = sumSuWinding -= deltaSum; + oppMaxWinding = sumMiWinding; + oppSumWinding = sumMiWinding -= oppDeltaSum; + } else { + maxWinding = sumMiWinding; + sumWinding = sumMiWinding -= deltaSum; + oppMaxWinding = sumSuWinding; + oppSumWinding = sumSuWinding -= oppDeltaSum; + } + } + // This marks all spans unsortable so that this info is available for early // exclusion in find top and others. This could be optimized to only mark // adjacent spans that unsortable. However, this makes it difficult to later @@ -3213,9 +3212,9 @@ public: return fTs[tIndex].fT; } - bool tiny(const Angle& angle) const { - int start = angle.start(); - int end = angle.end(); + bool tiny(const Angle* angle) const { + int start = angle->start(); + int end = angle->end(); const Span& mSpan = fTs[SkMin32(start, end)]; return mSpan.fTiny; } @@ -3254,6 +3253,50 @@ public: fPts = pts; } + int updateOppWinding(int index, int endIndex) const { + int lesser = SkMin32(index, endIndex); + int oppWinding = oppSum(lesser); + int oppSpanWinding = oppSign(index, endIndex); + if (oppSpanWinding && useInnerWinding(oppWinding - oppSpanWinding, oppWinding)) { + oppWinding -= oppSpanWinding; + } + return oppWinding; + } + + int updateOppWinding(const Angle* angle) const { + int startIndex = angle->start(); + int endIndex = angle->end(); + return updateOppWinding(endIndex, startIndex); + } + + int updateOppWindingReverse(const Angle* angle) const { + int startIndex = angle->start(); + int endIndex = angle->end(); + return updateOppWinding(startIndex, endIndex); + } + + int updateWinding(int index, int endIndex) const { + int lesser = SkMin32(index, endIndex); + int winding = windSum(lesser); + int spanWinding = spanSign(index, endIndex); + if (useInnerWinding(winding - spanWinding, winding)) { + winding -= spanWinding; + } + return winding; + } + + int updateWinding(const Angle* angle) const { + int startIndex = angle->start(); + int endIndex = angle->end(); + return updateWinding(endIndex, startIndex); + } + + int updateWindingReverse(const Angle* angle) const { + int startIndex = angle->start(); + int endIndex = angle->end(); + return updateWinding(startIndex, endIndex); + } + SkPath::Verb verb() const { return fVerb; } @@ -3585,6 +3628,15 @@ public: } } while (index != first); } + + void debugShowSort(const char* fun, const SkTDArray& angles, int first) { + const Angle* firstAngle = angles[first]; + const Segment* segment = firstAngle->segment(); + int winding = segment->updateWinding(firstAngle); + int oppWinding = segment->updateOppWinding(firstAngle); + debugShowSort(fun, angles, first, winding, oppWinding); + } + #endif #if DEBUG_WINDING @@ -4794,7 +4846,7 @@ static int innerContourCheck(SkTDArray& contourList, double tHit; for (int cTest = 0; cTest < contourCount; ++cTest) { Contour* contour = contourList[cTest]; - if (contour->operand() ^ current->operand() != opp) { + if ((contour->operand() ^ current->operand()) != opp) { continue; } if (basePt.fY < contour->bounds().fTop) { @@ -5143,7 +5195,7 @@ static bool bridgeWinding(SkTDArray& contourList, PathWrapper& simple) int sumWinding = current->windSum(SkMin32(index, endIndex)); // FIXME: don't I have to adjust windSum to get contourWinding? if (sumWinding == SK_MinS32) { - sumWinding = current->computeSum(index, endIndex, NULL); + sumWinding = current->computeSum(index, endIndex, false); } if (sumWinding == SK_MinS32) { contourWinding = innerContourCheck(contourList, current, diff --git a/experimental/Intersection/SimplifyNew_Test.cpp b/experimental/Intersection/SimplifyNew_Test.cpp index 158d2c6..2affc05 100644 --- a/experimental/Intersection/SimplifyNew_Test.cpp +++ b/experimental/Intersection/SimplifyNew_Test.cpp @@ -446,134 +446,134 @@ static void testLine14x() { static void testLine15() { SkPath path; - path.addRect(0, 0, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 0, 9, 9, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine15x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 0, 9, 9, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine16() { SkPath path; - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 4, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 4, 9, 9, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine16x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 4, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 4, 9, 9, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine17() { SkPath path; - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine17x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine18() { SkPath path; - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(12, 4, 21, 21, (SkPath::Direction) 0); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(12, 4, 21, 21, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine18x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(12, 4, 21, 21, (SkPath::Direction) 0); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(12, 4, 21, 21, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine19() { SkPath path; - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(12, 16, 21, 21, (SkPath::Direction) 0); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(12, 16, 21, 21, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine19x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(12, 16, 21, 21, (SkPath::Direction) 0); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(12, 16, 21, 21, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine20() { SkPath path; - path.addRect(0, 12, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 12, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 12, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 12, 9, 9, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine20x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 12, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 12, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 12, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 12, 9, 9, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine21() { SkPath path; - path.addRect(0, 12, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 16, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 12, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 16, 9, 9, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine21x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 12, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 16, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 12, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 16, 9, 9, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine22() { SkPath path; - path.addRect(0, 12, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 12, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine22x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 12, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 12, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine23() { SkPath path; - path.addRect(0, 12, 12, 12, (SkPath::Direction) 0); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 0); + path.addRect(0, 12, 12, 12, SkPath::kCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine23x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 12, 12, 12, (SkPath::Direction) 0); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 0); + path.addRect(0, 12, 12, 12, SkPath::kCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCW_Direction); testSimplifyx(path); } @@ -606,1071 +606,1081 @@ static void testLine24ax() { static void testLine24() { SkPath path; - path.addRect(0, 18, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 18, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine24x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 18, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 18, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine25() { SkPath path; - path.addRect(0, 6, 12, 12, (SkPath::Direction) 0); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 0); + path.addRect(0, 6, 12, 12, SkPath::kCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine25x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 6, 12, 12, (SkPath::Direction) 0); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 0); + path.addRect(0, 6, 12, 12, SkPath::kCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine26() { SkPath path; - path.addRect(0, 18, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 12, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 18, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 12, 9, 9, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine26x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 18, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 12, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 18, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 12, 9, 9, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine27() { SkPath path; - path.addRect(0, 18, 12, 12, (SkPath::Direction) 0); - path.addRect(12, 8, 21, 21, (SkPath::Direction) 0); + path.addRect(0, 18, 12, 12, SkPath::kCW_Direction); + path.addRect(12, 8, 21, 21, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine27x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 18, 12, 12, (SkPath::Direction) 0); - path.addRect(12, 8, 21, 21, (SkPath::Direction) 0); + path.addRect(0, 18, 12, 12, SkPath::kCW_Direction); + path.addRect(12, 8, 21, 21, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine28() { SkPath path; - path.addRect(0, 6, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 6, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 0, 9, 9, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine28x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 6, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 6, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 0, 9, 9, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine29() { SkPath path; - path.addRect(0, 18, 12, 12, (SkPath::Direction) 0); - path.addRect(12, 12, 21, 21, (SkPath::Direction) 0); + path.addRect(0, 18, 12, 12, SkPath::kCW_Direction); + path.addRect(12, 12, 21, 21, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine29x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 18, 12, 12, (SkPath::Direction) 0); - path.addRect(12, 12, 21, 21, (SkPath::Direction) 0); + path.addRect(0, 18, 12, 12, SkPath::kCW_Direction); + path.addRect(12, 12, 21, 21, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine30() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 4, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 4, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine30x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 4, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 4, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine31() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 4, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 4, 9, 9, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine31x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 4, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 4, 9, 9, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine32() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine32x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine33() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 16, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 16, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine33x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 16, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 16, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine34() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 6, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 6, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine34x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 6, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 6, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine35() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 0, 18, 18, (SkPath::Direction) 0); - path.addRect(4, 16, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 0, 18, 18, SkPath::kCW_Direction); + path.addRect(4, 16, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine35x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 0, 18, 18, (SkPath::Direction) 0); - path.addRect(4, 16, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 0, 18, 18, SkPath::kCW_Direction); + path.addRect(4, 16, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine36() { SkPath path; - path.addRect(0, 10, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 12, 18, 18, (SkPath::Direction) 0); - path.addRect(4, 16, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 10, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 12, 18, 18, SkPath::kCW_Direction); + path.addRect(4, 16, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine36x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 10, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 12, 18, 18, (SkPath::Direction) 0); - path.addRect(4, 16, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 10, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 12, 18, 18, SkPath::kCW_Direction); + path.addRect(4, 16, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine37() { SkPath path; - path.addRect(0, 20, 20, 20, (SkPath::Direction) 0); - path.addRect(18, 24, 30, 30, (SkPath::Direction) 0); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 20, 20, 20, SkPath::kCW_Direction); + path.addRect(18, 24, 30, 30, SkPath::kCW_Direction); + path.addRect(0, 0, 9, 9, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine37x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 20, 20, 20, (SkPath::Direction) 0); - path.addRect(18, 24, 30, 30, (SkPath::Direction) 0); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 20, 20, 20, SkPath::kCW_Direction); + path.addRect(18, 24, 30, 30, SkPath::kCW_Direction); + path.addRect(0, 0, 9, 9, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine38() { SkPath path; - path.addRect(10, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(6, 12, 18, 18, (SkPath::Direction) 0); - path.addRect(12, 12, 21, 21, (SkPath::Direction) 0); + path.addRect(10, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(6, 12, 18, 18, SkPath::kCW_Direction); + path.addRect(12, 12, 21, 21, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine38x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(10, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(6, 12, 18, 18, (SkPath::Direction) 0); - path.addRect(12, 12, 21, 21, (SkPath::Direction) 0); + path.addRect(10, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(6, 12, 18, 18, SkPath::kCW_Direction); + path.addRect(12, 12, 21, 21, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine40() { SkPath path; - path.addRect(10, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(12, 18, 24, 24, (SkPath::Direction) 0); - path.addRect(4, 16, 13, 13, (SkPath::Direction) 0); + path.addRect(10, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(12, 18, 24, 24, SkPath::kCW_Direction); + path.addRect(4, 16, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine40x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(10, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(12, 18, 24, 24, (SkPath::Direction) 0); - path.addRect(4, 16, 13, 13, (SkPath::Direction) 0); + path.addRect(10, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(12, 18, 24, 24, SkPath::kCW_Direction); + path.addRect(4, 16, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine41() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(18, 24, 30, 30, (SkPath::Direction) 0); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(18, 24, 30, 30, SkPath::kCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine41x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(18, 24, 30, 30, (SkPath::Direction) 0); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(18, 24, 30, 30, SkPath::kCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine42() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(8, 16, 17, 17, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(8, 16, 17, 17, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine42x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(8, 16, 17, 17, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(8, 16, 17, 17, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine43() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 24, 18, 18, (SkPath::Direction) 0); - path.addRect(0, 32, 9, 36, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 24, 18, 18, SkPath::kCW_Direction); + path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine43x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 24, 18, 18, (SkPath::Direction) 0); - path.addRect(0, 32, 9, 36, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 24, 18, 18, SkPath::kCW_Direction); + path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine44() { SkPath path; - path.addRect(10, 40, 30, 30, (SkPath::Direction) 0); - path.addRect(18, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(18, 32, 27, 36, (SkPath::Direction) 1); + path.addRect(10, 40, 30, 30, SkPath::kCW_Direction); + path.addRect(18, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(18, 32, 27, 36, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine44x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(10, 40, 30, 30, (SkPath::Direction) 0); - path.addRect(18, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(18, 32, 27, 36, (SkPath::Direction) 1); + path.addRect(10, 40, 30, 30, SkPath::kCW_Direction); + path.addRect(18, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(18, 32, 27, 36, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine45() { SkPath path; - path.addRect(10, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(18, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(24, 32, 33, 36, (SkPath::Direction) 0); + path.addRect(10, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(18, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(24, 32, 33, 36, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine45x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(10, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(18, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(24, 32, 33, 36, (SkPath::Direction) 0); + path.addRect(10, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(18, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(24, 32, 33, 36, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine46() { SkPath path; - path.addRect(10, 40, 30, 30, (SkPath::Direction) 0); - path.addRect(24, 0, 36, 36, (SkPath::Direction) 0); - path.addRect(24, 32, 33, 36, (SkPath::Direction) 0); + path.addRect(10, 40, 30, 30, SkPath::kCW_Direction); + path.addRect(24, 0, 36, 36, SkPath::kCW_Direction); + path.addRect(24, 32, 33, 36, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine46x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(10, 40, 30, 30, (SkPath::Direction) 0); - path.addRect(24, 0, 36, 36, (SkPath::Direction) 0); - path.addRect(24, 32, 33, 36, (SkPath::Direction) 0); + path.addRect(10, 40, 30, 30, SkPath::kCW_Direction); + path.addRect(24, 0, 36, 36, SkPath::kCW_Direction); + path.addRect(24, 32, 33, 36, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine47() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine47x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine48() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 6, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 6, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine48x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 6, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 6, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine49() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 0, 9, 9, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine49x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 0, 9, 9, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine50() { SkPath path; - path.addRect(10, 30, 30, 30, (SkPath::Direction) 0); - path.addRect(24, 20, 36, 30, (SkPath::Direction) 0); + path.addRect(10, 30, 30, 30, SkPath::kCW_Direction); + path.addRect(24, 20, 36, 30, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine50x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(10, 30, 30, 30, (SkPath::Direction) 0); - path.addRect(24, 20, 36, 30, (SkPath::Direction) 0); + path.addRect(10, 30, 30, 30, SkPath::kCW_Direction); + path.addRect(24, 20, 36, 30, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine51() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 12, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 12, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine51x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 12, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 12, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine52() { SkPath path; - path.addRect(0, 30, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 20, 18, 30, (SkPath::Direction) 0); - path.addRect(32, 0, 36, 41, (SkPath::Direction) 0); + path.addRect(0, 30, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 20, 18, 30, SkPath::kCW_Direction); + path.addRect(32, 0, 36, 41, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine52x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 30, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 20, 18, 30, (SkPath::Direction) 0); - path.addRect(32, 0, 36, 41, (SkPath::Direction) 0); + path.addRect(0, 30, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 20, 18, 30, SkPath::kCW_Direction); + path.addRect(32, 0, 36, 41, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine53() { SkPath path; - path.addRect(10, 30, 30, 30, (SkPath::Direction) 0); - path.addRect(12, 20, 24, 30, (SkPath::Direction) 0); - path.addRect(12, 32, 21, 36, (SkPath::Direction) 1); + path.addRect(10, 30, 30, 30, SkPath::kCW_Direction); + path.addRect(12, 20, 24, 30, SkPath::kCW_Direction); + path.addRect(12, 32, 21, 36, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine53x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(10, 30, 30, 30, (SkPath::Direction) 0); - path.addRect(12, 20, 24, 30, (SkPath::Direction) 0); - path.addRect(12, 32, 21, 36, (SkPath::Direction) 1); + path.addRect(10, 30, 30, 30, SkPath::kCW_Direction); + path.addRect(12, 20, 24, 30, SkPath::kCW_Direction); + path.addRect(12, 32, 21, 36, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine54() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 0, 18, 18, (SkPath::Direction) 0); - path.addRect(8, 4, 17, 17, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 0, 18, 18, SkPath::kCW_Direction); + path.addRect(8, 4, 17, 17, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine54x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 0, 18, 18, (SkPath::Direction) 0); - path.addRect(8, 4, 17, 17, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 0, 18, 18, SkPath::kCW_Direction); + path.addRect(8, 4, 17, 17, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine55() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 6, 18, 18, (SkPath::Direction) 0); - path.addRect(4, 4, 13, 13, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 6, 18, 18, SkPath::kCW_Direction); + path.addRect(4, 4, 13, 13, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine55x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 6, 18, 18, (SkPath::Direction) 0); - path.addRect(4, 4, 13, 13, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 6, 18, 18, SkPath::kCW_Direction); + path.addRect(4, 4, 13, 13, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine56() { SkPath path; - path.addRect(0, 20, 20, 20, (SkPath::Direction) 0); - path.addRect(18, 20, 30, 30, (SkPath::Direction) 0); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 1); + path.addRect(0, 20, 20, 20, SkPath::kCW_Direction); + path.addRect(18, 20, 30, 30, SkPath::kCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine56x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 20, 20, 20, (SkPath::Direction) 0); - path.addRect(18, 20, 30, 30, (SkPath::Direction) 0); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 1); + path.addRect(0, 20, 20, 20, SkPath::kCW_Direction); + path.addRect(18, 20, 30, 30, SkPath::kCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine57() { SkPath path; - path.addRect(20, 0, 40, 40, (SkPath::Direction) 0); - path.addRect(20, 0, 30, 40, (SkPath::Direction) 0); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 1); + path.addRect(20, 0, 40, 40, SkPath::kCW_Direction); + path.addRect(20, 0, 30, 40, SkPath::kCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine57x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(20, 0, 40, 40, (SkPath::Direction) 0); - path.addRect(20, 0, 30, 40, (SkPath::Direction) 0); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 1); + path.addRect(20, 0, 40, 40, SkPath::kCW_Direction); + path.addRect(20, 0, 30, 40, SkPath::kCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine58() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 1); - path.addRect(0, 12, 9, 9, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCCW_Direction); + path.addRect(0, 12, 9, 9, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine58x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 1); - path.addRect(0, 12, 9, 9, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCCW_Direction); + path.addRect(0, 12, 9, 9, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine59() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 6, 18, 18, (SkPath::Direction) 1); - path.addRect(4, 4, 13, 13, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 6, 18, 18, SkPath::kCCW_Direction); + path.addRect(4, 4, 13, 13, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine59x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 6, 18, 18, (SkPath::Direction) 1); - path.addRect(4, 4, 13, 13, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 6, 18, 18, SkPath::kCCW_Direction); + path.addRect(4, 4, 13, 13, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine60() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 12, 18, 18, (SkPath::Direction) 1); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 12, 18, 18, SkPath::kCCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine60x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 12, 18, 18, (SkPath::Direction) 1); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 12, 18, 18, SkPath::kCCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine61() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(12, 0, 24, 24, (SkPath::Direction) 1); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(12, 0, 24, 24, SkPath::kCCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine61x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(12, 0, 24, 24, (SkPath::Direction) 1); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(12, 0, 24, 24, SkPath::kCCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine62() { SkPath path; - path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 12, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 1); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 12, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine62x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 12, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 1); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 12, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine63() { SkPath path; - path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(0, 10, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 6, 12, 12, (SkPath::Direction) 1); - path.addRect(0, 32, 9, 36, (SkPath::Direction) 1); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(0, 10, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 6, 12, 12, SkPath::kCCW_Direction); + path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine63x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(0, 10, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 6, 12, 12, (SkPath::Direction) 1); - path.addRect(0, 32, 9, 36, (SkPath::Direction) 1); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(0, 10, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 6, 12, 12, SkPath::kCCW_Direction); + path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine64() { SkPath path; - path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(10, 40, 30, 30, (SkPath::Direction) 0); - path.addRect(18, 6, 30, 30, (SkPath::Direction) 0); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(10, 40, 30, 30, SkPath::kCW_Direction); + path.addRect(18, 6, 30, 30, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine64x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(10, 40, 30, 30, (SkPath::Direction) 0); - path.addRect(18, 6, 30, 30, (SkPath::Direction) 0); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(10, 40, 30, 30, SkPath::kCW_Direction); + path.addRect(18, 6, 30, 30, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine65() { SkPath path; - path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(10, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(24, 0, 36, 36, (SkPath::Direction) 0); - path.addRect(32, 6, 36, 41, (SkPath::Direction) 1); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(10, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(24, 0, 36, 36, SkPath::kCW_Direction); + path.addRect(32, 6, 36, 41, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine65x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(10, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(24, 0, 36, 36, (SkPath::Direction) 0); - path.addRect(32, 6, 36, 41, (SkPath::Direction) 1); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(10, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(24, 0, 36, 36, SkPath::kCW_Direction); + path.addRect(32, 6, 36, 41, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine66() { SkPath path; - path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(0, 30, 20, 20, (SkPath::Direction) 0); - path.addRect(12, 20, 24, 30, (SkPath::Direction) 0); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(0, 30, 20, 20, SkPath::kCW_Direction); + path.addRect(12, 20, 24, 30, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine66x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(0, 30, 20, 20, (SkPath::Direction) 0); - path.addRect(12, 20, 24, 30, (SkPath::Direction) 0); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(0, 30, 20, 20, SkPath::kCW_Direction); + path.addRect(12, 20, 24, 30, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine67() { SkPath path; - path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(10, 40, 30, 30, (SkPath::Direction) 0); - path.addRect(24, 20, 36, 30, (SkPath::Direction) 0); - path.addRect(32, 0, 36, 41, (SkPath::Direction) 0); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(10, 40, 30, 30, SkPath::kCW_Direction); + path.addRect(24, 20, 36, 30, SkPath::kCW_Direction); + path.addRect(32, 0, 36, 41, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine67x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(10, 40, 30, 30, (SkPath::Direction) 0); - path.addRect(24, 20, 36, 30, (SkPath::Direction) 0); - path.addRect(32, 0, 36, 41, (SkPath::Direction) 0); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(10, 40, 30, 30, SkPath::kCW_Direction); + path.addRect(24, 20, 36, 30, SkPath::kCW_Direction); + path.addRect(32, 0, 36, 41, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine68a() { SkPath path; - path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 0); - path.addRect(1, 2, 4, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCW_Direction); + path.addRect(1, 2, 4, 2, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine68ax() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 0); - path.addRect(1, 2, 4, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCW_Direction); + path.addRect(1, 2, 4, 2, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine68b() { SkPath path; - path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(1, 2, 2, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(1, 2, 2, 2, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine68bx() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(1, 2, 2, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(1, 2, 2, 2, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine68c() { SkPath path; - path.addRect(0, 0, 8, 8, (SkPath::Direction) 1); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 0); - path.addRect(1, 2, 4, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCW_Direction); + path.addRect(1, 2, 4, 2, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine68cx() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 8, 8, (SkPath::Direction) 1); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 0); - path.addRect(1, 2, 4, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCW_Direction); + path.addRect(1, 2, 4, 2, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine68d() { SkPath path; - path.addRect(0, 0, 8, 8, (SkPath::Direction) 1); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(1, 2, 4, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(1, 2, 4, 2, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine68dx() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 8, 8, (SkPath::Direction) 1); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(1, 2, 4, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(1, 2, 4, 2, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine68e() { SkPath path; - path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(1, 2, 2, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(1, 2, 2, 2, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine68ex() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(1, 2, 2, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(1, 2, 2, 2, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine68f() { SkPath path; - path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(1, 2, 2, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(1, 2, 2, 2, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine68fx() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(1, 2, 2, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(1, 2, 2, 2, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine68g() { SkPath path; - path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(1, 2, 2, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(1, 2, 2, 2, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine68gx() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(1, 2, 2, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(1, 2, 2, 2, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine68h() { SkPath path; - path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(1, 2, 2, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(1, 2, 2, 2, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine68hx() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(1, 2, 2, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(1, 2, 2, 2, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine69() { SkPath path; - path.addRect(0, 20, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 20, 12, 30, (SkPath::Direction) 0); - path.addRect(12, 32, 21, 36, (SkPath::Direction) 0); + path.addRect(0, 20, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 20, 12, 30, SkPath::kCW_Direction); + path.addRect(12, 32, 21, 36, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine69x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 20, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 20, 12, 30, (SkPath::Direction) 0); - path.addRect(12, 32, 21, 36, (SkPath::Direction) 0); + path.addRect(0, 20, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 20, 12, 30, SkPath::kCW_Direction); + path.addRect(12, 32, 21, 36, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine70() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 24, 12, 12, (SkPath::Direction) 0); - path.addRect(12, 32, 21, 36, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 24, 12, 12, SkPath::kCW_Direction); + path.addRect(12, 32, 21, 36, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine70x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 24, 12, 12, (SkPath::Direction) 0); - path.addRect(12, 32, 21, 36, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 24, 12, 12, SkPath::kCW_Direction); + path.addRect(12, 32, 21, 36, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine71() { SkPath path; - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(12, 0, 24, 24, (SkPath::Direction) 0); - path.addRect(12, 32, 21, 36, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(12, 0, 24, 24, SkPath::kCW_Direction); + path.addRect(12, 32, 21, 36, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine71x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(12, 0, 24, 24, (SkPath::Direction) 0); - path.addRect(12, 32, 21, 36, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(12, 0, 24, 24, SkPath::kCW_Direction); + path.addRect(12, 32, 21, 36, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine72() { SkPath path; - path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(10, 40, 30, 30, (SkPath::Direction) 0); - path.addRect(6, 20, 18, 30, (SkPath::Direction) 0); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(10, 40, 30, 30, SkPath::kCW_Direction); + path.addRect(6, 20, 18, 30, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine72x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(10, 40, 30, 30, (SkPath::Direction) 0); - path.addRect(6, 20, 18, 30, (SkPath::Direction) 0); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(10, 40, 30, 30, SkPath::kCW_Direction); + path.addRect(6, 20, 18, 30, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine73() { SkPath path; - path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(0, 40, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 20, 12, 30, (SkPath::Direction) 0); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 1); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(0, 40, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 20, 12, 30, SkPath::kCW_Direction); + path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine73x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(0, 40, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 20, 12, 30, (SkPath::Direction) 0); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 1); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(0, 40, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 20, 12, 30, SkPath::kCW_Direction); + path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine74() { SkPath path; - path.addRect(20, 30, 40, 40, (SkPath::Direction) 0); - path.addRect(24, 20, 36, 30, (SkPath::Direction) 1); - path.addRect(32, 24, 36, 41, (SkPath::Direction) 1); + path.addRect(20, 30, 40, 40, SkPath::kCW_Direction); + path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction); + path.addRect(32, 24, 36, 41, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine74x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(20, 30, 40, 40, (SkPath::Direction) 0); - path.addRect(24, 20, 36, 30, (SkPath::Direction) 1); - path.addRect(32, 24, 36, 41, (SkPath::Direction) 1); + path.addRect(20, 30, 40, 40, SkPath::kCW_Direction); + path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction); + path.addRect(32, 24, 36, 41, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine75() { SkPath path; - path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(10, 0, 30, 30, (SkPath::Direction) 1); - path.addRect(18, 0, 30, 30, (SkPath::Direction) 1); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 1); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(10, 0, 30, 30, SkPath::kCCW_Direction); + path.addRect(18, 0, 30, 30, SkPath::kCCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine75x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(10, 0, 30, 30, (SkPath::Direction) 1); - path.addRect(18, 0, 30, 30, (SkPath::Direction) 1); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 1); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(10, 0, 30, 30, SkPath::kCCW_Direction); + path.addRect(18, 0, 30, 30, SkPath::kCCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine76() { SkPath path; - path.addRect(36, 0, 66, 60, (SkPath::Direction) 0); - path.addRect(10, 20, 40, 30, (SkPath::Direction) 0); - path.addRect(24, 20, 36, 30, (SkPath::Direction) 1); - path.addRect(32, 6, 36, 41, (SkPath::Direction) 1); + path.addRect(36, 0, 66, 60, SkPath::kCW_Direction); + path.addRect(10, 20, 40, 30, SkPath::kCW_Direction); + path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction); + path.addRect(32, 6, 36, 41, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine76x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(36, 0, 66, 60, (SkPath::Direction) 0); - path.addRect(10, 20, 40, 30, (SkPath::Direction) 0); - path.addRect(24, 20, 36, 30, (SkPath::Direction) 1); - path.addRect(32, 6, 36, 41, (SkPath::Direction) 1); + path.addRect(36, 0, 66, 60, SkPath::kCW_Direction); + path.addRect(10, 20, 40, 30, SkPath::kCW_Direction); + path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction); + path.addRect(32, 6, 36, 41, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine77() { SkPath path; - path.addRect(20, 0, 40, 40, (SkPath::Direction) 0); - path.addRect(24, 6, 36, 36, (SkPath::Direction) 1); - path.addRect(24, 32, 33, 36, (SkPath::Direction) 1); + path.addRect(20, 0, 40, 40, SkPath::kCW_Direction); + path.addRect(24, 6, 36, 36, SkPath::kCCW_Direction); + path.addRect(24, 32, 33, 36, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine77x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(20, 0, 40, 40, (SkPath::Direction) 0); - path.addRect(24, 6, 36, 36, (SkPath::Direction) 1); - path.addRect(24, 32, 33, 36, (SkPath::Direction) 1); + path.addRect(20, 0, 40, 40, SkPath::kCW_Direction); + path.addRect(24, 6, 36, 36, SkPath::kCCW_Direction); + path.addRect(24, 32, 33, 36, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine78() { SkPath path; - path.addRect(0, 0, 30, 60, (SkPath::Direction) 0); - path.addRect(10, 20, 30, 30, (SkPath::Direction) 1); - path.addRect(18, 20, 30, 30, (SkPath::Direction) 1); - path.addRect(32, 0, 36, 41, (SkPath::Direction) 1); + path.addRect(0, 0, 30, 60, SkPath::kCW_Direction); + path.addRect(10, 20, 30, 30, SkPath::kCCW_Direction); + path.addRect(18, 20, 30, 30, SkPath::kCCW_Direction); + path.addRect(32, 0, 36, 41, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine78x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 30, 60, (SkPath::Direction) 0); - path.addRect(10, 20, 30, 30, (SkPath::Direction) 1); - path.addRect(18, 20, 30, 30, (SkPath::Direction) 1); - path.addRect(32, 0, 36, 41, (SkPath::Direction) 1); + path.addRect(0, 0, 30, 60, SkPath::kCW_Direction); + path.addRect(10, 20, 30, 30, SkPath::kCCW_Direction); + path.addRect(18, 20, 30, 30, SkPath::kCCW_Direction); + path.addRect(32, 0, 36, 41, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine79() { SkPath path; - path.addRect(0, 36, 60, 30, (SkPath::Direction) 0); - path.addRect(10, 30, 40, 30, (SkPath::Direction) 0); - path.addRect(0, 20, 12, 30, (SkPath::Direction) 1); - path.addRect(0, 32, 9, 36, (SkPath::Direction) 1); + path.addRect(0, 36, 60, 30, SkPath::kCW_Direction); + path.addRect(10, 30, 40, 30, SkPath::kCW_Direction); + path.addRect(0, 20, 12, 30, SkPath::kCCW_Direction); + path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine79x() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 36, 60, 30, (SkPath::Direction) 0); - path.addRect(10, 30, 40, 30, (SkPath::Direction) 0); - path.addRect(0, 20, 12, 30, (SkPath::Direction) 1); - path.addRect(0, 32, 9, 36, (SkPath::Direction) 1); + path.addRect(0, 36, 60, 30, SkPath::kCW_Direction); + path.addRect(10, 30, 40, 30, SkPath::kCW_Direction); + path.addRect(0, 20, 12, 30, SkPath::kCCW_Direction); + path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction); + testSimplifyx(path); +} + +static void testLine81() { + SkPath path; + path.addRect(-1, -1, 3, 3, SkPath::kCW_Direction); + path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); + path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); + path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); + path.addRect(1, 1, 2, 2, SkPath::kCCW_Direction); testSimplifyx(path); } @@ -2254,35 +2264,35 @@ static void testQuadralateral9x() { static void testLine1ax() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 0, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 0, 13, 13, SkPath::kCW_Direction); testSimplifyx(path); } static void testLine2ax() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 20, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 20, 12, 30, (SkPath::Direction) 0); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 1); + path.addRect(0, 20, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 20, 12, 30, SkPath::kCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine3aax() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(10, 30, 30, 30, (SkPath::Direction) 0); - path.addRect(18, 20, 30, 30, (SkPath::Direction) 1); - path.addRect(0, 32, 9, 36, (SkPath::Direction) 1); + path.addRect(10, 30, 30, 30, SkPath::kCW_Direction); + path.addRect(18, 20, 30, 30, SkPath::kCCW_Direction); + path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction); testSimplifyx(path); } static void testLine4ax() { SkPath path; path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(10, 30, 30, 30, (SkPath::Direction) 0); - path.addRect(24, 20, 36, 30, (SkPath::Direction) 1); - path.addRect(0, 32, 9, 36, (SkPath::Direction) 1); + path.addRect(10, 30, 30, 30, SkPath::kCW_Direction); + path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction); + path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction); testSimplifyx(path); } @@ -2610,33 +2620,33 @@ static void testXor2() { static void testOp1d() { SkPath path, pathB; path.setFillType((SkPath::FillType) 0); - path.addRect(0, 0, 1, 1, (SkPath::Direction) 0); - path.addRect(0, 0, 2, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); + path.addRect(0, 0, 2, 2, SkPath::kCW_Direction); pathB.setFillType((SkPath::FillType) 0); - pathB.addRect(0, 0, 1, 1, (SkPath::Direction) 0); - pathB.addRect(0, 0, 1, 1, (SkPath::Direction) 0); + pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); + pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); testShapeOp(path, pathB, kDifference_Op); } static void testOp2d() { SkPath path, pathB; path.setFillType((SkPath::FillType) 0); - path.addRect(0, 0, 1, 1, (SkPath::Direction) 0); - path.addRect(0, 0, 2, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); + path.addRect(0, 0, 2, 2, SkPath::kCW_Direction); pathB.setFillType((SkPath::FillType) 1); - pathB.addRect(0, 0, 1, 1, (SkPath::Direction) 0); - pathB.addRect(0, 0, 1, 1, (SkPath::Direction) 0); + pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); + pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); testShapeOp(path, pathB, kDifference_Op); } static void testOp3d() { SkPath path, pathB; path.setFillType((SkPath::FillType) 0); - path.addRect(0, 0, 1, 1, (SkPath::Direction) 0); - path.addRect(1, 1, 2, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); + path.addRect(1, 1, 2, 2, SkPath::kCW_Direction); pathB.setFillType((SkPath::FillType) 0); - pathB.addRect(0, 0, 1, 1, (SkPath::Direction) 0); - pathB.addRect(0, 0, 1, 1, (SkPath::Direction) 0); + pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); + pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); testShapeOp(path, pathB, kDifference_Op); } @@ -2963,14 +2973,13 @@ path.close(); testSimplifyx(path); } -static void (*firstTest)() = testQuadratic58; +static void (*firstTest)() = testLine81; static struct { void (*fun)(); const char* str; } tests[] = { TEST(testQuadratic58), - TEST(testLine80), TEST(testQuadratic56), TEST(testQuadratic55), TEST(testQuadratic53), @@ -3145,6 +3154,8 @@ static struct { TEST(testLine3x), TEST(testLine2x), TEST(testLine1x), + TEST(testLine81), + TEST(testLine80), TEST(testLine79), TEST(testLine78), TEST(testLine77), @@ -3259,7 +3270,7 @@ static struct { static const size_t subTestCount = sizeof(subTests) / sizeof(subTests[0]); -static void (*firstBinaryTest)() = testOp3d; +static void (*firstBinaryTest)() = testOp1d; static bool skipAll = false; static bool runBinaryTestsFirst = true; @@ -3274,7 +3285,7 @@ void SimplifyNew_Test() { gDebugMaxWindValue = 4; size_t index; #endif - if (firstBinaryTest) { + if (runBinaryTestsFirst && firstBinaryTest) { index = subTestCount - 1; while (index > 0 && subTests[index].fun != firstBinaryTest) { --index; diff --git a/experimental/Intersection/SimplifyRect4x4_Test.cpp b/experimental/Intersection/SimplifyRect4x4_Test.cpp index cdd43dd..5d857e9 100644 --- a/experimental/Intersection/SimplifyRect4x4_Test.cpp +++ b/experimental/Intersection/SimplifyRect4x4_Test.cpp @@ -23,13 +23,13 @@ static void* testSimplify4x4RectsMain(void* data) bzero(pathStr, sizeof(pathStr)); do { int aShape = state.a & 0x03; - int aCW = state.a >> 2; + SkPath::Direction aCW = state.a >> 2 ? SkPath::kCCW_Direction : SkPath::kCW_Direction; int bShape = state.b & 0x03; - int bCW = state.b >> 2; + SkPath::Direction bCW = state.b >> 2 ? SkPath::kCCW_Direction : SkPath::kCW_Direction; int cShape = state.c & 0x03; - int cCW = state.c >> 2; + SkPath::Direction cCW = state.c >> 2 ? SkPath::kCCW_Direction : SkPath::kCW_Direction; int dShape = state.d & 0x03; - int dCW = state.d >> 2; + SkPath::Direction dCW = state.d >> 2 ? SkPath::kCCW_Direction : SkPath::kCW_Direction; for (int aXAlign = 0 ; aXAlign < 5; ++aXAlign) { for (int aYAlign = 0 ; aYAlign < 5; ++aYAlign) { for (int bXAlign = 0 ; bXAlign < 5; ++bXAlign) { @@ -63,9 +63,9 @@ static void* testSimplify4x4RectsMain(void* data) aXAlign = 5; break; } - path.addRect(l, t, r, b, (SkPath::Direction) aCW); + path.addRect(l, t, r, b, aCW); str += sprintf(str, " path.addRect(%d, %d, %d, %d," - " (SkPath::Direction) %d);\n", l, t, r, b, aCW); + " SkPath::kC%sWDirection);\n", l, t, r, b, aCW ? "C" : ""); } else { aXAlign = 5; aYAlign = 5; @@ -91,9 +91,9 @@ static void* testSimplify4x4RectsMain(void* data) bXAlign = 5; break; } - path.addRect(l, t, r, b, (SkPath::Direction) bCW); + path.addRect(l, t, r, b, bCW); str += sprintf(str, " path.addRect(%d, %d, %d, %d," - " (SkPath::Direction) %d);\n", l, t, r, b, bCW); + " SkPath::kC%sWDirection);\n", l, t, r, b, bCW ? "C" : ""); } else { bXAlign = 5; bYAlign = 5; @@ -119,9 +119,9 @@ static void* testSimplify4x4RectsMain(void* data) cXAlign = 5; break; } - path.addRect(l, t, r, b, (SkPath::Direction) cCW); + path.addRect(l, t, r, b, cCW); str += sprintf(str, " path.addRect(%d, %d, %d, %d," - " (SkPath::Direction) %d);\n", l, t, r, b, cCW); + " SkPath::kC%sWDirection);\n", l, t, r, b, cCW ? "C" : ""); } else { cXAlign = 5; cYAlign = 5; @@ -147,9 +147,9 @@ static void* testSimplify4x4RectsMain(void* data) dXAlign = 5; break; } - path.addRect(l, t, r, b, (SkPath::Direction) dCW); + path.addRect(l, t, r, b, dCW); str += sprintf(str, " path.addRect(%d, %d, %d, %d," - " (SkPath::Direction) %d);\n", l, t, r, b, dCW); + " SkPath::kC%sWDirection);\n", l, t, r, b, dCW ? "C" : ""); } else { dXAlign = 5; dYAlign = 5; diff --git a/experimental/Intersection/op.htm b/experimental/Intersection/op.htm index 3621af0..f2de8d2 100644 --- a/experimental/Intersection/op.htm +++ b/experimental/Intersection/op.htm @@ -373,380 +373,386 @@ path.close();
SkPath path, simple; - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCW_Direction); testSimplifyx(path);
SkPath path, simple; - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(12, 16, 21, 21, (SkPath::Direction) 0); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(12, 16, 21, 21, SkPath::kCW_Direction); testSimplifyx(path);
- path.addRect(0, 12, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 12, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
- path.addRect(0, 18, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 18, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
SkPath path, simple; - path.addRect(0, 6, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 6, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 0, 9, 9, SkPath::kCW_Direction); testSimplifyx(path);
SkPath path, simple; - path.addRect(0, 18, 12, 12, (SkPath::Direction) 0); - path.addRect(12, 12, 21, 21, (SkPath::Direction) 0); + path.addRect(0, 18, 12, 12, SkPath::kCW_Direction); + path.addRect(12, 12, 21, 21, SkPath::kCW_Direction); testSimplifyx(path);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 4, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 4, 13, 13, SkPath::kCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 4, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 4, 9, 9, SkPath::kCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 16, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 6, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 6, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 0, 18, 18, (SkPath::Direction) 0); - path.addRect(4, 16, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 0, 18, 18, SkPath::kCW_Direction); + path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
- path.addRect(0, 10, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 12, 18, 18, (SkPath::Direction) 0); - path.addRect(4, 16, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 10, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 12, 18, 18, SkPath::kCW_Direction); + path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
- path.addRect(0, 20, 20, 20, (SkPath::Direction) 0); - path.addRect(18, 24, 30, 30, (SkPath::Direction) 0); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 20, 20, 20, SkPath::kCW_Direction); + path.addRect(18, 24, 30, 30, SkPath::kCW_Direction); + path.addRect(0, 0, 9, 9, SkPath::kCW_Direction);
- path.addRect(10, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(6, 12, 18, 18, (SkPath::Direction) 0); - path.addRect(12, 12, 21, 21, (SkPath::Direction) 0); + path.addRect(10, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(6, 12, 18, 18, SkPath::kCW_Direction); + path.addRect(12, 12, 21, 21, SkPath::kCW_Direction);
- path.addRect(10, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(12, 6, 24, 24, (SkPath::Direction) 0); - path.addRect(12, 4, 21, 21, (SkPath::Direction) 0); + path.addRect(10, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(12, 6, 24, 24, SkPath::kCW_Direction); + path.addRect(12, 4, 21, 21, SkPath::kCW_Direction);
- path.addRect(10, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(12, 18, 24, 24, (SkPath::Direction) 0); - path.addRect(4, 16, 13, 13, (SkPath::Direction) 0); + path.addRect(10, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(12, 18, 24, 24, SkPath::kCW_Direction); + path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(18, 24, 30, 30, (SkPath::Direction) 0); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(18, 24, 30, 30, SkPath::kCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(8, 16, 17, 17, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(8, 16, 17, 17, SkPath::kCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 24, 18, 18, (SkPath::Direction) 0); - path.addRect(0, 32, 9, 36, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 24, 18, 18, SkPath::kCW_Direction); + path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
- path.addRect(10, 40, 30, 30, (SkPath::Direction) 0); - path.addRect(18, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(18, 32, 27, 36, (SkPath::Direction) 1); + path.addRect(10, 40, 30, 30, SkPath::kCW_Direction); + path.addRect(18, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(18, 32, 27, 36, SkPath::kCCW_Direction);
- path.addRect(10, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(18, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(24, 32, 33, 36, (SkPath::Direction) 0); + path.addRect(10, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(18, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(24, 32, 33, 36, SkPath::kCW_Direction);
- path.addRect(10, 40, 30, 30, (SkPath::Direction) 0); - path.addRect(24, 0, 36, 36, (SkPath::Direction) 0); - path.addRect(24, 32, 33, 36, (SkPath::Direction) 0); + path.addRect(10, 40, 30, 30, SkPath::kCW_Direction); + path.addRect(24, 0, 36, 36, SkPath::kCW_Direction); + path.addRect(24, 32, 33, 36, SkPath::kCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 6, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 6, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 0, 9, 9, SkPath::kCW_Direction);
- path.addRect(10, 30, 30, 30, (SkPath::Direction) 0); - path.addRect(24, 20, 36, 30, (SkPath::Direction) 0); + path.addRect(10, 30, 30, 30, SkPath::kCW_Direction); + path.addRect(24, 20, 36, 30, SkPath::kCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 12, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 12, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction);
- path.addRect(0, 30, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 20, 18, 30, (SkPath::Direction) 0); - path.addRect(32, 0, 36, 41, (SkPath::Direction) 0); + path.addRect(0, 30, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 20, 18, 30, SkPath::kCW_Direction); + path.addRect(32, 0, 36, 41, SkPath::kCW_Direction);
- path.addRect(10, 30, 30, 30, (SkPath::Direction) 0); - path.addRect(12, 20, 24, 30, (SkPath::Direction) 0); - path.addRect(12, 32, 21, 36, (SkPath::Direction) 1); + path.addRect(10, 30, 30, 30, SkPath::kCW_Direction); + path.addRect(12, 20, 24, 30, SkPath::kCW_Direction); + path.addRect(12, 32, 21, 36, SkPath::kCCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 0, 18, 18, (SkPath::Direction) 0); - path.addRect(8, 4, 17, 17, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 0, 18, 18, SkPath::kCW_Direction); + path.addRect(8, 4, 17, 17, SkPath::kCCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 6, 18, 18, (SkPath::Direction) 0); - path.addRect(4, 4, 13, 13, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 6, 18, 18, SkPath::kCW_Direction); + path.addRect(4, 4, 13, 13, SkPath::kCCW_Direction);
- path.addRect(0, 20, 20, 20, (SkPath::Direction) 0); - path.addRect(18, 20, 30, 30, (SkPath::Direction) 0); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 1); + path.addRect(0, 20, 20, 20, SkPath::kCW_Direction); + path.addRect(18, 20, 30, 30, SkPath::kCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
- path.addRect(20, 0, 40, 40, (SkPath::Direction) 0); - path.addRect(20, 0, 30, 40, (SkPath::Direction) 0); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 1); + path.addRect(20, 0, 40, 40, SkPath::kCW_Direction); + path.addRect(20, 0, 30, 40, SkPath::kCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 1); - path.addRect(0, 12, 9, 9, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 0, 12, 12, SkPath::kCCW_Direction); + path.addRect(0, 12, 9, 9, SkPath::kCCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 6, 18, 18, (SkPath::Direction) 1); - path.addRect(4, 4, 13, 13, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 6, 18, 18, SkPath::kCCW_Direction); + path.addRect(4, 4, 13, 13, SkPath::kCCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(6, 12, 18, 18, (SkPath::Direction) 1); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(6, 12, 18, 18, SkPath::kCCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(12, 0, 24, 24, (SkPath::Direction) 1); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(12, 0, 24, 24, SkPath::kCCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
- path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 12, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 12, 13, 13, (SkPath::Direction) 1); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 12, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction);
- path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(0, 10, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 6, 12, 12, (SkPath::Direction) 1); - path.addRect(0, 32, 9, 36, (SkPath::Direction) 1); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(0, 10, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 6, 12, 12, SkPath::kCCW_Direction); + path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
- path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(10, 40, 30, 30, (SkPath::Direction) 0); - path.addRect(18, 6, 30, 30, (SkPath::Direction) 0); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(10, 40, 30, 30, SkPath::kCW_Direction); + path.addRect(18, 6, 30, 30, SkPath::kCW_Direction);
- path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(10, 0, 30, 30, (SkPath::Direction) 0); - path.addRect(24, 0, 36, 36, (SkPath::Direction) 0); - path.addRect(32, 6, 36, 41, (SkPath::Direction) 1); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(10, 0, 30, 30, SkPath::kCW_Direction); + path.addRect(24, 0, 36, 36, SkPath::kCW_Direction); + path.addRect(32, 6, 36, 41, SkPath::kCCW_Direction);
- path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(0, 30, 20, 20, (SkPath::Direction) 0); - path.addRect(12, 20, 24, 30, (SkPath::Direction) 0); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(0, 30, 20, 20, SkPath::kCW_Direction); + path.addRect(12, 20, 24, 30, SkPath::kCW_Direction);
- path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(10, 40, 30, 30, (SkPath::Direction) 0); - path.addRect(24, 20, 36, 30, (SkPath::Direction) 0); - path.addRect(32, 0, 36, 41, (SkPath::Direction) 0); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(10, 40, 30, 30, SkPath::kCW_Direction); + path.addRect(24, 20, 36, 30, SkPath::kCW_Direction); + path.addRect(32, 0, 36, 41, SkPath::kCW_Direction);
- path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 0); - path.addRect(1, 2, 4, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCW_Direction); + path.addRect(1, 2, 4, 2, SkPath::kCW_Direction);
- path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(1, 2, 4, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(1, 2, 4, 2, SkPath::kCW_Direction);
- path.addRect(0, 0, 8, 8, (SkPath::Direction) 1); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 0); - path.addRect(1, 2, 4, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCW_Direction); + path.addRect(1, 2, 4, 2, SkPath::kCW_Direction);
- path.addRect(0, 0, 8, 8, (SkPath::Direction) 1); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(1, 2, 4, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(1, 2, 4, 2, SkPath::kCW_Direction);
- path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(1, 2, 2, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
- path.addRect(0, 0, 8, 8, (SkPath::Direction) 0); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(2, 2, 6, 6, (SkPath::Direction) 1); - path.addRect(1, 2, 2, 2, (SkPath::Direction) 0); + path.addRect(0, 0, 8, 8, SkPath::kCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction); + path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
- path.addRect(0, 20, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 20, 12, 30, (SkPath::Direction) 0); - path.addRect(12, 32, 21, 36, (SkPath::Direction) 0); + path.addRect(0, 20, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 20, 12, 30, SkPath::kCW_Direction); + path.addRect(12, 32, 21, 36, SkPath::kCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 24, 12, 12, (SkPath::Direction) 0); - path.addRect(12, 32, 21, 36, (SkPath::Direction) 1); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 24, 12, 12, SkPath::kCW_Direction); + path.addRect(12, 32, 21, 36, SkPath::kCCW_Direction);
- path.addRect(0, 0, 20, 20, (SkPath::Direction) 0); - path.addRect(12, 0, 24, 24, (SkPath::Direction) 0); - path.addRect(12, 32, 21, 36, (SkPath::Direction) 0); + path.addRect(0, 0, 20, 20, SkPath::kCW_Direction); + path.addRect(12, 0, 24, 24, SkPath::kCW_Direction); + path.addRect(12, 32, 21, 36, SkPath::kCW_Direction);
- path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(10, 40, 30, 30, (SkPath::Direction) 0); - path.addRect(6, 20, 18, 30, (SkPath::Direction) 0); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(10, 40, 30, 30, SkPath::kCW_Direction); + path.addRect(6, 20, 18, 30, SkPath::kCW_Direction);
- path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(0, 40, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 20, 12, 30, (SkPath::Direction) 0); - path.addRect(0, 0, 9, 9, (SkPath::Direction) 1); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(0, 40, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 20, 12, 30, SkPath::kCW_Direction); + path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction);
- path.addRect(20, 30, 40, 40, (SkPath::Direction) 0); - path.addRect(24, 20, 36, 30, (SkPath::Direction) 1); - path.addRect(32, 24, 36, 41, (SkPath::Direction) 1); + path.addRect(20, 30, 40, 40, SkPath::kCW_Direction); + path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction); + path.addRect(32, 24, 36, 41, SkPath::kCCW_Direction);
- path.addRect(0, 0, 60, 60, (SkPath::Direction) 0); - path.addRect(10, 0, 30, 30, (SkPath::Direction) 1); - path.addRect(18, 0, 30, 30, (SkPath::Direction) 1); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 1); + path.addRect(0, 0, 60, 60, SkPath::kCW_Direction); + path.addRect(10, 0, 30, 30, SkPath::kCCW_Direction); + path.addRect(18, 0, 30, 30, SkPath::kCCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
- path.addRect(36, 0, 66, 60, (SkPath::Direction) 0); - path.addRect(10, 20, 40, 30, (SkPath::Direction) 0); - path.addRect(24, 20, 36, 30, (SkPath::Direction) 1); - path.addRect(32, 6, 36, 41, (SkPath::Direction) 1); + path.addRect(36, 0, 66, 60, SkPath::kCW_Direction); + path.addRect(10, 20, 40, 30, SkPath::kCW_Direction); + path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction); + path.addRect(32, 6, 36, 41, SkPath::kCCW_Direction);
- path.addRect(20, 0, 40, 40, (SkPath::Direction) 0); - path.addRect(24, 6, 36, 36, (SkPath::Direction) 1); - path.addRect(24, 32, 33, 36, (SkPath::Direction) 1); + path.addRect(20, 0, 40, 40, SkPath::kCW_Direction); + path.addRect(24, 6, 36, 36, SkPath::kCCW_Direction); + path.addRect(24, 32, 33, 36, SkPath::kCCW_Direction);
- path.addRect(0, 0, 30, 60, (SkPath::Direction) 0); - path.addRect(10, 20, 30, 30, (SkPath::Direction) 1); - path.addRect(18, 20, 30, 30, (SkPath::Direction) 1); - path.addRect(32, 0, 36, 41, (SkPath::Direction) 1); + path.addRect(0, 0, 30, 60, SkPath::kCW_Direction); + path.addRect(10, 20, 30, 30, SkPath::kCCW_Direction); + path.addRect(18, 20, 30, 30, SkPath::kCCW_Direction); + path.addRect(32, 0, 36, 41, SkPath::kCCW_Direction);
- path.addRect(0, 36, 60, 30, (SkPath::Direction) 0); - path.addRect(10, 30, 40, 30, (SkPath::Direction) 0); - path.addRect(0, 20, 12, 30, (SkPath::Direction) 1); - path.addRect(0, 32, 9, 36, (SkPath::Direction) 1); + path.addRect(0, 36, 60, 30, SkPath::kCW_Direction); + path.addRect(10, 30, 40, 30, SkPath::kCW_Direction); + path.addRect(0, 20, 12, 30, SkPath::kCCW_Direction); + path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction); +
+ +
+ path.addRect(-1, -1, 3, 3, SkPath::kCW_Direction); + path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); + path.addRect(1, 1, 2, 2, SkPath::kCCW_Direction);
@@ -990,29 +996,29 @@ path.close();
path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 0, 12, 12, (SkPath::Direction) 0); - path.addRect(4, 0, 13, 13, (SkPath::Direction) 0); + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(4, 0, 13, 13, SkPath::kCW_Direction);
path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(0, 20, 20, 20, (SkPath::Direction) 0); - path.addRect(0, 20, 12, 30, (SkPath::Direction) 0); - path.addRect(12, 0, 21, 21, (SkPath::Direction) 1); + path.addRect(0, 20, 20, 20, SkPath::kCW_Direction); + path.addRect(0, 20, 12, 30, SkPath::kCW_Direction); + path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(10, 30, 30, 30, (SkPath::Direction) 0); - path.addRect(18, 20, 30, 30, (SkPath::Direction) 1); - path.addRect(0, 32, 9, 36, (SkPath::Direction) 1); + path.addRect(10, 30, 30, 30, SkPath::kCW_Direction); + path.addRect(18, 20, 30, 30, SkPath::kCCW_Direction); + path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
path.setFillType(SkPath::kEvenOdd_FillType); - path.addRect(10, 30, 30, 30, (SkPath::Direction) 0); - path.addRect(24, 20, 36, 30, (SkPath::Direction) 1); - path.addRect(0, 32, 9, 36, (SkPath::Direction) 1); + path.addRect(10, 30, 30, 30, SkPath::kCW_Direction); + path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction); + path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
@@ -2839,6 +2845,7 @@ path.close();