OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #include "PathOpsCubicIntersectionTestData.h" | 7 #include "PathOpsCubicIntersectionTestData.h" |
8 #include "PathOpsTestCommon.h" | 8 #include "PathOpsTestCommon.h" |
9 #include "SkGeometry.h" | 9 #include "SkGeometry.h" |
10 #include "SkIntersections.h" | 10 #include "SkIntersections.h" |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 SkIntersections intersections; | 397 SkIntersections intersections; |
398 intersections.intersect(cubic1, cubic2); | 398 intersections.intersect(cubic1, cubic2); |
399 #if DEBUG_T_SECT_DUMP == 3 | 399 #if DEBUG_T_SECT_DUMP == 3 |
400 SkDebugf("</div>\n\n"); | 400 SkDebugf("</div>\n\n"); |
401 SkDebugf("<script type=\"text/javascript\">\n\n"); | 401 SkDebugf("<script type=\"text/javascript\">\n\n"); |
402 SkDebugf("var testDivs = [\n"); | 402 SkDebugf("var testDivs = [\n"); |
403 for (int index = 1; index <= gDumpTSectNum; ++index) { | 403 for (int index = 1; index <= gDumpTSectNum; ++index) { |
404 SkDebugf("sect%d,\n", index); | 404 SkDebugf("sect%d,\n", index); |
405 } | 405 } |
406 #endif | 406 #endif |
407 if (coin && intersections.used() != 2) { | 407 if (coin && intersections.used() < 2) { |
408 SkDebugf(""); | 408 SkDebugf(""); |
409 } | 409 } |
410 REPORTER_ASSERT(reporter, !coin || intersections.used() == 2); | 410 REPORTER_ASSERT(reporter, !coin || intersections.used() >= 2); |
411 double tt1, tt2; | 411 double tt1, tt2; |
412 SkDPoint xy1, xy2; | 412 SkDPoint xy1, xy2; |
413 for (int pt3 = 0; pt3 < intersections.used(); ++pt3) { | 413 for (int pt3 = 0; pt3 < intersections.used(); ++pt3) { |
414 tt1 = intersections[0][pt3]; | 414 tt1 = intersections[0][pt3]; |
415 xy1 = cubic1.ptAtT(tt1); | 415 xy1 = cubic1.ptAtT(tt1); |
416 tt2 = intersections[1][pt3]; | 416 tt2 = intersections[1][pt3]; |
417 xy2 = cubic2.ptAtT(tt2); | 417 xy2 = cubic2.ptAtT(tt2); |
418 const SkDPoint& iPt = intersections.pt(pt3); | 418 const SkDPoint& iPt = intersections.pt(pt3); |
419 #if ONE_OFF_DEBUG | 419 #if ONE_OFF_DEBUG |
420 SkDebugf("%s t1=%1.9g (%1.9g, %1.9g) (%1.9g, %1.9g) (%1.9g, %1.9g) t2=%1
.9g\n", | 420 SkDebugf("%s t1=%1.9g (%1.9g, %1.9g) (%1.9g, %1.9g) (%1.9g, %1.9g) t2=%1
.9g\n", |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 } | 713 } |
714 | 714 |
715 DEF_TEST(PathOpsCubicIntersection, reporter) { | 715 DEF_TEST(PathOpsCubicIntersection, reporter) { |
716 oneOffTests(reporter); | 716 oneOffTests(reporter); |
717 cubicIntersectionSelfTest(reporter); | 717 cubicIntersectionSelfTest(reporter); |
718 cubicIntersectionCoinTest(reporter); | 718 cubicIntersectionCoinTest(reporter); |
719 standardTestCases(reporter); | 719 standardTestCases(reporter); |
720 if (false) CubicIntersection_IntersectionFinder(); | 720 if (false) CubicIntersection_IntersectionFinder(); |
721 if (false) CubicIntersection_RandTest(reporter); | 721 if (false) CubicIntersection_RandTest(reporter); |
722 } | 722 } |
OLD | NEW |