diff options
author | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-04-08 11:53:42 +0000 |
---|---|---|
committer | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-04-08 11:53:42 +0000 |
commit | ebf95ba28db75212a1313edc947ed68decc30273 (patch) | |
tree | 4792676b0a9a28e55fa40780dac13496f4bf074d /experimental | |
parent | 818b0cc1b8b0c4acc565e8e2cb8b0b61aa5a300e (diff) |
keep old experimental code in sync
git-svn-id: http://skia.googlecode.com/svn/trunk@8554 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental')
-rw-r--r-- | experimental/Intersection/CubicIntersection.cpp | 2 | ||||
-rw-r--r-- | experimental/Intersection/CubicIntersection_Test.cpp | 14 | ||||
-rw-r--r-- | experimental/Intersection/DataTypes.h | 4 | ||||
-rw-r--r-- | experimental/Intersection/Intersection_Tests.cpp | 6 | ||||
-rw-r--r-- | experimental/Intersection/SimplifyNew_Test.cpp | 74 | ||||
-rw-r--r-- | experimental/Intersection/as.htm | 128 | ||||
-rw-r--r-- | experimental/Intersection/op.htm | 7 | ||||
-rw-r--r-- | experimental/Intersection/qc.htm | 78 |
8 files changed, 294 insertions, 19 deletions
diff --git a/experimental/Intersection/CubicIntersection.cpp b/experimental/Intersection/CubicIntersection.cpp index a773c4098e..175b7b7c46 100644 --- a/experimental/Intersection/CubicIntersection.cpp +++ b/experimental/Intersection/CubicIntersection.cpp @@ -20,7 +20,7 @@ #endif #if ONE_OFF_DEBUG -static const double tLimits1[2][2] = {{0.865205808, 0.865215212}, {0.865207696, 0.865208078}}; +static const double tLimits1[2][2] = {{0.36, 0.37}, {0.63, 0.64}}; static const double tLimits2[2][2] = {{-0.865211397, -0.865215212}, {-0.865207696, -0.865208078}}; #endif diff --git a/experimental/Intersection/CubicIntersection_Test.cpp b/experimental/Intersection/CubicIntersection_Test.cpp index 9662eb8379..ffaa933175 100644 --- a/experimental/Intersection/CubicIntersection_Test.cpp +++ b/experimental/Intersection/CubicIntersection_Test.cpp @@ -62,6 +62,12 @@ static void standardTestCases() { } static const Cubic testSet[] = { +{{67.426548091427676, 37.993772624988935}, {23.483695892376684, 90.476863174921306}, {35.597065061143162, 79.872482633158796}, {75.38634169631932, 18.244890038969412}}, +{{67.4265481, 37.9937726}, {23.4836959, 90.4768632}, {35.5970651, 79.8724826}, {75.3863417, 18.24489}}, + +{{0, 0}, {0, 1}, {1, 1}, {1, 0}}, +{{1, 0}, {0, 0}, {0, 1}, {1, 1}}, + {{0,1}, {4,5}, {1,0}, {5,3}}, {{0,1}, {3,5}, {1,0}, {5,4}}, @@ -90,9 +96,6 @@ static const Cubic testSet[] = { {{0,2}, {0,1}, {1,0}, {1,0}}, {{0,1}, {0,1}, {2,0}, {1,0}}, -{{0, 0}, {0, 1}, {1, 1}, {1, 0}}, -{{1, 0}, {0, 0}, {0, 1}, {1, 1}}, - {{0, 1}, {0, 2}, {1, 0}, {1, 0}}, {{0, 1}, {0, 1}, {1, 0}, {2, 0}}, @@ -375,7 +378,7 @@ static void oneOff(int outer, int inner) { } void CubicIntersection_OneOffTest() { - oneOff(12, 14); + oneOff(0, 1); } static void newOneOff(int outer, int inner) { @@ -732,7 +735,8 @@ void CubicIntersection_SelfTest() { {{12.81,7.27}, {7.22,6.98}, {12.49,8.97}, {11.42,6.18}}, }; size_t selfSetCount = sizeof(selfSet) / sizeof(selfSet[0]); - for (size_t index = 0; index < selfSetCount; ++index) { + size_t firstFail = 1; + for (size_t index = firstFail; index < selfSetCount; ++index) { const Cubic& cubic = selfSet[index]; #if ONE_OFF_DEBUG int idx2; diff --git a/experimental/Intersection/DataTypes.h b/experimental/Intersection/DataTypes.h index 7d749afc13..20dbef8751 100644 --- a/experimental/Intersection/DataTypes.h +++ b/experimental/Intersection/DataTypes.h @@ -12,8 +12,8 @@ #include "SkPoint.h" -#define FORCE_RELEASE 1 // set force release to 1 for multiple thread -- no debugging -#define ONE_OFF_DEBUG 0 +#define FORCE_RELEASE 0 // set force release to 1 for multiple thread -- no debugging +#define ONE_OFF_DEBUG 1 #define ONE_OFF_DEBUG_MATHEMATICA 0 // FIXME: move these into SkTypes.h diff --git a/experimental/Intersection/Intersection_Tests.cpp b/experimental/Intersection/Intersection_Tests.cpp index 2bff918d70..0754ecc27f 100644 --- a/experimental/Intersection/Intersection_Tests.cpp +++ b/experimental/Intersection/Intersection_Tests.cpp @@ -14,13 +14,13 @@ void parseSVG(); void Intersection_Tests() { int testsRun = 0; +#if 0 + CubicIntersection_OneOffTest(); + CubicIntersection_SelfTest(); QuadraticIntersection_IntersectionFinder(); QuadraticIntersection_OneOffTest(); CubicIntersection_IntersectionFinder(); - CubicIntersection_NewOneOffTest(); -#if 0 CubicUtilities_Test(); - CubicIntersection_SelfTest(); #endif SimplifyNew_Test(); CubicsToQuadratics_OneOffTest(); diff --git a/experimental/Intersection/SimplifyNew_Test.cpp b/experimental/Intersection/SimplifyNew_Test.cpp index de59cfd5e8..dc04cadc26 100644 --- a/experimental/Intersection/SimplifyNew_Test.cpp +++ b/experimental/Intersection/SimplifyNew_Test.cpp @@ -3536,7 +3536,6 @@ static void testCubic1() { testSimplifyx(path); } -#if 0 static void testQuadratic93() { SkPath path; path.moveTo(3, 0); @@ -3549,7 +3548,6 @@ static void testQuadratic93() { path.close(); testSimplifyx(path); } -#endif static void cubicOp1d() { SkPath path, pathB; @@ -4611,12 +4609,79 @@ static void cubicOp63d() { testShapeOp(path, pathB, kDifference_Op); } -static void (*firstTest)() = cubicOp63d; +static void testQuad1() { + SkPath path; + path.moveTo(0,0); + path.quadTo(0,0, 0,1); + path.lineTo(1,1); + path.close(); + path.moveTo(0,0); + path.quadTo(1,1, 0,2); + path.close(); + testSimplifyx(path); +} + +static void testQuad1z() { + SkPath path; + path.moveTo(0,0); + path.quadTo(0,0, 0,1); + path.lineTo(1,1); + path.close(); + path.moveTo(0,0); + path.lineTo(0.5f,1); + path.lineTo(0,2); + path.close(); + testSimplifyx(path); +} + +static void testQuad1c() { + SkPath path; + path.moveTo(0,0); + path.quadTo(0,0, 0,1); + path.lineTo(1,1); + path.close(); + path.moveTo(0,0); + path.cubicTo(0.5f,0.5f, 0.5f,1.5f, 0,2); + path.close(); + testSimplifyx(path); +} + +static void testRectOp1d() { + SkPath path, pathB; + path.moveTo(0,1); + path.cubicTo(0,1, 1,0, 3,0); + path.lineTo(0,1); + path.close(); + pathB.moveTo(0,1); + pathB.cubicTo(0,3, 1,0, 1,0); + pathB.lineTo(0,1); + pathB.close(); + testShapeOp(path, pathB, kDifference_Op); +} + +static void testCubicOp64d() { + SkPath path, pathB; + path.setFillType(SkPath::kWinding_FillType); + path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); + path.addRect(2, 2, 3, 3, SkPath::kCW_Direction); + pathB.setFillType(SkPath::kEvenOdd_FillType); + pathB.addRect(0, 0, 4, 4, SkPath::kCW_Direction); + pathB.addRect(0, 0, 3, 3, SkPath::kCW_Direction); + testShapeOp(path, pathB, kDifference_Op); +} + +static void (*firstTest)() = testRectOp1d; static struct { void (*fun)(); const char* str; } tests[] = { + TEST(testRectOp1d), + TEST(testCubicOp64d), + TEST(testQuad1c), + TEST(testQuad1z), + TEST(testQuad1), + TEST(testQuadratic93), // FIXME: gets stuck in a loop because top is unsortable TEST(cubicOp63d), TEST(cubicOp62d), TEST(cubicOp61d), @@ -4704,7 +4769,6 @@ static struct { TEST(cubicOp3d), TEST(cubicOp2d), TEST(cubicOp1d), - // TEST(testQuadratic93), // FIXME: gets stuck in a loop because top is unsortable TEST(testCubic1), TEST(testQuadralateral1), TEST(testLine85), @@ -5063,7 +5127,7 @@ static void (*firstSubTest)() = 0; static bool skipAll = false; static bool runSubTestsFirst = false; -static bool runReverse = true; +static bool runReverse = false; static void (*stopTest)() = 0; void SimplifyNew_Test() { diff --git a/experimental/Intersection/as.htm b/experimental/Intersection/as.htm index f5f6250ec1..063b92113d 100644 --- a/experimental/Intersection/as.htm +++ b/experimental/Intersection/as.htm @@ -3612,11 +3612,92 @@ markDoneBinary id=1 (1,3 5,6 5,3 5,4) t=0.666666667 [2] (4.85185194,3.96296287) path.cubicTo(4.97231197,3.77658033, 4.93595362,3.85783577, 4.85185194,3.96296287); </div> +<div id="testQuad1"> + RunTestSet [testQuad1] +{{0,0}, {0,0}, {0,1}}, +{{0,1}, {1,1}}, +{{1,1}, {0,0}}, +{{0,0}, {1,1}, {0,2}}, +{{0,2}, {0,0}}, +debugShowLineIntersection wtTs[0]=0 {{0,0}, {0,1}} {{0,1}} wnTs[0]=1 {{0,1}, {1,1}} +debugShowLineIntersection wtTs[0]=1 {{0,0}, {0,1}} {{0,0}} wnTs[0]=0 {{1,1}, {0,0}} +debugShowLineIntersection wtTs[0]=-0 {{0,1}, {1,1}} {{1,1}} wnTs[0]=1 {{1,1}, {0,0}} +debugShowQuadLineIntersection wtTs[0]=0 {{0,0}, {1,1}, {0,2}} {{0,0}} wnTs[0]=0 {{0,0}, {0,1}} +debugShowLineIntersection wtTs[0]=1 {{0,0}, {0,1}} {{0,0}} wtTs[1]=0.5 {{0,1}} wnTs[0]=-0 {{0,2}, {0,0}} wnTs[1]=1 +debugShowQuadLineIntersection wtTs[0]=0.5 {{0,0}, {1,1}, {0,2}} {{0.5,1}} wnTs[0]=0.5 {{0,1}, {1,1}} +debugShowLineIntersection wtTs[0]=0.5 {{0,1}, {1,1}} {{0,1}} wnTs[0]=0 {{0,2}, {0,0}} +debugShowQuadLineIntersection wtTs[0]=0 {{0,0}, {1,1}, {0,2}} {{0,0}} wnTs[0]=1 {{1,1}, {0,0}} +debugShowLineIntersection wtTs[0]=1 {{1,1}, {0,0}} {{0,0}} wnTs[0]=1 {{0,2}, {0,0}} +debugShowQuadLineIntersection wtTs[0]=0 {{0,0}, {1,1}, {0,2}} {{0,0}} wtTs[1]=1 {{0,2}} wnTs[0]=1 {{0,2}, {0,0}} wnTs[1]=0 +debugShowTs id=1 [o=3,4 t=0 0,0 w=1 o=0] [o=2 t=1 0,1 w=1 o=0] +debugShowTs id=5 [o=4 t=0 0,2 w=1 o=0] [o=2 t=0.5 0,1 w=1 o=0] [o=3,4 t=1 0,0 w=1 o=0] +addTPair addTPair this=5 0.5 other=1 1 +debugShowTs id=1 [o=3,4 t=0 0,0 w=1 o=0] [o=2,5 t=1 0,1 w=1 o=0] +debugShowTs id=5 [o=4 t=0 0,2 w=1 o=0] [o=2,1 t=0.5 0,1 w=1 o=0] [o=3,4 t=1 0,0 w=1 o=0] +debugShowTs id=1 [o=3,4 t=0 0,0 w=0 o=0] [o=2,5 t=1 0,1 w=1 o=0] done +debugShowTs id=5 [o=4 t=0 0,2 w=1 o=0] [o=2,1 t=0.5 0,1 w=0 o=0] [o=3,4 t=1 0,0 w=1 o=0] +debugShowActiveSpans id=2 (0,1 1,1) t=0 (0,1) tEnd=0.5 other=1 otherT=1 otherIndex=2 windSum=? windValue=1 oppValue=0 +debugShowActiveSpans id=2 (0,1 1,1) t=0 (0,1) tEnd=0.5 other=5 otherT=0.5 otherIndex=1 windSum=? windValue=1 oppValue=0 +debugShowActiveSpans id=2 (0,1 1,1) t=0.5 (0.5,1) tEnd=1 other=4 otherT=0.5 otherIndex=3 windSum=? windValue=1 oppValue=0 +debugShowActiveSpans id=3 (1,1 0,0) t=-0 (1,1) tEnd=1 other=2 otherT=1 otherIndex=3 windSum=? windValue=1 oppValue=0 +debugShowActiveSpans id=4 (0,0 1,1 0,2) t=0 (0,0) tEnd=0.5 other=1 otherT=0 otherIndex=1 windSum=? windValue=1 oppValue=0 +debugShowActiveSpans id=4 (0,0 1,1 0,2) t=0 (0,0) tEnd=0.5 other=3 otherT=1 otherIndex=2 windSum=? windValue=1 oppValue=0 +debugShowActiveSpans id=4 (0,0 1,1 0,2) t=0 (0,0) tEnd=0.5 other=5 otherT=1 otherIndex=4 windSum=? windValue=1 oppValue=0 +debugShowActiveSpans id=4 (0,0 1,1 0,2) t=0.5 (0.5,1) tEnd=1 other=2 otherT=0.5 otherIndex=2 windSum=? windValue=1 oppValue=0 +debugShowActiveSpans id=5 (0,2 0,0) t=0 (0,2) tEnd=0.5 other=4 otherT=1 otherIndex=4 windSum=? windValue=1 oppValue=0 +findTop debugShowSort contourWinding=0 oppContourWinding=0 sign=-1 +debugShowSort [0] {{0,0}, {1,1}, {0,2}} tStart=0 tEnd=0.5 sign=-1 windValue=1 windSum=? 0->1 (max=1) done=0 tiny=0 opp=0 +debugShowSort [1] {{1,1}, {0,0}} tStart=1 tEnd=-0 sign=1 windValue=1 windSum=? 1->0 (max=1) done=0 tiny=0 opp=0 +findTop swap=1 serpentine=0 controls_contained_by_ends=0 +markWinding id=4 (0,0 1,1 0,2) t=0 [0] (0,0) tEnd=0 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 +markWinding id=4 (0,0 1,1 0,2) t=0 [1] (0,0) tEnd=0 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 +markWinding id=4 (0,0 1,1 0,2) t=0 [2] (0,0) tEnd=0.5 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 +markWinding id=4 (0,0 1,1 0,2) t=0 [0] (0,0) tEnd=0 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 +markWinding id=4 (0,0 1,1 0,2) t=0 [1] (0,0) tEnd=0 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 +markWinding id=4 (0,0 1,1 0,2) t=0 [2] (0,0) tEnd=0.5 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 +findNextWinding debugShowSort contourWinding=0 oppContourWinding=0 sign=1 +debugShowSort [0] {{0,0}, {1,1}, {0,2}} tStart=0.5 tEnd=0 sign=1 windValue=1 windSum=-1 0->-1 (max=-1) done=0 tiny=0 opp=0 +debugShowSort [1] {{0,1}, {1,1}} tStart=0.5 tEnd=0 sign=1 windValue=1 windSum=? -1->-2 (max=-2) done=0 tiny=0 opp=0 +debugShowSort [2] {{0,0}, {1,1}, {0,2}} tStart=0.5 tEnd=1 sign=-1 windValue=1 windSum=? -2->-1 (max=-2) done=0 tiny=0 opp=0 +debugShowSort [3] {{0,1}, {1,1}} tStart=0.5 tEnd=1 sign=-1 windValue=1 windSum=? -1->0 (max=-1) done=0 tiny=0 opp=0 +findNextWinding firstIndex=[0] sign=1 +markDone id=2 (0,1 1,1) t=0 [0] (0,1) tEnd=0 newWindSum=-2 windSum=? windValue=1 +markDone id=2 (0,1 1,1) t=0 [1] (0,1) tEnd=0.5 newWindSum=-2 windSum=? windValue=1 +findNextWinding chase.append id=2 +markDone id=4 (0,0 1,1 0,2) t=0.5 [3] (0.5,1) tEnd=1 newWindSum=-2 windSum=? windValue=1 +markDone id=5 (0,2 0,0) t=0 [0] (0,2) tEnd=0.5 newWindSum=-2 windSum=? windValue=1 +findNextWinding chase.append id=5 +markWinding id=2 (0,1 1,1) t=0.5 [2] (0.5,1) tEnd=1 newWindSum=-1 windSum=? windValue=1 +markWinding id=3 (1,1 0,0) t=-0 [0] (1,1) tEnd=1 newWindSum=-1 windSum=? windValue=1 +findNextWinding chase.append id=3 +markDoneUnary id=4 (0,0 1,1 0,2) t=0 [0] (0,0) tEnd=0 newWindSum=-1 windSum=-1 windValue=1 +markDoneUnary id=4 (0,0 1,1 0,2) t=0 [1] (0,0) tEnd=0 newWindSum=-1 windSum=-1 windValue=1 +markDoneUnary id=4 (0,0 1,1 0,2) t=0 [2] (0,0) tEnd=0.5 newWindSum=-1 windSum=-1 windValue=1 +findNextWinding from:[4] to:[2] start=2 end=3 +bridgeWinding current id=4 from=(0,0) to=(0.5,1) +path.moveTo(0,0); +path.quadTo(0.5,0.5, 0.5,1); +findNextWinding simple +markDoneUnary id=2 (0,1 1,1) t=0.5 [2] (0.5,1) tEnd=1 newWindSum=-1 windSum=-1 windValue=1 +bridgeWinding current id=2 from=(0.5,1) to=(1,1) +findNextWinding debugShowSort contourWinding=0 oppContourWinding=? sign=1 +debugShowSort [1] {{1,1}, {0,0}} tStart=1 tEnd=-0 sign=1 windValue=1 windSum=-1 0->-1 (max=-1) done=0 tiny=0 opp=0 +debugShowSort [0] {{0,0}, {1,1}, {0,2}} tStart=0 tEnd=0.5 sign=-1 windValue=1 windSum=-1 -1->0 (max=-1) done=1 tiny=0 opp=0 +findNextWinding firstIndex=[1] sign=1 +markDoneUnary id=3 (1,1 0,0) t=-0 [0] (1,1) tEnd=1 newWindSum=-1 windSum=-1 windValue=1 +findNextWinding from:[3] to:[4] start=1 end=3 +bridgeWinding current id=3 from=(1,1) to=(0,0) +path.lineTo(1,1); +path.lineTo(0,0); +path.close(); +</div> + </div> <script type="text/javascript"> var testDivs = [ + testQuad1, cubicOp62d, cubicOp61d, cubicOp58da, @@ -3825,8 +3906,17 @@ var MARK_DONE_CUBIC = MARK_DONE_QUAD + 1; var MARK_UNSORTABLE_LINE = MARK_DONE_CUBIC + 1; var MARK_UNSORTABLE_QUAD = MARK_UNSORTABLE_LINE + 1; var MARK_UNSORTABLE_CUBIC = MARK_UNSORTABLE_QUAD + 1; - -var COMPUTED_SET_1 = MARK_UNSORTABLE_CUBIC + 1; +var MARK_SIMPLE_LINE = MARK_UNSORTABLE_CUBIC + 1; +var MARK_SIMPLE_QUAD = MARK_SIMPLE_LINE + 1; +var MARK_SIMPLE_CUBIC = MARK_SIMPLE_QUAD + 1; +var MARK_SIMPLE_DONE_LINE = MARK_SIMPLE_CUBIC + 1; +var MARK_SIMPLE_DONE_QUAD = MARK_SIMPLE_DONE_LINE + 1; +var MARK_SIMPLE_DONE_CUBIC = MARK_SIMPLE_DONE_QUAD + 1; +var MARK_DONE_UNARY_LINE = MARK_SIMPLE_DONE_CUBIC + 1; +var MARK_DONE_UNARY_QUAD = MARK_DONE_UNARY_LINE + 1; +var MARK_DONE_UNARY_CUBIC = MARK_DONE_UNARY_QUAD + 1; + +var COMPUTED_SET_1 = MARK_DONE_UNARY_CUBIC + 1; var COMPUTED_SET_2 = COMPUTED_SET_1 + 1; var FRAG_TYPE_LAST = COMPUTED_SET_2; @@ -3839,7 +3929,8 @@ var REC_TYPE_SORT = 4; var REC_TYPE_OP = 5; var REC_TYPE_MARK = 6; var REC_TYPE_COMPUTED = 7; -var REC_TYPE_LAST = REC_TYPE_COMPUTED; +var REC_TYPE_COIN = 8; +var REC_TYPE_LAST = REC_TYPE_COIN; function strs_to_nums(strs) { var result = []; @@ -3919,6 +4010,7 @@ function parse_all(test) { } var type = line.lastIndexOf("debugShowSort", 0) === 0 ? REC_TYPE_SORT : line.lastIndexOf("debugShowActiveSpans", 0) === 0 ? REC_TYPE_ACTIVE + : line.lastIndexOf("debugShowTs", 0) === 0 ? REC_TYPE_COIN : line.lastIndexOf("debugShow", 0) === 0 ? REC_TYPE_SECT : line.lastIndexOf("computed", 0) === 0 ? REC_TYPE_COMPUTED : line.lastIndexOf("path.", 0) === 0 ? REC_TYPE_ADD @@ -3976,6 +4068,9 @@ function parse_all(test) { found = match_regexp(line, lineNo, record, ADD_CLOSE, "path.close();"); } break; + case REC_TYPE_COIN: + found = true; + break; case REC_TYPE_COMPUTED: found = line == "computed quadratics given" || match_regexp(line, lineNo, record, COMPUTED_SET_1, "computed quadratics set 1" @@ -4073,6 +4168,24 @@ function parse_all(test) { " id=IDX QUAD_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX" ) || match_regexp(line, lineNo, record, MARK_UNSORTABLE_CUBIC, "markUnsortable" + " id=IDX CUBIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX" + ) || match_regexp(line, lineNo, record, MARK_SIMPLE_LINE, "markWinding" + +" id=IDX LINE_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX" + ) || match_regexp(line, lineNo, record, MARK_SIMPLE_QUAD, "markWinding" + +" id=IDX QUAD_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX" + ) || match_regexp(line, lineNo, record, MARK_SIMPLE_CUBIC, "markWinding" + +" id=IDX CUBIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX" + ) || match_regexp(line, lineNo, record, MARK_SIMPLE_DONE_LINE, "markDone" + +" id=IDX LINE_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX" + ) || match_regexp(line, lineNo, record, MARK_SIMPLE_DONE_QUAD, "markDone" + +" id=IDX QUAD_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX" + ) || match_regexp(line, lineNo, record, MARK_SIMPLE_DONE_CUBIC, "markDone" + +" id=IDX CUBIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX" + ) || match_regexp(line, lineNo, record, MARK_DONE_UNARY_LINE, "markDoneUnary" + +" id=IDX LINE_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX" + ) || match_regexp(line, lineNo, record, MARK_DONE_UNARY_QUAD, "markDoneUnary" + +" id=IDX QUAD_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX" + ) || match_regexp(line, lineNo, record, MARK_DONE_UNARY_CUBIC, "markDoneUnary" + +" id=IDX CUBIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX" ); break; case REC_TYPE_OP: @@ -5499,18 +5612,27 @@ function draw(test, lines, title) { case MARK_LINE: case MARK_DONE_LINE: case MARK_UNSORTABLE_LINE: + case MARK_SIMPLE_LINE: + case MARK_SIMPLE_DONE_LINE: + case MARK_DONE_UNARY_LINE: drawLinePartial(frags[1], frags[2], frags[3], frags[4], frags[5], frags[9]); break; case MARK_QUAD: case MARK_DONE_QUAD: case MARK_UNSORTABLE_QUAD: + case MARK_SIMPLE_QUAD: + case MARK_SIMPLE_DONE_QUAD: + case MARK_DONE_UNARY_QUAD: drawQuadPartial(frags[1], frags[2], frags[3], frags[4], frags[5], frags[6], frags[7], frags[11]); break; case MARK_CUBIC: case MARK_DONE_CUBIC: case MARK_UNSORTABLE_CUBIC: + case MARK_SIMPLE_CUBIC: + case MARK_SIMPLE_DONE_CUBIC: + case MARK_DONE_UNARY_CUBIC: drawCubicPartial(frags[1], frags[2], frags[3], frags[4], frags[5], frags[6], frags[7], frags[8], frags[9], frags[13]); break; diff --git a/experimental/Intersection/op.htm b/experimental/Intersection/op.htm index 75dd92e6a9..4c67e0a420 100644 --- a/experimental/Intersection/op.htm +++ b/experimental/Intersection/op.htm @@ -382,6 +382,11 @@ path.close(); path.close(); </div> +<div id="testLine16"> + path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); + path.addRect(0, 4, 9, 9, SkPath::kCW_Direction); +</div> + <div id="testLine17"> SkPath path, simple; path.addRect(0, 0, 12, 12, SkPath::kCW_Direction); @@ -4078,6 +4083,7 @@ path.addRect(4, 13, 13, 16, SkPath::kCCW_Direction); <script type="text/javascript"> var testDivs = [ + testLine16, cubicOp63d, cubicOp62d, cubicOp61d, @@ -4366,6 +4372,7 @@ var testDivs = [ testLine22, testLine19, testLine17, + testLine16, testLine13, testLine12, testLine9, diff --git a/experimental/Intersection/qc.htm b/experimental/Intersection/qc.htm index 22b0635c57..bae06b76a1 100644 --- a/experimental/Intersection/qc.htm +++ b/experimental/Intersection/qc.htm @@ -2142,11 +2142,86 @@ quad=(1.20573276,0.813456177 1.2679289,0.830085346 1.33333333,0.851851852) </div> +<div id="line0"> + {{2, 1}, {2, 1}}, +</div> + +<div id="line1"> + {{2, 1}, {1, 1}}, +</div> + +<div id="line2"> + {{2, 1}, {2, 2}} +</div> + +<div id="line3"> + {{1, 1}, {2, 2}}, +</div> + +<div id="line4"> + {{3, 0}, {2, 1}}, +</div> + +<div id="line5"> + {{3, 2}, {1, 1}}, +</div> + +<div id="tri0"> + {{2, 0}, {3, 1}}, + {{3, 1}, {2, 2}}, + {{2, 2}, {2, 0}}, +</div> +<div id="tri1"> + {{3, 1}, {2, 2}}, + {{2, 2}, {1, 1}}, + {{1, 1}, {3, 1}}, +</div> +<div id="tri2"> + {{3, 0}, {2, 1}}, + {{2, 1}, {3, 2}}, + {{3, 2}, {3, 0}}, +</div> +<div id="testQuad0"> + {{1, 1}, {2, 1}, {0, 2}}, +</div> +<div id="testQuad1"> + {{0, 0}, {1, 1}, {3, 1}}, +</div> +<div id="testQuad2"> + {{2, 0}, {1, 1}, {2, 2}}, +</div> +<div id="testQuad3"> + {{4, 0}, {0, 1}, {4, 2}}, +</div> +<div id="testQuad4"> + {{0, 0}, {0, 1}, {1, 1}}, +</div> + +<div id="cubicOp65d"> +{{0,1}, {1,5}, {1,0}, {1,0}}, +{{0,1}, {0,1}, {1,0}, {5,1}}, +</div> + </div> <script type="text/javascript"> var testDivs = [ + cubicOp65d, + testQuad0, + testQuad1, + testQuad2, + testQuad3, + testQuad4, + tri0, + tri1, + tri2, + line0, + line1, + line2, + line3, + line4, + line5, cubicOp35da, cubicOp35d, quadOp34d, @@ -2596,6 +2671,9 @@ function draw(test, title, scale) { break; } ctx.strokeStyle = drawQuads && drawCubics && curve.length == 6 ? "red" : "black"; + if (curve.length == 4) { + ctx.strokeStyle = "blue"; + } ctx.stroke(); if (drawControlLines && (curve.length == 6 || curve.length == 8)) { ctx.strokeStyle = "rgba(0,0,0, 0.3)"; |