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 "PathOpsExtendedTest.h" | 7 #include "PathOpsExtendedTest.h" |
8 #include "PathOpsTestCommon.h" | 8 #include "PathOpsTestCommon.h" |
9 | 9 |
10 #define TEST(name) { name, #name } | 10 #define TEST(name) { name, #name } |
(...skipping 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1712 path.quadTo(704.000000f, 11.2010098f, 704.000000f, 17.0000000f); | 1712 path.quadTo(704.000000f, 11.2010098f, 704.000000f, 17.0000000f); |
1713 path.lineTo(704.000000f, 33.0000000f); | 1713 path.lineTo(704.000000f, 33.0000000f); |
1714 path.lineTo(705.000000f, 33.0000000f); | 1714 path.lineTo(705.000000f, 33.0000000f); |
1715 path.lineTo(705.000000f, 17.0000000f); | 1715 path.lineTo(705.000000f, 17.0000000f); |
1716 path.cubicTo(705.000000f, 13.4101496f, 706.455078f, 10.1601505f, 708.807617f
, 7.80761385f); | 1716 path.cubicTo(705.000000f, 13.4101496f, 706.455078f, 10.1601505f, 708.807617f
, 7.80761385f); |
1717 path.lineTo(708.099182f, 7.09919119f); | 1717 path.lineTo(708.099182f, 7.09919119f); |
1718 path.close(); | 1718 path.close(); |
1719 SkPath pathB; | 1719 SkPath pathB; |
1720 pathB.setFillType(SkPath::kWinding_FillType); | 1720 pathB.setFillType(SkPath::kWinding_FillType); |
1721 pathB.moveTo(704.000000f, 3.00000000f); | 1721 pathB.moveTo(704.000000f, 3.00000000f); |
1722 #if 0 | |
1723 pathB.lineTo(719.500000f, 3.00000000f); | |
1724 pathB.lineTo(705.000000f, 33.0000000f); | |
1725 pathB.lineTo(704.000000f, 33.0000000f); | |
1726 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); | |
1727 #else | |
1728 pathB.lineTo(704.000000f, 33.0000000f); | 1722 pathB.lineTo(704.000000f, 33.0000000f); |
1729 pathB.lineTo(705.000000f, 33.0000000f); | 1723 pathB.lineTo(705.000000f, 33.0000000f); |
1730 pathB.lineTo(719.500000f, 3.00000000f); | 1724 pathB.lineTo(719.500000f, 3.00000000f); |
1731 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); | 1725 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
1732 #endif | |
1733 } | 1726 } |
1734 | 1727 |
1735 static void skpahrefs_com88(skiatest::Reporter* reporter, const char* filename)
{ | 1728 static void skpahrefs_com88(skiatest::Reporter* reporter, const char* filename)
{ |
1736 SkPath path; | 1729 SkPath path; |
1737 path.setFillType(SkPath::kEvenOdd_FillType); | 1730 path.setFillType(SkPath::kEvenOdd_FillType); |
1738 path.moveTo(1099.82886f, 7.17117119f); | 1731 path.moveTo(1099.82886f, 7.17117119f); |
1739 path.lineTo(1099.12134f, 7.87867832f); | 1732 path.lineTo(1099.12134f, 7.87867832f); |
1740 path.cubicTo(1099.66418f, 8.42157173f, 1100.00000f, 9.17157173f, 1100.00000f
, 10.0000000f); | 1733 path.cubicTo(1099.66418f, 8.42157173f, 1100.00000f, 9.17157173f, 1100.00000f
, 10.0000000f); |
1741 path.lineTo(1100.00000f, 28.0000000f); | 1734 path.lineTo(1100.00000f, 28.0000000f); |
1742 path.cubicTo(1100.00000f, 29.6568546f, 1098.65686f, 31.0000000f, 1097.00000f
, 31.0000000f); | 1735 path.cubicTo(1100.00000f, 29.6568546f, 1098.65686f, 31.0000000f, 1097.00000f
, 31.0000000f); |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2726 pathB.lineTo(194, 1041); | 2719 pathB.lineTo(194, 1041); |
2727 pathB.cubicTo(123.85984f, 1041, 67, 983.692444f, 67, 913); | 2720 pathB.cubicTo(123.85984f, 1041, 67, 983.692444f, 67, 913); |
2728 pathB.cubicTo(67, 842.307556f, 123.85984f, 785, 194, 785); | 2721 pathB.cubicTo(67, 842.307556f, 123.85984f, 785, 194, 785); |
2729 pathB.lineTo(195, 785); | 2722 pathB.lineTo(195, 785); |
2730 pathB.close(); | 2723 pathB.close(); |
2731 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); | 2724 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
2732 } | 2725 } |
2733 | 2726 |
2734 // this fails because cubic/quad misses an intersection (failure is isolated in
c/q int test) | 2727 // this fails because cubic/quad misses an intersection (failure is isolated in
c/q int test) |
2735 static void skpcarrot_is24(skiatest::Reporter* reporter, const char* filename) { | 2728 static void skpcarrot_is24(skiatest::Reporter* reporter, const char* filename) { |
2736 if (!FLAGS_runFail) { | |
2737 return; | |
2738 } | |
2739 SkPath path; | 2729 SkPath path; |
2740 path.setFillType(SkPath::kEvenOdd_FillType); | 2730 path.setFillType(SkPath::kEvenOdd_FillType); |
2741 path.moveTo(945, 597); | 2731 path.moveTo(945, 597); |
2742 path.quadTo(913.93396f, 597, 891.96698f, 618.96698f); | 2732 path.quadTo(913.93396f, 597, 891.96698f, 618.96698f); |
2743 path.quadTo(870, 640.93396f, 870, 672); | 2733 path.quadTo(870, 640.93396f, 870, 672); |
2744 path.quadTo(870, 703.06604f, 891.96698f, 725.03302f); | 2734 path.quadTo(870, 703.06604f, 891.96698f, 725.03302f); |
2745 path.quadTo(913.93396f, 747, 945, 747); | 2735 path.quadTo(913.93396f, 747, 945, 747); |
2746 path.quadTo(976.06604f, 747, 998.03302f, 725.03302f); | 2736 path.quadTo(976.06604f, 747, 998.03302f, 725.03302f); |
2747 path.quadTo(1020, 703.06604f, 1020, 672); | 2737 path.quadTo(1020, 703.06604f, 1020, 672); |
2748 path.quadTo(1020, 640.93396f, 998.03302f, 618.96698f); | 2738 path.quadTo(1020, 640.93396f, 998.03302f, 618.96698f); |
2749 path.quadTo(976.06604f, 597, 945, 597); | 2739 path.quadTo(976.06604f, 597, 945, 597); |
2750 path.close(); | 2740 path.close(); |
2751 SkPath pathB; | 2741 SkPath pathB; |
2752 pathB.setFillType(SkPath::kWinding_FillType); | 2742 pathB.setFillType(SkPath::kWinding_FillType); |
2753 pathB.moveTo(945.080994f, 597.161987f); | 2743 pathB.moveTo(945.080994f, 597.161987f); |
2754 pathB.cubicTo(903.659973f, 597.161987f, 870.080994f, 630.73999f, 870.080994f
, 672.161987f); | 2744 pathB.cubicTo(903.659973f, 597.161987f, 870.080994f, 630.73999f, 870.080994f
, 672.161987f); |
2755 pathB.cubicTo(870.080994f, 676.096008f, 870.387024f, 679.957031f, 870.971008
f, 683.726013f); | 2745 pathB.cubicTo(870.080994f, 676.096008f, 870.387024f, 679.957031f, 870.971008
f, 683.726013f); |
2756 pathB.cubicTo(876.53302f, 719.656006f, 907.593994f, 747.161987f, 945.080994f
, 747.161987f); | 2746 pathB.cubicTo(876.53302f, 719.656006f, 907.593994f, 747.161987f, 945.080994f
, 747.161987f); |
2757 pathB.cubicTo(982.567993f, 747.161987f, 1013.62903f, 719.656006f, 1019.19104
f, 683.726013f); | 2747 pathB.cubicTo(982.567993f, 747.161987f, 1013.62903f, 719.656006f, 1019.19104
f, 683.726013f); |
2758 pathB.cubicTo(1019.77502f, 679.955017f, 1020.08099f, 676.094971f, 1020.08099
f, 672.161987f); | 2748 pathB.cubicTo(1019.77502f, 679.955017f, 1020.08099f, 676.094971f, 1020.08099
f, 672.161987f); |
2759 pathB.cubicTo(1020.08002f, 630.73999f, 986.502014f, 597.161987f, 945.080994f
, 597.161987f); | 2749 pathB.cubicTo(1020.08002f, 630.73999f, 986.502014f, 597.161987f, 945.080994f
, 597.161987f); |
2760 pathB.close(); | 2750 pathB.close(); |
2761 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); | 2751 testPathOpCheck(reporter, path, pathB, kIntersect_PathOp, filename, FLAGS_ru
nFail); |
2762 } | 2752 } |
2763 | 2753 |
2764 static void skpbangalorenest_com4(skiatest::Reporter* reporter, const char* file
name) { | 2754 static void skpbangalorenest_com4(skiatest::Reporter* reporter, const char* file
name) { |
2765 SkPath path; | 2755 SkPath path; |
2766 path.setFillType(SkPath::kEvenOdd_FillType); | 2756 path.setFillType(SkPath::kEvenOdd_FillType); |
2767 path.moveTo(0, 926); | 2757 path.moveTo(0, 926); |
2768 path.lineTo(0, 0); | 2758 path.lineTo(0, 0); |
2769 path.lineTo(1265, 0); | 2759 path.lineTo(1265, 0); |
2770 path.lineTo(1265, 926); | 2760 path.lineTo(1265, 926); |
2771 path.lineTo(0, 926); | 2761 path.lineTo(0, 926); |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3276 path.moveTo(2,4); | 3266 path.moveTo(2,4); |
3277 path.cubicTo(3,5, 2.33333325f,4.33333349f, 3.83333325f,3.83333349f); | 3267 path.cubicTo(3,5, 2.33333325f,4.33333349f, 3.83333325f,3.83333349f); |
3278 path.close(); | 3268 path.close(); |
3279 pathB.moveTo(3,5); | 3269 pathB.moveTo(3,5); |
3280 pathB.cubicTo(2.33333325f,4.33333349f, 3.83333325f,3.83333349f, 2,4); | 3270 pathB.cubicTo(2.33333325f,4.33333349f, 3.83333325f,3.83333349f, 2,4); |
3281 pathB.close(); | 3271 pathB.close(); |
3282 testPathOp(reporter, path, pathB, kDifference_PathOp, filename); | 3272 testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
3283 } | 3273 } |
3284 | 3274 |
3285 static void cubicOp114(skiatest::Reporter* reporter, const char* filename) { | 3275 static void cubicOp114(skiatest::Reporter* reporter, const char* filename) { |
3286 if (!FLAGS_runFail) { | |
3287 return; | |
3288 } | |
3289 SkPath path, pathB; | 3276 SkPath path, pathB; |
3290 path.setFillType(SkPath::kWinding_FillType); | 3277 path.setFillType(SkPath::kWinding_FillType); |
3291 path.moveTo(0, 1); | 3278 path.moveTo(0, 1); |
3292 path.cubicTo(1, 3, -1, 2, 3.5f, 1.33333337f); | 3279 path.cubicTo(1, 3, -1, 2, 3.5f, 1.33333337f); |
3293 path.close(); | 3280 path.close(); |
3294 pathB.setFillType(SkPath::kWinding_FillType); | 3281 pathB.setFillType(SkPath::kWinding_FillType); |
3295 pathB.moveTo(1, 3); | 3282 pathB.moveTo(1, 3); |
3296 pathB.cubicTo(-1, 2, 3.5f, 1.33333337f, 0, 1); | 3283 pathB.cubicTo(-1, 2, 3.5f, 1.33333337f, 0, 1); |
3297 pathB.close(); | 3284 pathB.close(); |
3298 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); | 3285 testPathOpCheck(reporter, path, pathB, kIntersect_PathOp, filename, FLAGS_ru
nFail); |
3299 } | 3286 } |
3300 | 3287 |
3301 static void cubicOp114asQuad(skiatest::Reporter* reporter, const char* filename)
{ | 3288 static void cubicOp114asQuad(skiatest::Reporter* reporter, const char* filename)
{ |
3302 SkPath path, pathB; | 3289 SkPath path, pathB; |
3303 path.setFillType(SkPath::kWinding_FillType); | 3290 path.setFillType(SkPath::kWinding_FillType); |
3304 path.moveTo(0, 1); | 3291 path.moveTo(0, 1); |
3305 path.cubicTo(1, 3, -1, 2, 3.5f, 1.33333337f); | 3292 path.cubicTo(1, 3, -1, 2, 3.5f, 1.33333337f); |
3306 path.close(); | 3293 path.close(); |
3307 pathB.setFillType(SkPath::kWinding_FillType); | 3294 pathB.setFillType(SkPath::kWinding_FillType); |
3308 pathB.moveTo(1, 3); | 3295 pathB.moveTo(1, 3); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3454 path.setFillType(SkPath::kEvenOdd_FillType); | 3441 path.setFillType(SkPath::kEvenOdd_FillType); |
3455 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); | 3442 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
3456 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction); | 3443 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction); |
3457 pathB.setFillType(SkPath::kWinding_FillType); | 3444 pathB.setFillType(SkPath::kWinding_FillType); |
3458 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction); | 3445 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction); |
3459 pathB.addRect(0, 0, 3, 3, SkPath::kCW_Direction); | 3446 pathB.addRect(0, 0, 3, 3, SkPath::kCW_Direction); |
3460 testPathOp(reporter, path, pathB, kDifference_PathOp, filename); | 3447 testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
3461 } | 3448 } |
3462 | 3449 |
3463 static void issue2753(skiatest::Reporter* reporter, const char* filename) { | 3450 static void issue2753(skiatest::Reporter* reporter, const char* filename) { |
3464 if (!FLAGS_runFail) { | |
3465 return; | |
3466 } | |
3467 SkPath path1; | 3451 SkPath path1; |
3468 path1.moveTo(142.701f, 110.568f); | 3452 path1.moveTo(142.701f, 110.568f); |
3469 path1.lineTo(142.957f, 100); | 3453 path1.lineTo(142.957f, 100); |
3470 path1.lineTo(153.835f, 100); | 3454 path1.lineTo(153.835f, 100); |
3471 path1.lineTo(154.592f, 108.188f); | 3455 path1.lineTo(154.592f, 108.188f); |
3472 path1.cubicTo(154.592f, 108.188f, 153.173f, 108.483f, 152.83f, 109.412f); | 3456 path1.cubicTo(154.592f, 108.188f, 153.173f, 108.483f, 152.83f, 109.412f); |
3473 path1.cubicTo(152.83f, 109.412f, 142.701f, 110.568f, 142.701f, 110.568f); | 3457 path1.cubicTo(152.83f, 109.412f, 142.701f, 110.568f, 142.701f, 110.568f); |
3474 path1.close(); | 3458 path1.close(); |
3475 | 3459 |
3476 SkPath path2; | 3460 SkPath path2; |
3477 path2.moveTo(39, 124.001f); | 3461 path2.moveTo(39, 124.001f); |
3478 path2.cubicTo(39, 124.001f, 50.6f, 117.001f, 50.6f, 117.001f); | 3462 path2.cubicTo(39, 124.001f, 50.6f, 117.001f, 50.6f, 117.001f); |
3479 path2.cubicTo(50.6f, 117.001f, 164.601f, 85.2f, 188.201f, 117.601f); | 3463 path2.cubicTo(50.6f, 117.001f, 164.601f, 85.2f, 188.201f, 117.601f); |
3480 path2.cubicTo(188.201f, 117.601f, 174.801f, 93, 39, 124.001f); | 3464 path2.cubicTo(188.201f, 117.601f, 174.801f, 93, 39, 124.001f); |
3481 path2.close(); | 3465 path2.close(); |
3482 | 3466 |
3483 testPathOp(reporter, path1, path2, kUnion_PathOp, filename); | 3467 testPathOpCheck(reporter, path1, path2, kUnion_PathOp, filename, FLAGS_runFa
il); |
3484 } | 3468 } |
3485 | 3469 |
3486 static void issue2808(skiatest::Reporter* reporter, const char* filename) { | 3470 static void issue2808(skiatest::Reporter* reporter, const char* filename) { |
3487 SkPath path1, path2; | 3471 SkPath path1, path2; |
3488 | 3472 |
3489 path1.moveTo(509.20300293f, 385.601989746f); | 3473 path1.moveTo(509.20300293f, 385.601989746f); |
3490 path1.quadTo(509.20300293f, 415.68838501f, 487.928710938f, 436.96270752f
); | 3474 path1.quadTo(509.20300293f, 415.68838501f, 487.928710938f, 436.96270752f
); |
3491 path1.quadTo(466.654388428f, 458.236999512f, 436.567993164f, 458.2369995
12f); | 3475 path1.quadTo(466.654388428f, 458.236999512f, 436.567993164f, 458.2369995
12f); |
3492 path1.quadTo(406.4815979f, 458.236999512f, 385.207275391f, 436.96270752f
); | 3476 path1.quadTo(406.4815979f, 458.236999512f, 385.207275391f, 436.96270752f
); |
3493 path1.quadTo(363.932983398f, 415.68838501f, 363.932983398f, 385.60198974
6f); | 3477 path1.quadTo(363.932983398f, 415.68838501f, 363.932983398f, 385.60198974
6f); |
(...skipping 10 matching lines...) Expand all Loading... |
3504 path2.quadTo(400, 301.028259277f, 400, 290.87298584f); | 3488 path2.quadTo(400, 301.028259277f, 400, 290.87298584f); |
3505 path2.quadTo(400, 280.717712402f, 407.180847168f, 273.536865234f); | 3489 path2.quadTo(400, 280.717712402f, 407.180847168f, 273.536865234f); |
3506 path2.quadTo(414.361724854f, 266.355987549f, 424.516998291f, 266.3559875
49f); | 3490 path2.quadTo(414.361724854f, 266.355987549f, 424.516998291f, 266.3559875
49f); |
3507 path2.quadTo(434.672271729f, 266.355987549f, 441.853149414f, 273.5368652
34f); | 3491 path2.quadTo(434.672271729f, 266.355987549f, 441.853149414f, 273.5368652
34f); |
3508 path2.quadTo(449.033996582f, 280.717712402f, 449.033996582f, 290.8729858
4f); | 3492 path2.quadTo(449.033996582f, 280.717712402f, 449.033996582f, 290.8729858
4f); |
3509 path2.close(); | 3493 path2.close(); |
3510 | 3494 |
3511 testPathOp(reporter, path1, path2, kUnion_PathOp, filename); | 3495 testPathOp(reporter, path1, path2, kUnion_PathOp, filename); |
3512 } | 3496 } |
3513 | 3497 |
| 3498 static void cubicOp115(skiatest::Reporter* reporter, const char* filename) { |
| 3499 SkPath path, pathB; |
| 3500 path.setFillType(SkPath::kWinding_FillType); |
| 3501 path.moveTo(0,1); |
| 3502 path.cubicTo(3,4, 2,1, 5,3); |
| 3503 path.close(); |
| 3504 pathB.setFillType(SkPath::kWinding_FillType); |
| 3505 pathB.moveTo(1,2); |
| 3506 pathB.cubicTo(3,5, 1,0, 4,3); |
| 3507 pathB.close(); |
| 3508 SkPath path2(path); |
| 3509 testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
| 3510 } |
| 3511 |
3514 static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0; | 3512 static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0; |
3515 static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0; | 3513 static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0; |
3516 | 3514 |
3517 static struct TestDesc tests[] = { | 3515 static struct TestDesc tests[] = { |
| 3516 TEST(cubicOp115), |
3518 TEST(issue2753), // FIXME: pair of cubics miss intersection | 3517 TEST(issue2753), // FIXME: pair of cubics miss intersection |
3519 TEST(cubicOp114), // FIXME: curve with inflection is ordered the wrong way | 3518 TEST(cubicOp114), // FIXME: curve with inflection is ordered the wrong way |
3520 TEST(issue2808), | 3519 TEST(issue2808), |
3521 TEST(cubicOp114asQuad), | 3520 TEST(cubicOp114asQuad), |
3522 TEST(rects4), | 3521 TEST(rects4), |
3523 TEST(rects3), | 3522 TEST(rects3), |
3524 TEST(rects2), | 3523 TEST(rects2), |
3525 TEST(rects1), | 3524 TEST(rects1), |
3526 TEST(issue2540), | 3525 TEST(issue2540), |
3527 TEST(issue2504), | 3526 TEST(issue2504), |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3958 }; | 3957 }; |
3959 | 3958 |
3960 static const size_t failTestCount = SK_ARRAY_COUNT(failTests); | 3959 static const size_t failTestCount = SK_ARRAY_COUNT(failTests); |
3961 | 3960 |
3962 DEF_TEST(PathOpsFailOp, reporter) { | 3961 DEF_TEST(PathOpsFailOp, reporter) { |
3963 #if DEBUG_SHOW_TEST_NAME | 3962 #if DEBUG_SHOW_TEST_NAME |
3964 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); | 3963 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); |
3965 #endif | 3964 #endif |
3966 RunTestSet(reporter, failTests, failTestCount, 0, 0, false); | 3965 RunTestSet(reporter, failTests, failTestCount, 0, 0, false); |
3967 } | 3966 } |
OLD | NEW |