Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Side by Side Diff: tests/PathOpsOpTest.cpp

Issue 1002693002: pathops version two (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix arm 64 inspired coincident handling Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/PathOpsOpLoopThreadedTest.cpp ('k') | tests/PathOpsQuadIntersectionTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 path.moveTo(0,1); 706 path.moveTo(0,1);
707 path.cubicTo(2,6, 6,1, 4,3); 707 path.cubicTo(2,6, 6,1, 4,3);
708 path.close(); 708 path.close();
709 pathB.setFillType(SkPath::kWinding_FillType); 709 pathB.setFillType(SkPath::kWinding_FillType);
710 pathB.moveTo(1,6); 710 pathB.moveTo(1,6);
711 pathB.cubicTo(3,4, 1,0, 6,2); 711 pathB.cubicTo(3,4, 1,0, 6,2);
712 pathB.close(); 712 pathB.close();
713 testPathOp(reporter, path, pathB, kDifference_PathOp, filename); 713 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
714 } 714 }
715 715
716 // this fails to detect a cubic/cubic intersection
717 // the slight overlap is missed when the cubics are approximated by quadratics
718 // and the subsequent line/cubic intersection also (correctly) misses the inters ection
719 // if the line/cubic was a matching line/approx.quadratic then the missing inter section
720 // could have been detected
721 static void cubicOp38d(skiatest::Reporter* reporter, const char* filename) { 716 static void cubicOp38d(skiatest::Reporter* reporter, const char* filename) {
722 SkPath path, pathB; 717 SkPath path, pathB;
723 path.setFillType(SkPath::kWinding_FillType); 718 path.setFillType(SkPath::kWinding_FillType);
724 path.moveTo(0,1); 719 path.moveTo(0,1);
725 path.cubicTo(0,6, 3,2, 4,1); 720 path.cubicTo(0,6, 3,2, 4,1);
726 path.close(); 721 path.close();
727 pathB.setFillType(SkPath::kWinding_FillType); 722 pathB.setFillType(SkPath::kWinding_FillType);
728 pathB.moveTo(2,3); 723 pathB.moveTo(2,3);
729 pathB.cubicTo(1,4, 1,0, 6,0); 724 pathB.cubicTo(1,4, 1,0, 6,0);
730 pathB.close(); 725 pathB.close();
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1788 path.cubicTo(1,6, 1,0, 6,2); 1783 path.cubicTo(1,6, 1,0, 6,2);
1789 path.close(); 1784 path.close();
1790 SkPath pathB; 1785 SkPath pathB;
1791 pathB.setFillType(SkPath::kWinding_FillType); 1786 pathB.setFillType(SkPath::kWinding_FillType);
1792 pathB.moveTo(0,1); 1787 pathB.moveTo(0,1);
1793 pathB.cubicTo(2,6, 1,0, 6,1); 1788 pathB.cubicTo(2,6, 1,0, 6,1);
1794 pathB.close(); 1789 pathB.close();
1795 testPathOp(reporter, path, pathB, kDifference_PathOp, filename); 1790 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
1796 } 1791 }
1797 1792
1798 // this fails because the pair of nearly coincident cubics intersect at the ends
1799 // but the line connected to one of the cubics at the same point does not inters ect
1800 // the other
1801 static void skpkkiste_to98(skiatest::Reporter* reporter, const char* filename) { 1793 static void skpkkiste_to98(skiatest::Reporter* reporter, const char* filename) {
1802 SkPath path; 1794 SkPath path;
1803 path.setFillType(SkPath::kEvenOdd_FillType); 1795 path.setFillType(SkPath::kEvenOdd_FillType);
1804 path.moveTo(96, 122); 1796 path.moveTo(96, 122);
1805 path.cubicTo(94.6192932f, 122, 93.3692932f, 122.559647f, 92.4644699f, 123.46 447f); 1797 path.cubicTo(94.6192932f, 122, 93.3692932f, 122.559647f, 92.4644699f, 123.46 447f);
1806 path.lineTo(94.1715698f, 125.17157f); 1798 path.lineTo(94.1715698f, 125.17157f);
1807 path.cubicTo(94.8954315f, 124.447708f, 95.8954315f, 124, 97, 124); 1799 path.cubicTo(94.8954315f, 124.447708f, 95.8954315f, 124, 97, 124);
1808 path.lineTo(257, 124); 1800 path.lineTo(257, 124);
1809 path.cubicTo(258.104553f, 124, 259.104584f, 124.447708f, 259.82843f, 125.171 57f); 1801 path.cubicTo(258.104553f, 124, 259.104584f, 124.447708f, 259.82843f, 125.171 57f);
1810 path.lineTo(261.535522f, 123.46447f); 1802 path.lineTo(261.535522f, 123.46447f);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 path2.close(); 1919 path2.close();
1928 path2.moveTo(113.232177734375f, 173.5789947509765625f); 1920 path2.moveTo(113.232177734375f, 173.5789947509765625f);
1929 path2.quadTo(116.8802642822265625f, 175.69805908203125f, 120.817977905273437 5f, 177.1177825927734375f); 1921 path2.quadTo(116.8802642822265625f, 175.69805908203125f, 120.817977905273437 5f, 177.1177825927734375f);
1930 path2.lineTo(132.2864990234375f, 169.6969757080078125f); 1922 path2.lineTo(132.2864990234375f, 169.6969757080078125f);
1931 path2.lineTo(132.2864990234375f, 169.6969757080078125f); 1923 path2.lineTo(132.2864990234375f, 169.6969757080078125f);
1932 path2.lineTo(118.68194580078125f, 160.343841552734375f); 1924 path2.lineTo(118.68194580078125f, 160.343841552734375f);
1933 path2.lineTo(118.68194580078125f, 160.343841552734375f); 1925 path2.lineTo(118.68194580078125f, 160.343841552734375f);
1934 path2.lineTo(113.232177734375f, 173.5789947509765625f); 1926 path2.lineTo(113.232177734375f, 173.5789947509765625f);
1935 path2.lineTo(113.232177734375f, 173.5789947509765625f); 1927 path2.lineTo(113.232177734375f, 173.5789947509765625f);
1936 path2.close(); 1928 path2.close();
1937 1929 // FIXME : difficult data, circle back later
1938 testPathOp(reporter, path1, path2, kUnion_PathOp, filename); 1930 testPathOp(reporter, path1, path2, kUnion_PathOp, filename);
1939 } 1931 }
1940 1932
1941 static void issue1418(skiatest::Reporter* reporter, const char* filename) { 1933 static void issue1418(skiatest::Reporter* reporter, const char* filename) {
1942 SkPath path1; 1934 SkPath path1;
1943 path1.moveTo(0, 0); 1935 path1.moveTo(0, 0);
1944 path1.lineTo(1, 0); 1936 path1.lineTo(1, 0);
1945 path1.lineTo(1, 0); 1937 path1.lineTo(1, 0);
1946 path1.lineTo(1, 1); 1938 path1.lineTo(1, 1);
1947 path1.lineTo(1, 1); 1939 path1.lineTo(1, 1);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 pathB.lineTo(1, 3); 2041 pathB.lineTo(1, 3);
2050 pathB.close(); 2042 pathB.close();
2051 pathB.moveTo(2, 2); 2043 pathB.moveTo(2, 2);
2052 pathB.lineTo(3, 2); 2044 pathB.lineTo(3, 2);
2053 pathB.lineTo(3, 3); 2045 pathB.lineTo(3, 3);
2054 pathB.lineTo(2, 3); 2046 pathB.lineTo(2, 3);
2055 pathB.close(); 2047 pathB.close();
2056 testPathOp(reporter, path, pathB, kXOR_PathOp, filename); 2048 testPathOp(reporter, path, pathB, kXOR_PathOp, filename);
2057 } 2049 }
2058 2050
2059 // this fails to generate two interior line segments
2060 // an earlier pathops succeeded, but still failed to generate one interior line segment
2061 // (but was saved by assemble, which works around a single line missing segment)
2062 static void issue1435(skiatest::Reporter* reporter, const char* filename) { 2051 static void issue1435(skiatest::Reporter* reporter, const char* filename) {
2063 SkPath path1; 2052 SkPath path1;
2064 path1.moveTo(160, 60); 2053 path1.moveTo(160, 60);
2065 path1.lineTo(220, 230); 2054 path1.lineTo(220, 230);
2066 path1.lineTo(60, 120); 2055 path1.lineTo(60, 120);
2067 path1.lineTo(260, 120); 2056 path1.lineTo(260, 120);
2068 path1.lineTo(90, 230); 2057 path1.lineTo(90, 230);
2069 path1.lineTo(160, 60); 2058 path1.lineTo(160, 60);
2070 path1.close(); 2059 path1.close();
2071 path1.setFillType(SkPath::kEvenOdd_FillType); 2060 path1.setFillType(SkPath::kEvenOdd_FillType);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
2249 path.moveTo(1, 6); 2238 path.moveTo(1, 6);
2250 path.cubicTo(0, 3, 6, 3, 5, 0); 2239 path.cubicTo(0, 3, 6, 3, 5, 0);
2251 path.close(); 2240 path.close();
2252 pathB.setFillType(SkPath::kWinding_FillType); 2241 pathB.setFillType(SkPath::kWinding_FillType);
2253 pathB.moveTo(3, 6); 2242 pathB.moveTo(3, 6);
2254 pathB.cubicTo(0, 5, 6, 1, 3, 0); 2243 pathB.cubicTo(0, 5, 6, 1, 3, 0);
2255 pathB.close(); 2244 pathB.close();
2256 testPathOp(reporter, path, pathB, kUnion_PathOp, filename); 2245 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
2257 } 2246 }
2258 2247
2259 static void skpaaalgarve_org53(skiatest::Reporter* reporter, const char* filenam e) { // add t cancel 2248 static void skpaaalgarve_org53(skiatest::Reporter* reporter, const char* filenam e) {
2260 SkPath path; 2249 SkPath path;
2261 path.setFillType(SkPath::kEvenOdd_FillType); 2250 path.setFillType(SkPath::kEvenOdd_FillType);
2262 path.moveTo(-1.24344979e-014f, 348); 2251 path.moveTo(-1.24344979e-014f, 348);
2263 path.lineTo(258, 348); 2252 path.lineTo(258, 348);
2264 path.lineTo(258, 322); 2253 path.lineTo(258, 322);
2265 path.quadTo(258, 317.857849f, 255.072006f, 314.928009f); 2254 path.quadTo(258, 317.857849f, 255.072006f, 314.928009f);
2266 path.quadTo(252.142136f, 312, 248, 312); 2255 path.quadTo(252.142136f, 312, 248, 312);
2267 path.lineTo(1.77635684e-015f, 312); 2256 path.lineTo(1.77635684e-015f, 312);
2268 path.lineTo(-1.24344979e-014f, 348); 2257 path.lineTo(-1.24344979e-014f, 348);
2269 path.close(); 2258 path.close();
2270 SkPath pathB; 2259 SkPath pathB;
2271 pathB.setFillType(SkPath::kWinding_FillType); 2260 pathB.setFillType(SkPath::kWinding_FillType);
2272 pathB.moveTo(0, 312); 2261 pathB.moveTo(0, 312);
2273 pathB.lineTo(258, 312); 2262 pathB.lineTo(258, 312);
2274 pathB.lineTo(258, 348); 2263 pathB.lineTo(258, 348);
2275 pathB.lineTo(0, 348); 2264 pathB.lineTo(0, 348);
2276 pathB.close(); 2265 pathB.close();
2277 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); 2266 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2278 } 2267 }
2279 2268
2280 static void skpabcspark_ca103(skiatest::Reporter* reporter, const char* filename ) { // add t cancel 2269 static void skpabcspark_ca103(skiatest::Reporter* reporter, const char* filename ) {
2281 SkPath path; 2270 SkPath path;
2282 path.setFillType(SkPath::kEvenOdd_FillType); 2271 path.setFillType(SkPath::kEvenOdd_FillType);
2283 path.moveTo(1.99840144e-015f, 494); 2272 path.moveTo(1.99840144e-015f, 494);
2284 path.lineTo(97, 494); 2273 path.lineTo(97, 494);
2285 path.quadTo(100.313705f, 494, 102.6576f, 491.657593f); 2274 path.quadTo(100.313705f, 494, 102.6576f, 491.657593f);
2286 path.quadTo(105, 489.313721f, 105, 486); 2275 path.quadTo(105, 489.313721f, 105, 486);
2287 path.lineTo(105, 425); 2276 path.lineTo(105, 425);
2288 path.quadTo(105, 421.686279f, 102.6576f, 419.342407f); 2277 path.quadTo(105, 421.686279f, 102.6576f, 419.342407f);
2289 path.quadTo(100.313705f, 417, 97, 417); 2278 path.quadTo(100.313705f, 417, 97, 417);
2290 path.lineTo(2.22044605e-016f, 417); 2279 path.lineTo(2.22044605e-016f, 417);
2291 path.lineTo(1.99840144e-015f, 494); 2280 path.lineTo(1.99840144e-015f, 494);
2292 path.close(); 2281 path.close();
2293 SkPath pathB; 2282 SkPath pathB;
2294 pathB.setFillType(SkPath::kWinding_FillType); 2283 pathB.setFillType(SkPath::kWinding_FillType);
2295 pathB.moveTo(0, 417); 2284 pathB.moveTo(0, 417);
2296 pathB.lineTo(105, 417); 2285 pathB.lineTo(105, 417);
2297 pathB.lineTo(105, 494); 2286 pathB.lineTo(105, 494);
2298 pathB.lineTo(0, 494); 2287 pathB.lineTo(0, 494);
2299 pathB.close(); 2288 pathB.close();
2300 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); 2289 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2301 } 2290 }
2302 2291
2303 static void skpacesoftech_com47(skiatest::Reporter* reporter, const char* filena me) { // partial coincidence 2292 static void skpacesoftech_com47(skiatest::Reporter* reporter, const char* filena me) {
2304 SkPath path; 2293 SkPath path;
2305 path.setFillType(SkPath::kEvenOdd_FillType); 2294 path.setFillType(SkPath::kEvenOdd_FillType);
2306 path.moveTo(670.537415f, 285); 2295 path.moveTo(670.537415f, 285);
2307 path.lineTo(670.387451f, 285); 2296 path.lineTo(670.387451f, 285);
2308 path.lineTo(596.315186f, 314.850708f); 2297 path.lineTo(596.315186f, 314.850708f);
2309 path.lineTo(626.19696f, 389); 2298 path.lineTo(626.19696f, 389);
2310 path.lineTo(626.346863f, 389); 2299 path.lineTo(626.346863f, 389);
2311 path.lineTo(700.419189f, 359.149261f); 2300 path.lineTo(700.419189f, 359.149261f);
2312 path.lineTo(670.537415f, 285); 2301 path.lineTo(670.537415f, 285);
2313 path.close(); 2302 path.close();
2314 SkPath pathB; 2303 SkPath pathB;
2315 pathB.setFillType(SkPath::kWinding_FillType); 2304 pathB.setFillType(SkPath::kWinding_FillType);
2316 pathB.moveTo(663.318542f, 374.100616f); 2305 pathB.moveTo(663.318542f, 374.100616f);
2317 pathB.quadTo(647.950989f, 380.293671f, 632.705322f, 373.806305f); 2306 pathB.quadTo(647.950989f, 380.293671f, 632.705322f, 373.806305f);
2318 pathB.quadTo(617.459595f, 367.318909f, 611.266541f, 351.951355f); 2307 pathB.quadTo(617.459595f, 367.318909f, 611.266541f, 351.951355f);
2319 pathB.quadTo(605.073486f, 336.58374f, 611.560913f, 321.338074f); 2308 pathB.quadTo(605.073486f, 336.58374f, 611.560913f, 321.338074f);
2320 pathB.quadTo(618.048279f, 306.092407f, 633.415833f, 299.899353f); 2309 pathB.quadTo(618.048279f, 306.092407f, 633.415833f, 299.899353f);
2321 pathB.quadTo(648.783447f, 293.706299f, 664.029114f, 300.193665f); 2310 pathB.quadTo(648.783447f, 293.706299f, 664.029114f, 300.193665f);
2322 pathB.quadTo(679.27478f, 306.68103f, 685.467834f, 322.048645f); 2311 pathB.quadTo(679.27478f, 306.68103f, 685.467834f, 322.048645f);
2323 pathB.quadTo(691.660889f, 337.416199f, 685.173523f, 352.661896f); 2312 pathB.quadTo(691.660889f, 337.416199f, 685.173523f, 352.661896f);
2324 pathB.quadTo(678.686157f, 367.907562f, 663.318542f, 374.100616f); 2313 pathB.quadTo(678.686157f, 367.907562f, 663.318542f, 374.100616f);
2325 pathB.close(); 2314 pathB.close();
2326 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); 2315 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2327 } 2316 }
2328 2317
2329 static void skpact_com43(skiatest::Reporter* reporter, const char* filename) { // bridge op 2318 static void skpact_com43(skiatest::Reporter* reporter, const char* filename) {
2330 SkPath path; 2319 SkPath path;
2331 path.setFillType(SkPath::kEvenOdd_FillType); 2320 path.setFillType(SkPath::kEvenOdd_FillType);
2332 path.moveTo(1.45716772e-016f, 924.336121f); 2321 path.moveTo(1.45716772e-016f, 924.336121f);
2333 path.lineTo(-1.11022302e-016f, 920); 2322 path.lineTo(-1.11022302e-016f, 920);
2334 path.lineTo(6, 920); 2323 path.lineTo(6, 920);
2335 path.lineTo(6, 926); 2324 path.lineTo(6, 926);
2336 path.lineTo(1.66389287f, 926); 2325 path.lineTo(1.66389287f, 926);
2337 path.quadTo(1.18842196f, 925.674561f, 0.756800175f, 925.243225f); 2326 path.quadTo(1.18842196f, 925.674561f, 0.756800175f, 925.243225f);
2338 path.quadTo(0.325406998f, 924.811523f, 1.45716772e-016f, 924.336121f); 2327 path.quadTo(0.325406998f, 924.811523f, 1.45716772e-016f, 924.336121f);
2339 path.close(); 2328 path.close();
2340 path.moveTo(1, 921); 2329 path.moveTo(1, 921);
2341 path.lineTo(5, 921); 2330 path.lineTo(5, 921);
2342 path.lineTo(5, 925); 2331 path.lineTo(5, 925);
2343 path.cubicTo(2.79086018f, 925, 1, 923.209167f, 1, 921); 2332 path.cubicTo(2.79086018f, 925, 1, 923.209167f, 1, 921);
2344 path.close(); 2333 path.close();
2345 SkPath pathB; 2334 SkPath pathB;
2346 pathB.setFillType(SkPath::kWinding_FillType); 2335 pathB.setFillType(SkPath::kWinding_FillType);
2347 pathB.moveTo(-1, 920); 2336 pathB.moveTo(-1, 920);
2348 pathB.lineTo(0, 920); 2337 pathB.lineTo(0, 920);
2349 pathB.lineTo(3, 927); 2338 pathB.lineTo(3, 927);
2350 pathB.lineTo(-1, 927); 2339 pathB.lineTo(-1, 927);
2351 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); 2340 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2352 } 2341 }
2353 2342
2354 static void skpadbox_lt8(skiatest::Reporter* reporter, const char* filename) { // zero span 2343 static void skpadbox_lt8(skiatest::Reporter* reporter, const char* filename) {
2355 SkPath path; 2344 SkPath path;
2356 path.setFillType(SkPath::kEvenOdd_FillType); 2345 path.setFillType(SkPath::kEvenOdd_FillType);
2357 path.moveTo(320.097229f, 628.573669f); 2346 path.moveTo(320.097229f, 628.573669f);
2358 path.lineTo(610.227173f, 85.7786865f); 2347 path.lineTo(610.227173f, 85.7786865f);
2359 path.lineTo(946.652588f, 265.601807f); 2348 path.lineTo(946.652588f, 265.601807f);
2360 path.lineTo(656.522644f, 808.39679f); 2349 path.lineTo(656.522644f, 808.39679f);
2361 path.lineTo(320.097229f, 628.573669f); 2350 path.lineTo(320.097229f, 628.573669f);
2362 path.close(); 2351 path.close();
2363 SkPath pathB; 2352 SkPath pathB;
2364 pathB.setFillType(SkPath::kInverseWinding_FillType); 2353 pathB.setFillType(SkPath::kInverseWinding_FillType);
2365 pathB.moveTo(333.866608f, 623.496155f); 2354 pathB.moveTo(333.866608f, 623.496155f);
2366 pathB.lineTo(613.368042f, 100.585754f); 2355 pathB.lineTo(613.368042f, 100.585754f);
2367 pathB.cubicTo(613.685303f, 99.9921265f, 614.423767f, 99.7681885f, 615.017395 f, 100.085449f); 2356 pathB.cubicTo(613.685303f, 99.9921265f, 614.423767f, 99.7681885f, 615.017395 f, 100.085449f);
2368 pathB.lineTo(932.633057f, 269.854553f); 2357 pathB.lineTo(932.633057f, 269.854553f);
2369 pathB.cubicTo(933.226685f, 270.171875f, 933.450623f, 270.910278f, 933.133301 f, 271.503906f); 2358 pathB.cubicTo(933.226685f, 270.171875f, 933.450623f, 270.910278f, 933.133301 f, 271.503906f);
2370 pathB.lineTo(653.631897f, 794.414307f); 2359 pathB.lineTo(653.631897f, 794.414307f);
2371 pathB.cubicTo(653.314636f, 795.007935f, 652.576172f, 795.231934f, 651.982544 f, 794.914612f); 2360 pathB.cubicTo(653.314636f, 795.007935f, 652.576172f, 795.231934f, 651.982544 f, 794.914612f);
2372 pathB.lineTo(334.366943f, 625.145508f); 2361 pathB.lineTo(334.366943f, 625.145508f);
2373 pathB.cubicTo(333.773315f, 624.828247f, 333.549286f, 624.089783f, 333.866608 f, 623.496155f); 2362 pathB.cubicTo(333.773315f, 624.828247f, 333.549286f, 624.089783f, 333.866608 f, 623.496155f);
2374 pathB.close(); 2363 pathB.close();
2375 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); 2364 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2376 } 2365 }
2377 2366
2378 static void skpadindex_de4(skiatest::Reporter* reporter, const char* filename) { // find chase op 2367 static void skpadindex_de4(skiatest::Reporter* reporter, const char* filename) {
2379 SkPath path; 2368 SkPath path;
2380 path.setFillType(SkPath::kEvenOdd_FillType); 2369 path.setFillType(SkPath::kEvenOdd_FillType);
2381 path.moveTo(0, 926); 2370 path.moveTo(0, 926);
2382 path.lineTo(0, 0); 2371 path.lineTo(0, 0);
2383 path.lineTo(1280, 0); 2372 path.lineTo(1280, 0);
2384 path.lineTo(1280, 926); 2373 path.lineTo(1280, 926);
2385 path.lineTo(0, 926); 2374 path.lineTo(0, 926);
2386 path.close(); 2375 path.close();
2387 SkPath pathB; 2376 SkPath pathB;
2388 pathB.setFillType(SkPath::kWinding_FillType); 2377 pathB.setFillType(SkPath::kWinding_FillType);
2389 pathB.moveTo(0, 312); 2378 pathB.moveTo(0, 312);
2390 pathB.lineTo(8.20486257e-015f, 178); 2379 pathB.lineTo(8.20486257e-015f, 178);
2391 pathB.lineTo(49, 178); 2380 pathB.lineTo(49, 178);
2392 pathB.lineTo(49, 312); 2381 pathB.lineTo(49, 312);
2393 pathB.close(); 2382 pathB.close();
2394 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); 2383 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2395 } 2384 }
2396 2385
2397 static void skpadithya_putr4_blogspot_com551(skiatest::Reporter* reporter, const char* filename) { // calc common 2386 static void skpadithya_putr4_blogspot_com551(skiatest::Reporter* reporter, const char* filename) {
2398 SkPath path; 2387 SkPath path;
2399 path.setFillType(SkPath::kEvenOdd_FillType); 2388 path.setFillType(SkPath::kEvenOdd_FillType);
2400 path.moveTo(205.605804f, 142.334625f); 2389 path.moveTo(205.605804f, 142.334625f);
2401 path.lineTo(254.665359f, 85.6058044f); 2390 path.lineTo(254.665359f, 85.6058044f);
2402 path.lineTo(311.394196f, 134.665359f); 2391 path.lineTo(311.394196f, 134.665359f);
2403 path.lineTo(262.334625f, 191.39418f); 2392 path.lineTo(262.334625f, 191.39418f);
2404 path.lineTo(205.605804f, 142.334625f); 2393 path.lineTo(205.605804f, 142.334625f);
2405 path.close(); 2394 path.close();
2406 SkPath pathB; 2395 SkPath pathB;
2407 pathB.setFillType(SkPath::kWinding_FillType); 2396 pathB.setFillType(SkPath::kWinding_FillType);
2408 pathB.moveTo(283.407959f, 110.462646f); 2397 pathB.moveTo(283.407959f, 110.462646f);
2409 pathB.cubicTo(298.864319f, 123.829437f, 300.558258f, 147.195221f, 287.191467 f, 162.651581f); 2398 pathB.cubicTo(298.864319f, 123.829437f, 300.558258f, 147.195221f, 287.191467 f, 162.651581f);
2410 pathB.lineTo(286.537354f, 163.407959f); 2399 pathB.lineTo(286.537354f, 163.407959f);
2411 pathB.cubicTo(273.170563f, 178.864334f, 249.804779f, 180.558258f, 234.348419 f, 167.191467f); 2400 pathB.cubicTo(273.170563f, 178.864334f, 249.804779f, 180.558258f, 234.348419 f, 167.191467f);
2412 pathB.lineTo(233.592026f, 166.537338f); 2401 pathB.lineTo(233.592026f, 166.537338f);
2413 pathB.cubicTo(218.135666f, 153.170547f, 216.441727f, 129.804779f, 229.808517 f, 114.348412f); 2402 pathB.cubicTo(218.135666f, 153.170547f, 216.441727f, 129.804779f, 229.808517 f, 114.348412f);
2414 pathB.lineTo(230.462646f, 113.592026f); 2403 pathB.lineTo(230.462646f, 113.592026f);
2415 pathB.cubicTo(243.829437f, 98.1356659f, 267.195221f, 96.4417267f, 282.651581 f, 109.808517f); 2404 pathB.cubicTo(243.829437f, 98.1356659f, 267.195221f, 96.4417267f, 282.651581 f, 109.808517f);
2416 pathB.lineTo(283.407959f, 110.462646f); 2405 pathB.lineTo(283.407959f, 110.462646f);
2417 pathB.close(); 2406 pathB.close();
2418 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); 2407 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2419 } 2408 }
2420 2409
2421 static void skpadspert_de11(skiatest::Reporter* reporter, const char* filename) { // mark and chase winding 2410 static void skpadspert_de11(skiatest::Reporter* reporter, const char* filename) {
2422 SkPath path; 2411 SkPath path;
2423 path.setFillType(SkPath::kEvenOdd_FillType); 2412 path.setFillType(SkPath::kEvenOdd_FillType);
2424 path.moveTo(-4.4408921e-016f, 682.5f); 2413 path.moveTo(-4.4408921e-016f, 682.5f);
2425 path.lineTo(30.5f, 682.5f); 2414 path.lineTo(30.5f, 682.5f);
2426 path.cubicTo(32.709137f, 682.5f, 34.5f, 680.709167f, 34.5f, 678.5f); 2415 path.cubicTo(32.709137f, 682.5f, 34.5f, 680.709167f, 34.5f, 678.5f);
2427 path.lineTo(34.5f, 486.5f); 2416 path.lineTo(34.5f, 486.5f);
2428 path.cubicTo(34.5f, 484.290863f, 32.709137f, 482.5f, 30.5f, 482.5f); 2417 path.cubicTo(34.5f, 484.290863f, 32.709137f, 482.5f, 30.5f, 482.5f);
2429 path.lineTo(0, 482.5f); 2418 path.lineTo(0, 482.5f);
2430 path.lineTo(-4.4408921e-016f, 682.5f); 2419 path.lineTo(-4.4408921e-016f, 682.5f);
2431 path.close(); 2420 path.close();
2432 SkPath pathB; 2421 SkPath pathB;
2433 pathB.setFillType(SkPath::kWinding_FillType); 2422 pathB.setFillType(SkPath::kWinding_FillType);
2434 pathB.moveTo(0, 482); 2423 pathB.moveTo(0, 482);
2435 pathB.lineTo(35, 482); 2424 pathB.lineTo(35, 482);
2436 pathB.lineTo(35, 683); 2425 pathB.lineTo(35, 683);
2437 pathB.lineTo(0, 683); 2426 pathB.lineTo(0, 683);
2438 pathB.close(); 2427 pathB.close();
2439 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); 2428 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2440 } 2429 }
2441 2430
2442 static void skpaiaigames_com870(skiatest::Reporter* reporter, const char* filena me) { // cubic/cubic intersect 2431 static void skpaiaigames_com870(skiatest::Reporter* reporter, const char* filena me) {
2443 SkPath path; 2432 SkPath path;
2444 path.setFillType(SkPath::kEvenOdd_FillType); 2433 path.setFillType(SkPath::kEvenOdd_FillType);
2445 path.moveTo(324.071075f, 845.071045f); 2434 path.moveTo(324.071075f, 845.071045f);
2446 path.cubicTo(324.405151f, 844.737f, 324.715668f, 844.379395f, 325, 844.00097 7f); 2435 path.cubicTo(324.405151f, 844.737f, 324.715668f, 844.379395f, 325, 844.00097 7f);
2447 path.lineTo(325, 842.127197f); 2436 path.lineTo(325, 842.127197f);
2448 path.cubicTo(324.571411f, 842.956238f, 324.017761f, 843.710144f, 323.363953f , 844.363953f); 2437 path.cubicTo(324.571411f, 842.956238f, 324.017761f, 843.710144f, 323.363953f , 844.363953f);
2449 path.lineTo(324.071075f, 845.071045f); 2438 path.lineTo(324.071075f, 845.071045f);
2450 path.close(); 2439 path.close();
2451 path.moveTo(323.363953f, 714.636047f); 2440 path.moveTo(323.363953f, 714.636047f);
2452 path.lineTo(324.071075f, 713.928955f); 2441 path.lineTo(324.071075f, 713.928955f);
2453 path.cubicTo(324.405151f, 714.263f, 324.715668f, 714.620605f, 325, 714.99902 3f); 2442 path.cubicTo(324.405151f, 714.263f, 324.715668f, 714.620605f, 325, 714.99902 3f);
2454 path.lineTo(325, 716.872803f); 2443 path.lineTo(325, 716.872803f);
2455 path.cubicTo(324.571411f, 716.043762f, 324.017761f, 715.289856f, 323.363953f , 714.636047f); 2444 path.cubicTo(324.571411f, 716.043762f, 324.017761f, 715.289856f, 323.363953f , 714.636047f);
2456 path.close(); 2445 path.close();
2457 SkPath pathB; 2446 SkPath pathB;
2458 pathB.setFillType(SkPath::kWinding_FillType); 2447 pathB.setFillType(SkPath::kWinding_FillType);
2459 pathB.moveTo(317, 711); 2448 pathB.moveTo(317, 711);
2460 pathB.cubicTo(322.522858f, 711, 327, 715.477173f, 327, 721); 2449 pathB.cubicTo(322.522858f, 711, 327, 715.477173f, 327, 721);
2461 pathB.lineTo(327, 838); 2450 pathB.lineTo(327, 838);
2462 pathB.cubicTo(327, 843.522827f, 322.522858f, 848, 317, 848); 2451 pathB.cubicTo(327, 843.522827f, 322.522858f, 848, 317, 848);
2463 pathB.lineTo(155, 848); 2452 pathB.lineTo(155, 848);
2464 pathB.cubicTo(149.477158f, 848, 145, 843.522827f, 145, 838); 2453 pathB.cubicTo(149.477158f, 848, 145, 843.522827f, 145, 838);
2465 pathB.lineTo(145, 721); 2454 pathB.lineTo(145, 721);
2466 pathB.cubicTo(145, 715.477173f, 149.477158f, 711, 155, 711); 2455 pathB.cubicTo(145, 715.477173f, 149.477158f, 711, 155, 711);
2467 pathB.lineTo(317, 711); 2456 pathB.lineTo(317, 711);
2468 pathB.close(); 2457 pathB.close();
2469 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); 2458 testPathOpCheck(reporter, path, pathB, kIntersect_PathOp, filename, FLAGS_ru nFail);
2470 } 2459 }
2471 2460
2472 static void cubicOp92i(skiatest::Reporter* reporter, const char* filename) { 2461 static void cubicOp92i(skiatest::Reporter* reporter, const char* filename) {
2473 SkPath path, pathB; 2462 SkPath path, pathB;
2474 path.setFillType(SkPath::kWinding_FillType); 2463 path.setFillType(SkPath::kWinding_FillType);
2475 path.moveTo(0, 1); 2464 path.moveTo(0, 1);
2476 path.cubicTo(2, 6, 4, 1, 5, 4); 2465 path.cubicTo(2, 6, 4, 1, 5, 4);
2477 path.close(); 2466 path.close();
2478 pathB.setFillType(SkPath::kWinding_FillType); 2467 pathB.setFillType(SkPath::kWinding_FillType);
2479 pathB.moveTo(1, 4); 2468 pathB.moveTo(1, 4);
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
2717 pathB.cubicTo(265.140167f, 785, 322, 842.307556f, 322, 913); 2706 pathB.cubicTo(265.140167f, 785, 322, 842.307556f, 322, 913);
2718 pathB.cubicTo(322, 983.692444f, 265.140167f, 1041, 195, 1041); 2707 pathB.cubicTo(322, 983.692444f, 265.140167f, 1041, 195, 1041);
2719 pathB.lineTo(194, 1041); 2708 pathB.lineTo(194, 1041);
2720 pathB.cubicTo(123.85984f, 1041, 67, 983.692444f, 67, 913); 2709 pathB.cubicTo(123.85984f, 1041, 67, 983.692444f, 67, 913);
2721 pathB.cubicTo(67, 842.307556f, 123.85984f, 785, 194, 785); 2710 pathB.cubicTo(67, 842.307556f, 123.85984f, 785, 194, 785);
2722 pathB.lineTo(195, 785); 2711 pathB.lineTo(195, 785);
2723 pathB.close(); 2712 pathB.close();
2724 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); 2713 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2725 } 2714 }
2726 2715
2727 // this fails because cubic/quad misses an intersection (failure is isolated in c/q int test)
2728 static void skpcarrot_is24(skiatest::Reporter* reporter, const char* filename) { 2716 static void skpcarrot_is24(skiatest::Reporter* reporter, const char* filename) {
2729 SkPath path; 2717 SkPath path;
2730 path.setFillType(SkPath::kEvenOdd_FillType); 2718 path.setFillType(SkPath::kEvenOdd_FillType);
2731 path.moveTo(945, 597); 2719 path.moveTo(945, 597);
2732 path.quadTo(913.93396f, 597, 891.96698f, 618.96698f); 2720 path.quadTo(913.93396f, 597, 891.96698f, 618.96698f);
2733 path.quadTo(870, 640.93396f, 870, 672); 2721 path.quadTo(870, 640.93396f, 870, 672);
2734 path.quadTo(870, 703.06604f, 891.96698f, 725.03302f); 2722 path.quadTo(870, 703.06604f, 891.96698f, 725.03302f);
2735 path.quadTo(913.93396f, 747, 945, 747); 2723 path.quadTo(913.93396f, 747, 945, 747);
2736 path.quadTo(976.06604f, 747, 998.03302f, 725.03302f); 2724 path.quadTo(976.06604f, 747, 998.03302f, 725.03302f);
2737 path.quadTo(1020, 703.06604f, 1020, 672); 2725 path.quadTo(1020, 703.06604f, 1020, 672);
2738 path.quadTo(1020, 640.93396f, 998.03302f, 618.96698f); 2726 path.quadTo(1020, 640.93396f, 998.03302f, 618.96698f);
2739 path.quadTo(976.06604f, 597, 945, 597); 2727 path.quadTo(976.06604f, 597, 945, 597);
2740 path.close(); 2728 path.close();
2741 SkPath pathB; 2729 SkPath pathB;
2742 pathB.setFillType(SkPath::kWinding_FillType); 2730 pathB.setFillType(SkPath::kWinding_FillType);
2743 pathB.moveTo(945.080994f, 597.161987f); 2731 pathB.moveTo(945.080994f, 597.161987f);
2744 pathB.cubicTo(903.659973f, 597.161987f, 870.080994f, 630.73999f, 870.080994f , 672.161987f); 2732 pathB.cubicTo(903.659973f, 597.161987f, 870.080994f, 630.73999f, 870.080994f , 672.161987f);
2745 pathB.cubicTo(870.080994f, 676.096008f, 870.387024f, 679.957031f, 870.971008 f, 683.726013f); 2733 pathB.cubicTo(870.080994f, 676.096008f, 870.387024f, 679.957031f, 870.971008 f, 683.726013f);
2746 pathB.cubicTo(876.53302f, 719.656006f, 907.593994f, 747.161987f, 945.080994f , 747.161987f); 2734 pathB.cubicTo(876.53302f, 719.656006f, 907.593994f, 747.161987f, 945.080994f , 747.161987f);
2747 pathB.cubicTo(982.567993f, 747.161987f, 1013.62903f, 719.656006f, 1019.19104 f, 683.726013f); 2735 pathB.cubicTo(982.567993f, 747.161987f, 1013.62903f, 719.656006f, 1019.19104 f, 683.726013f);
2748 pathB.cubicTo(1019.77502f, 679.955017f, 1020.08099f, 676.094971f, 1020.08099 f, 672.161987f); 2736 pathB.cubicTo(1019.77502f, 679.955017f, 1020.08099f, 676.094971f, 1020.08099 f, 672.161987f);
2749 pathB.cubicTo(1020.08002f, 630.73999f, 986.502014f, 597.161987f, 945.080994f , 597.161987f); 2737 pathB.cubicTo(1020.08002f, 630.73999f, 986.502014f, 597.161987f, 945.080994f , 597.161987f);
2750 pathB.close(); 2738 pathB.close();
2751 testPathOpCheck(reporter, path, pathB, kIntersect_PathOp, filename, FLAGS_ru nFail); 2739 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2752 } 2740 }
2753 2741
2754 static void skpbangalorenest_com4(skiatest::Reporter* reporter, const char* file name) { 2742 static void skpbangalorenest_com4(skiatest::Reporter* reporter, const char* file name) {
2755 SkPath path; 2743 SkPath path;
2756 path.setFillType(SkPath::kEvenOdd_FillType); 2744 path.setFillType(SkPath::kEvenOdd_FillType);
2757 path.moveTo(0, 926); 2745 path.moveTo(0, 926);
2758 path.lineTo(0, 0); 2746 path.lineTo(0, 0);
2759 path.lineTo(1265, 0); 2747 path.lineTo(1265, 0);
2760 path.lineTo(1265, 926); 2748 path.lineTo(1265, 926);
2761 path.lineTo(0, 926); 2749 path.lineTo(0, 926);
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
3240 path.moveTo(0,1); 3228 path.moveTo(0,1);
3241 path.cubicTo(1,6, 5,0, 2,1); 3229 path.cubicTo(1,6, 5,0, 2,1);
3242 path.close(); 3230 path.close();
3243 pathB.setFillType(SkPath::kWinding_FillType); 3231 pathB.setFillType(SkPath::kWinding_FillType);
3244 pathB.moveTo(0,5); 3232 pathB.moveTo(0,5);
3245 pathB.cubicTo(1,2, 1,0, 6,1); 3233 pathB.cubicTo(1,2, 1,0, 6,1);
3246 pathB.close(); 3234 pathB.close();
3247 testPathOp(reporter, path, pathB, kDifference_PathOp, filename); 3235 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3248 } 3236 }
3249 3237
3250 // triggers addSimpleAngle with non-zero argument
3251 static void cubicOp112(skiatest::Reporter* reporter, const char* filename) { 3238 static void cubicOp112(skiatest::Reporter* reporter, const char* filename) {
3252 SkPath path, pathB; 3239 SkPath path, pathB;
3253 path.setFillType(SkPath::kWinding_FillType); 3240 path.setFillType(SkPath::kWinding_FillType);
3254 path.moveTo(2,4); 3241 path.moveTo(2,4);
3255 path.cubicTo(2,3, 6,4, 1,0); 3242 path.cubicTo(2,3, 6,4, 1,0);
3256 path.close(); 3243 path.close();
3257 pathB.setFillType(SkPath::kWinding_FillType); 3244 pathB.setFillType(SkPath::kWinding_FillType);
3258 pathB.moveTo(4,6); 3245 pathB.moveTo(4,6);
3259 pathB.cubicTo(0,1, 4,2, 3,2); 3246 pathB.cubicTo(0,1, 4,2, 3,2);
3260 pathB.close(); 3247 pathB.close();
(...skipping 14 matching lines...) Expand all
3275 static void cubicOp114(skiatest::Reporter* reporter, const char* filename) { 3262 static void cubicOp114(skiatest::Reporter* reporter, const char* filename) {
3276 SkPath path, pathB; 3263 SkPath path, pathB;
3277 path.setFillType(SkPath::kWinding_FillType); 3264 path.setFillType(SkPath::kWinding_FillType);
3278 path.moveTo(0, 1); 3265 path.moveTo(0, 1);
3279 path.cubicTo(1, 3, -1, 2, 3.5f, 1.33333337f); 3266 path.cubicTo(1, 3, -1, 2, 3.5f, 1.33333337f);
3280 path.close(); 3267 path.close();
3281 pathB.setFillType(SkPath::kWinding_FillType); 3268 pathB.setFillType(SkPath::kWinding_FillType);
3282 pathB.moveTo(1, 3); 3269 pathB.moveTo(1, 3);
3283 pathB.cubicTo(-1, 2, 3.5f, 1.33333337f, 0, 1); 3270 pathB.cubicTo(-1, 2, 3.5f, 1.33333337f, 0, 1);
3284 pathB.close(); 3271 pathB.close();
3285 testPathOpCheck(reporter, path, pathB, kIntersect_PathOp, filename, FLAGS_ru nFail); 3272 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3286 } 3273 }
3287 3274
3288 static void cubicOp114asQuad(skiatest::Reporter* reporter, const char* filename) { 3275 static void cubicOp114asQuad(skiatest::Reporter* reporter, const char* filename) {
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);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
3457 path1.cubicTo(152.83f, 109.412f, 142.701f, 110.568f, 142.701f, 110.568f); 3444 path1.cubicTo(152.83f, 109.412f, 142.701f, 110.568f, 142.701f, 110.568f);
3458 path1.close(); 3445 path1.close();
3459 3446
3460 SkPath path2; 3447 SkPath path2;
3461 path2.moveTo(39, 124.001f); 3448 path2.moveTo(39, 124.001f);
3462 path2.cubicTo(39, 124.001f, 50.6f, 117.001f, 50.6f, 117.001f); 3449 path2.cubicTo(39, 124.001f, 50.6f, 117.001f, 50.6f, 117.001f);
3463 path2.cubicTo(50.6f, 117.001f, 164.601f, 85.2f, 188.201f, 117.601f); 3450 path2.cubicTo(50.6f, 117.001f, 164.601f, 85.2f, 188.201f, 117.601f);
3464 path2.cubicTo(188.201f, 117.601f, 174.801f, 93, 39, 124.001f); 3451 path2.cubicTo(188.201f, 117.601f, 174.801f, 93, 39, 124.001f);
3465 path2.close(); 3452 path2.close();
3466 3453
3467 testPathOpCheck(reporter, path1, path2, kUnion_PathOp, filename, FLAGS_runFa il); 3454 testPathOp(reporter, path1, path2, kUnion_PathOp, filename);
3468 } 3455 }
3469 3456
3470 static void issue2808(skiatest::Reporter* reporter, const char* filename) { 3457 static void issue2808(skiatest::Reporter* reporter, const char* filename) {
3471 SkPath path1, path2; 3458 SkPath path1, path2;
3472 3459
3473 path1.moveTo(509.20300293f, 385.601989746f); 3460 path1.moveTo(509.20300293f, 385.601989746f);
3474 path1.quadTo(509.20300293f, 415.68838501f, 487.928710938f, 436.96270752f ); 3461 path1.quadTo(509.20300293f, 415.68838501f, 487.928710938f, 436.96270752f );
3475 path1.quadTo(466.654388428f, 458.236999512f, 436.567993164f, 458.2369995 12f); 3462 path1.quadTo(466.654388428f, 458.236999512f, 436.567993164f, 458.2369995 12f);
3476 path1.quadTo(406.4815979f, 458.236999512f, 385.207275391f, 436.96270752f ); 3463 path1.quadTo(406.4815979f, 458.236999512f, 385.207275391f, 436.96270752f );
3477 path1.quadTo(363.932983398f, 415.68838501f, 363.932983398f, 385.60198974 6f); 3464 path1.quadTo(363.932983398f, 415.68838501f, 363.932983398f, 385.60198974 6f);
(...skipping 24 matching lines...) Expand all
3502 path.cubicTo(3,4, 2,1, 5,3); 3489 path.cubicTo(3,4, 2,1, 5,3);
3503 path.close(); 3490 path.close();
3504 pathB.setFillType(SkPath::kWinding_FillType); 3491 pathB.setFillType(SkPath::kWinding_FillType);
3505 pathB.moveTo(1,2); 3492 pathB.moveTo(1,2);
3506 pathB.cubicTo(3,5, 1,0, 4,3); 3493 pathB.cubicTo(3,5, 1,0, 4,3);
3507 pathB.close(); 3494 pathB.close();
3508 SkPath path2(path); 3495 SkPath path2(path);
3509 testPathOp(reporter, path, pathB, kDifference_PathOp, filename); 3496 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3510 } 3497 }
3511 3498
3499 static void testRect1(skiatest::Reporter* reporter, const char* filename) {
3500 SkPath path, path2;
3501 path.addRect(0, 0, 60, 60, SkPath::kCCW_Direction);
3502 path.addRect(30, 20, 50, 50, SkPath::kCCW_Direction);
3503 path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction);
3504 // path.addRect(32, 24, 36, 41, SkPath::kCCW_Direction);
3505 testPathOp(reporter, path, path2, kUnion_PathOp, filename);
3506 }
3507
3508 static void testRect2(skiatest::Reporter* reporter, const char* filename) {
3509 SkPath path, pathB;
3510 path.setFillType(SkPath::kWinding_FillType);
3511 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
3512 path.addRect(4, 4, 5, 5, SkPath::kCW_Direction);
3513 pathB.setFillType(SkPath::kEvenOdd_FillType);
3514 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3515 pathB.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
3516 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3517 }
3518
3519 static void cubicOp116(skiatest::Reporter* reporter, const char* filename) {
3520 SkPath path, pathB;
3521 path.setFillType(SkPath::kWinding_FillType);
3522 path.moveTo(0,1);
3523 path.cubicTo(4,6, 2,0, 2,0);
3524 path.close();
3525 pathB.setFillType(SkPath::kWinding_FillType);
3526 pathB.moveTo(0,2);
3527 pathB.cubicTo(0,2, 1,0, 6,4);
3528 pathB.close();
3529 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3530 }
3531
3532 static void cubicOp117(skiatest::Reporter* reporter, const char* filename) {
3533 SkPath path, pathB;
3534 path.setFillType(SkPath::kWinding_FillType);
3535 path.moveTo(0,1);
3536 path.cubicTo(4,5, 6,0, 1,0);
3537 path.close();
3538 pathB.setFillType(SkPath::kWinding_FillType);
3539 pathB.moveTo(0,6);
3540 pathB.cubicTo(0,1, 1,0, 5,4);
3541 pathB.close();
3542 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3543 }
3544
3545 static void cubicOp118(skiatest::Reporter* reporter, const char* filename) {
3546 SkPath path, pathB;
3547 path.setFillType(SkPath::kWinding_FillType);
3548 path.moveTo(0,1);
3549 path.cubicTo(4,6, 5,1, 6,2);
3550 path.close();
3551 pathB.setFillType(SkPath::kWinding_FillType);
3552 pathB.moveTo(1,5);
3553 pathB.cubicTo(2,6, 1,0, 6,4);
3554 pathB.close();
3555 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3556 }
3557
3558 static void loop1(skiatest::Reporter* reporter, const char* filename) {
3559 SkPath path, pathB;
3560 path.moveTo(0,1);
3561 path.cubicTo(1,5, -5.66666651f,3.33333349f, 8.83333302f,2.33333349f);
3562 path.close();
3563 pathB.moveTo(1,5);
3564 pathB.cubicTo(-5.66666651f,3.33333349f, 8.83333302f,2.33333349f, 0,1);
3565 pathB.close();
3566 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3567 }
3568
3569 #include "SkPathOpsCubic.h"
3570
3571 static void loop1asQuad(skiatest::Reporter* reporter, const char* filename) {
3572 SkDCubic c1 = {{{0,1}, {1,5}, {-5.66666651f,3.33333349f}, {8.83333302f,2.333 33349f}}};
3573 SkDCubic c2 = {{{1,5}, {-5.66666651f,3.33333349f}, {8.83333302f,2.33333349f} , {0,1}}};
3574 double c1InflectionTs[2], c2InflectionTs[2];
3575 SkDEBUGCODE(int c1InfTCount =) c1.findInflections(c1InflectionTs);
3576 SkASSERT(c1InfTCount == 2);
3577 SkDEBUGCODE(int c2InfTCount =) c2.findInflections(c2InflectionTs);
3578 SkASSERT(c2InfTCount == 1);
3579 SkASSERT(c1InflectionTs[0] > c1InflectionTs[1]);
3580 SkDCubicPair c1pair = c1.chopAt(c1InflectionTs[0]);
3581 SkDCubicPair c1apair = c1pair.first().chopAt(c1InflectionTs[1]);
3582 SkDCubicPair c2pair = c2.chopAt(c2InflectionTs[0]);
3583 SkDQuad q1[2] = { c1pair.first().toQuad(), c1pair.second().toQuad() };
3584 SkDQuad q1a[2] = { c1apair.first().toQuad(), c1apair.second().toQuad() };
3585 SkDQuad q2[2] = { c2pair.first().toQuad(), c2pair.second().toQuad() };
3586 SkPath path, pathB;
3587 path.moveTo(q1a[0].fPts[0].asSkPoint());
3588 path.quadTo(q1a[0].fPts[1].asSkPoint(), q1a[0].fPts[2].asSkPoint());
3589 path.quadTo(q1a[1].fPts[1].asSkPoint(), q1a[1].fPts[2].asSkPoint());
3590 path.quadTo(q1[1].fPts[1].asSkPoint(), q1[1].fPts[2].asSkPoint());
3591 path.close();
3592 pathB.moveTo(q2[0].fPts[0].asSkPoint());
3593 pathB.quadTo(q2[0].fPts[1].asSkPoint(), q2[0].fPts[2].asSkPoint());
3594 pathB.quadTo(q2[1].fPts[1].asSkPoint(), q2[1].fPts[2].asSkPoint());
3595 pathB.close();
3596 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3597 }
3598
3599 static void loop2(skiatest::Reporter* reporter, const char* filename) {
3600 SkPath path, pathB;
3601 path.moveTo(0,1);
3602 path.cubicTo(3,4, 3.f,4.f, 4.5f,1.5f);
3603 path.close();
3604 pathB.moveTo(3,4);
3605 pathB.cubicTo(3.f,4.f, 4.5f,1.5f, 0,1);
3606 pathB.close();
3607 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3608 }
3609
3610 static void loop3(skiatest::Reporter* reporter, const char* filename) {
3611 SkPath path, pathB;
3612 path.moveTo(0,1);
3613 path.cubicTo(3,5, -3.66666651f,0, 10.5f,-1.66666651f);
3614 path.close();
3615 pathB.moveTo(3,5);
3616 pathB.cubicTo(-3.66666651f,0, 10.5f,-1.66666651f, 0,1);
3617 pathB.close();
3618 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3619 }
3620
3621 static void loop4(skiatest::Reporter* reporter, const char* filename) {
3622 SkPath path, pathB;
3623 path.moveTo(0,5);
3624 path.cubicTo(1,5, 1,4, 0.833333313f,3);
3625 path.close();
3626 pathB.moveTo(1,5);
3627 pathB.cubicTo(1,4, 0.833333313f,3, 0,5);
3628 pathB.close();
3629 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3630 }
3631
3632 #include "SkParsePath.h"
3633
3634 static void issue3517(skiatest::Reporter* reporter, const char* filename) {
3635 SkPath path, pathB;
3636
3637 const char str[] = "M31.35 57.75L31.35 57.75C31.9 57.7486 32.45 57.7948 33 5 7.7413C33.55 57.6878 34.1 57.5014 34.65 57.4291C35.2 57.3569 35.75 57.3223 36.3 57.3079C36.85 57.2935 37.4 57.3143 37.95 57.3428C38.5 57.3712 39.05 57.4112 39.6 57.4786C40.15 57.546 40.7 57.7029 41.25 57.7472C41.8 57.7916 42.35 57.7962 42.9 57.7445C43.45 57.6928 44 57.5345 44.55 57.4373C45.1 57.34 45.65 57.2115 46.2 57 .1611C46.75 57.1107 47.3 57.1371 47.85 57.1349C48.4 57.1327 48.95 57.144 49.5 57 .1478C50.05 57.1516 50.6 57.1553 51.15 57.1579C51.7 57.1605 52.25 57.1601 52.8 5 7.1634C53.35 57.1667 53.9 57.1731 54.45 57.1776C55 57.182 55.55 57.1916 56.1 57. 19C56.65 57.1884 57.2 57.178 57.75 57.168C58.3 57.158 58.85 57.1355 59.4 57.1299 C59.95 57.1243 60.5 57.1338 61.05 57.1345C61.6 57.1352 62.15 57.124 62.7 57.134C 63.25 57.1441 63.8 57.1731 64.35 57.195C64.9 57.2169 65.45 57.2532 66 57.2655C66 .55 57.2778 67.1 57.2647 67.65 57.2687C68.2 57.2728 68.75 57.267 69.3 57.2896C69 .85 57.3122 70.4 57.371 70.95 57.4044C71.5 57.4377 72.05 57.4668 72.6 57.4896C73 .15 57.5123 73.7 57.545 74.25 57.5408C74.8 57.5365 75.35 57.5068 75.9 57.4641C76 .45 57.4213 77 57.3244 77.55 57.2842C78.1 57.244 78.65 57.2163 79.2 57.2228C79.7 5 57.2293 80.3 57.29 80.85 57.3232C81.4 57.3563 81.95 57.396 82.5 57.4219C83.05 57.4478 83.6 57.4637 84.15 57.4787C84.7 57.4937 85.25 57.5011 85.8 57.5121C86.35 57.523 86.9 57.5411 87.45 57.5444C88 57.5477 88.55 57.5663 89.1 57.5318C89.65 5 7.4972 90.2 57.3126 90.75 57.337C91.3 57.3613 91.85 57.6088 92.4 57.6776C92.95 5 7.7465 93.5 57.7379 94.05 57.75C94.6 57.7621 95.15 57.75 95.7 57.75L95.7 57.75L3 1.35 57.75Z";
3638 SkParsePath::FromSVGString(str, &path);
3639
3640 const char strB[] = "M31.35 57.75L31.35 57.75C31.9 57.7514 32.45 57.7052 33 57.7587C33.55 57.8122 34.1 57.9986 34.65 58.0709C35.2 58.1431 35.75 58.1777 36.3 58.1921C36.85 58.2065 37.4 58.1857 37.95 58.1572C38.5 58.1288 39.05 58.0888 39. 6 58.0214C40.15 57.954 40.7 57.7971 41.25 57.7528C41.8 57.7084 42.35 57.7038 42. 9 57.7555C43.45 57.8072 44 57.9655 44.55 58.0627C45.1 58.16 45.65 58.2885 46.2 5 8.3389C46.75 58.3893 47.3 58.3629 47.85 58.3651C48.4 58.3673 48.95 58.356 49.5 5 8.3522C50.05 58.3484 50.6 58.3447 51.15 58.3421C51.7 58.3395 52.25 58.3399 52.8 58.3366C53.35 58.3333 53.9 58.3269 54.45 58.3224C55 58.318 55.55 58.3084 56.1 58 .31C56.65 58.3116 57.2 58.322 57.75 58.332C58.3 58.342 58.85 58.3645 59.4 58.370 1C59.95 58.3757 60.5 58.3662 61.05 58.3655C61.6 58.3648 62.15 58.376 62.7 58.366 C63.25 58.3559 63.8 58.3269 64.35 58.305C64.9 58.2831 65.45 58.2468 66 58.2345C6 6.55 58.2222 67.1 58.2353 67.65 58.2313C68.2 58.2272 68.75 58.233 69.3 58.2104C6 9.85 58.1878 70.4 58.129 70.95 58.0956C71.5 58.0623 72.05 58.0332 72.6 58.0104C7 3.15 57.9877 73.7 57.955 74.25 57.9592C74.8 57.9635 75.35 57.9932 75.9 58.0359C7 6.45 58.0787 77 58.1756 77.55 58.2158C78.1 58.256 78.65 58.2837 79.2 58.2772C79. 75 58.2707 80.3 58.21 80.85 58.1768C81.4 58.1437 81.95 58.104 82.5 58.0781C83.05 58.0522 83.6 58.0363 84.15 58.0213C84.7 58.0063 85.25 57.9989 85.8 57.9879C86.3 5 57.977 86.9 57.9589 87.45 57.9556C88 57.9523 88.55 57.9337 89.1 57.9682C89.65 58.0028 90.2 58.1874 90.75 58.163C91.3 58.1387 91.85 57.8912 92.4 57.8224C92.95 57.7535 93.5 57.7621 94.05 57.75C94.6 57.7379 95.15 57.75 95.7 57.75L95.7 57.75L 31.35 57.75Z";
3641 SkParsePath::FromSVGString(strB, &pathB);
3642 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
3643 }
3644
3645 static void cubicOp119(skiatest::Reporter* reporter, const char* filename) {
3646 SkPath path, pathB;
3647 path.setFillType(SkPath::kWinding_FillType);
3648 path.moveTo(0,1);
3649 path.cubicTo(3,5, 2,1, 3,1);
3650 path.close();
3651 pathB.setFillType(SkPath::kWinding_FillType);
3652 pathB.moveTo(1,2);
3653 pathB.cubicTo(1,3, 1,0, 5,3);
3654 pathB.close();
3655 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3656 }
3657
3658 static void cubicOp120(skiatest::Reporter* reporter, const char* filename) {
3659 SkPath path, pathB;
3660 path.setFillType(SkPath::kWinding_FillType);
3661 path.moveTo(0,1);
3662 path.cubicTo(2,4, 2,1, 4,0);
3663 path.close();
3664 pathB.setFillType(SkPath::kWinding_FillType);
3665 pathB.moveTo(1,2);
3666 pathB.cubicTo(0,4, 1,0, 4,2);
3667 pathB.close();
3668 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3669 }
3670
3671 static void cubicOp121(skiatest::Reporter* reporter, const char* filename) {
3672 SkPath path, pathB;
3673 path.setFillType(SkPath::kWinding_FillType);
3674 path.moveTo(0,1);
3675 path.cubicTo(3,4, 3,2, 4,3);
3676 path.close();
3677 pathB.setFillType(SkPath::kWinding_FillType);
3678 pathB.moveTo(2,3);
3679 pathB.cubicTo(3,4, 1,0, 4,3);
3680 pathB.close();
3681 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3682 }
3683
3684 // FIXME : haven't debugged this failure yet
3685 static void cubicOp122(skiatest::Reporter* reporter, const char* filename) {
3686 SkPath path, pathB;
3687 path.setFillType(SkPath::kWinding_FillType);
3688 path.moveTo(0,1);
3689 path.cubicTo(3,5, 4,1, 4,0);
3690 path.close();
3691 pathB.setFillType(SkPath::kWinding_FillType);
3692 pathB.moveTo(1,4);
3693 pathB.cubicTo(0,4, 1,0, 5,3);
3694 pathB.close();
3695 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3696 }
3697
3698 static void cubicOp123(skiatest::Reporter* reporter, const char* filename) {
3699 SkPath path, pathB;
3700 path.setFillType(SkPath::kWinding_FillType);
3701 path.moveTo(0,1);
3702 path.cubicTo(1,5, 2,0, 6,0);
3703 path.close();
3704 pathB.setFillType(SkPath::kWinding_FillType);
3705 pathB.moveTo(0,2);
3706 pathB.cubicTo(0,6, 1,0, 5,1);
3707 pathB.close();
3708 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3709 }
3710
3711 static void loop5(skiatest::Reporter* reporter, const char* filename) {
3712 SkPath path, pathB;
3713 path.moveTo(0,2);
3714 path.cubicTo(1,2, 1,1.66666663f, 0.833333313f,1.33333325f);
3715 path.close();
3716 pathB.moveTo(1,2);
3717 pathB.cubicTo(1,1.66666663f, 0.833333313f,1.33333325f, 0,2);
3718 pathB.close();
3719 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3720 }
3721
3722 static void loop6(skiatest::Reporter* reporter, const char* filename) {
3723 SkPath path, pathB;
3724 path.moveTo(0,1);
3725 path.cubicTo(1,3, -1.66666675f,1.66666663f, 4.16666651f,1.00000012f);
3726 path.close();
3727 pathB.moveTo(1,3);
3728 pathB.cubicTo(-1.66666675f,1.66666663f, 4.16666651f,1.00000012f, 0,1);
3729 pathB.close();
3730 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3731 }
3732
3733 static void cubicOp124(skiatest::Reporter* reporter, const char* filename) {
3734 SkPath path, pathB;
3735 path.setFillType(SkPath::kWinding_FillType);
3736 path.moveTo(0,1);
3737 path.cubicTo(1,5, 6,0, 3,0);
3738 path.close();
3739 pathB.setFillType(SkPath::kWinding_FillType);
3740 pathB.moveTo(0,6);
3741 pathB.cubicTo(0,3, 1,0, 5,1);
3742 pathB.close();
3743 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3744 }
3745
3746 static void cubicOp125(skiatest::Reporter* reporter, const char* filename) {
3747 SkPath path, pathB;
3748 path.setFillType(SkPath::kWinding_FillType);
3749 path.moveTo(0,1);
3750 path.cubicTo(3,6, 3,1, 6,2);
3751 path.close();
3752 pathB.setFillType(SkPath::kWinding_FillType);
3753 pathB.moveTo(1,3);
3754 pathB.cubicTo(2,6, 1,0, 6,3);
3755 pathB.close();
3756 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3757 }
3758
3759 static void cubicOp126(skiatest::Reporter* reporter, const char* filename) {
3760 SkPath path, pathB;
3761 path.setFillType(SkPath::kWinding_FillType);
3762 path.moveTo(0,1);
3763 path.cubicTo(0,3, 6,0, 2,1);
3764 path.close();
3765 pathB.setFillType(SkPath::kWinding_FillType);
3766 pathB.moveTo(0,6);
3767 pathB.cubicTo(1,2, 1,0, 3,0);
3768 pathB.close();
3769 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3770 }
3771
3772 static void cubicOp127(skiatest::Reporter* reporter, const char* filename) {
3773 SkPath path, pathB;
3774 path.setFillType(SkPath::kWinding_FillType);
3775 path.moveTo(0,1);
3776 path.cubicTo(1,5, 6,0, 3,0);
3777 path.close();
3778 pathB.setFillType(SkPath::kWinding_FillType);
3779 pathB.moveTo(0,6);
3780 pathB.cubicTo(0,3, 1,0, 5,1);
3781 pathB.close();
3782 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3783 }
3784
3785 static void cubicOp128(skiatest::Reporter* reporter, const char* filename) {
3786 SkPath path, pathB;
3787 path.setFillType(SkPath::kWinding_FillType);
3788 path.moveTo(0,1);
3789 path.cubicTo(0,3, 3,2, 5,2);
3790 path.close();
3791 pathB.setFillType(SkPath::kWinding_FillType);
3792 pathB.moveTo(2,3);
3793 pathB.cubicTo(2,5, 1,0, 3,0);
3794 pathB.close();
3795 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3796 }
3797
3798 static void (*skipTest)(skiatest::Reporter* , const char* filename) = 0;
3512 static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0; 3799 static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0;
3513 static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0; 3800 static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0;
3514 3801
3515 static struct TestDesc tests[] = { 3802 static struct TestDesc tests[] = {
3803 TEST(cubicOp128),
3804 TEST(cubicOp127),
3805 TEST(cubicOp126),
3806 TEST(cubicOp125),
3807 TEST(cubicOp124),
3808 TEST(loop6),
3809 TEST(loop5),
3810 TEST(cubicOp123),
3811 TEST(cubicOp122),
3812 TEST(cubicOp121),
3813 TEST(cubicOp120),
3814 TEST(cubicOp119),
3815 TEST(loop4),
3816 TEST(loop3),
3817 TEST(loop2),
3818 TEST(loop1asQuad),
3819 TEST(loop1),
3820 TEST(issue3517),
3821 TEST(cubicOp118),
3822 TEST(cubicOp117),
3823 TEST(cubicOp116),
3824 TEST(testRect2),
3825 TEST(testRect1),
3516 TEST(cubicOp115), 3826 TEST(cubicOp115),
3517 TEST(issue2753), // FIXME: pair of cubics miss intersection 3827 TEST(issue2753),
3518 TEST(cubicOp114), // FIXME: curve with inflection is ordered the wrong way 3828 TEST(cubicOp114), // FIXME: curve with inflection is ordered the wrong way
3519 TEST(issue2808), 3829 TEST(issue2808),
3520 TEST(cubicOp114asQuad), 3830 TEST(cubicOp114asQuad),
3521 TEST(rects4), 3831 TEST(rects4),
3522 TEST(rects3), 3832 TEST(rects3),
3523 TEST(rects2), 3833 TEST(rects2),
3524 TEST(rects1), 3834 TEST(rects1),
3525 TEST(issue2540), 3835 TEST(issue2540),
3526 TEST(issue2504), 3836 TEST(issue2504),
3527 TEST(kari1), 3837 TEST(kari1),
3528 TEST(quadOp10i), 3838 TEST(quadOp10i),
3529 TEST(cubicOp113), 3839 TEST(cubicOp113),
3530 // fails because a cubic/quadratic intersection is missed
3531 // the internal quad/quad is far enough away from the real cubic/quad that i t is rejected
3532 TEST(skpcarrot_is24), 3840 TEST(skpcarrot_is24),
3533 TEST(issue1417), 3841 TEST(issue1417),
3534 TEST(cubicOp112), 3842 TEST(cubicOp112),
3535 TEST(skpadspert_net23), 3843 TEST(skpadspert_net23),
3536 TEST(skpadspert_de11), 3844 TEST(skpadspert_de11),
3537 TEST(findFirst1), 3845 TEST(findFirst1),
3538 TEST(xOp2i), 3846 TEST(xOp2i),
3539 TEST(xOp3i), 3847 TEST(xOp3i),
3540 TEST(xOp1u), 3848 TEST(xOp1u),
3541 TEST(xOp1i), 3849 TEST(xOp1i),
3542 TEST(cubicOp111), 3850 TEST(cubicOp111),
3543 TEST(cubicOp110), 3851 TEST(cubicOp110),
3544 TEST(cubicOp109), 3852 TEST(cubicOp109),
3545 TEST(cubicOp108), 3853 TEST(cubicOp108),
3546 TEST(cubicOp107), 3854 TEST(cubicOp107),
3547 TEST(cubicOp106), 3855 TEST(cubicOp106),
3548 TEST(cubicOp105), 3856 TEST(cubicOp105),
3549 TEST(cubicOp104), 3857 TEST(cubicOp104),
3550 TEST(cubicOp103), 3858 TEST(cubicOp103),
3551 TEST(cubicOp102), 3859 TEST(cubicOp102),
3552 TEST(cubicOp101), 3860 TEST(cubicOp101),
3553 TEST(cubicOp100), 3861 TEST(cubicOp100),
3554 TEST(cubicOp99), 3862 TEST(cubicOp99),
3555 TEST(issue1435), 3863 TEST(issue1435),
3556 TEST(cubicOp98x), 3864 TEST(cubicOp98x),
3557 TEST(cubicOp97x), 3865 TEST(cubicOp97x),
3558 TEST(skpcarpetplanet_ru22), // cubic/cubic intersect detects unwanted coinc idence 3866 TEST(skpcarpetplanet_ru22),
3559 TEST(cubicOp96d), 3867 TEST(cubicOp96d),
3560 TEST(cubicOp95u), 3868 TEST(cubicOp95u),
3561 TEST(skpadbox_lt15), 3869 TEST(skpadbox_lt15),
3562 TEST(skpagentxsites_com55), 3870 TEST(skpagentxsites_com55),
3563 TEST(skpadventistmission_org572), 3871 TEST(skpadventistmission_org572),
3564 TEST(skpadoption_org196), 3872 TEST(skpadoption_org196),
3565 TEST(skpbambootheme_com12), 3873 TEST(skpbambootheme_com12),
3566 TEST(skpbakosoft_com10), 3874 TEST(skpbakosoft_com10),
3567 TEST(skpakmmos_ru100), 3875 TEST(skpakmmos_ru100),
3568 TEST(skpbangalorenest_com4), 3876 TEST(skpbangalorenest_com4),
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
3740 4048
3741 static bool runSubTests = false; 4049 static bool runSubTests = false;
3742 static bool runSubTestsFirst = false; 4050 static bool runSubTestsFirst = false;
3743 static bool runReverse = false; 4051 static bool runReverse = false;
3744 4052
3745 DEF_TEST(PathOpsOp, reporter) { 4053 DEF_TEST(PathOpsOp, reporter) {
3746 #if DEBUG_SHOW_TEST_NAME 4054 #if DEBUG_SHOW_TEST_NAME
3747 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); 4055 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
3748 #endif 4056 #endif
3749 if (runSubTests && runSubTestsFirst) { 4057 if (runSubTests && runSubTestsFirst) {
3750 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run Reverse); 4058 RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTes t, runReverse);
3751 } 4059 }
3752 RunTestSet(reporter, tests, testCount, firstTest, stopTest, runReverse); 4060 RunTestSet(reporter, tests, testCount, firstTest, skipTest, stopTest, runRev erse);
3753 if (runSubTests && !runSubTestsFirst) { 4061 if (runSubTests && !runSubTestsFirst) {
3754 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run Reverse); 4062 RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTes t, runReverse);
3755 } 4063 }
3756 } 4064 }
3757 4065
3758 static void bufferOverflow(skiatest::Reporter* reporter, const char* filename) { 4066 static void bufferOverflow(skiatest::Reporter* reporter, const char* filename) {
3759 SkPath path; 4067 SkPath path;
3760 path.addRect(0,0, 300,170141183460469231731687303715884105728.f); 4068 path.addRect(0,0, 300,170141183460469231731687303715884105728.f);
3761 SkPath pathB; 4069 SkPath pathB;
3762 pathB.addRect(0,0, 300,16); 4070 pathB.addRect(0,0, 300,16);
3763 testPathFailOp(reporter, path, pathB, kUnion_PathOp, filename); 4071 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
3764 } 4072 }
3765 4073
3766 // m 100,0 60,170 -160,-110 200,0 -170,11000000000 z 4074 // m 100,0 60,170 -160,-110 200,0 -170,11000000000 z
3767 static void fuzz433(skiatest::Reporter* reporter, const char* filename) { 4075 static void fuzz433(skiatest::Reporter* reporter, const char* filename) {
3768 SkPath path1, path2; 4076 SkPath path1, path2;
3769 path1.moveTo(100,0); 4077 path1.moveTo(100,0);
3770 path1.lineTo(60,170); 4078 path1.lineTo(60,170);
3771 path1.lineTo(-160,-110); 4079 path1.lineTo(-160,-110);
3772 path1.lineTo(200,0); 4080 path1.lineTo(200,0);
3773 path1.lineTo(-170,11000000000.0f); 4081 path1.lineTo(-170,11000000000.0f);
3774 path1.close(); 4082 path1.close();
3775 4083
3776 path2.moveTo(100 + 20,0 + 20); 4084 path2.moveTo(100 + 20,0 + 20);
3777 path2.lineTo(60 + 20,170 + 20); 4085 path2.lineTo(60 + 20,170 + 20);
3778 path2.lineTo(-160 + 20,-110 + 20); 4086 path2.lineTo(-160 + 20,-110 + 20);
3779 path2.lineTo(200 + 20,0 + 20); 4087 path2.lineTo(200 + 20,0 + 20);
3780 path2.lineTo(-170 + 20,11000000000.0f + 20); 4088 path2.lineTo(-170 + 20,11000000000.0f + 20);
3781 path2.close(); 4089 path2.close();
3782 4090
3783 testPathFailOp(reporter, path1, path2, kIntersect_PathOp, filename); 4091 testPathOpCheck(reporter, path1, path2, kIntersect_PathOp, filename, FLAGS_r unFail);
3784 } 4092 }
3785 4093
3786 static void fuzz433b(skiatest::Reporter* reporter, const char* filename) { 4094 static void fuzz433b(skiatest::Reporter* reporter, const char* filename) {
3787 SkPath path1, path2; 4095 SkPath path1, path2;
3788 path1.setFillType(SkPath::kEvenOdd_FillType); 4096 path1.setFillType(SkPath::kEvenOdd_FillType);
3789 path1.moveTo(140, 40); 4097 path1.moveTo(140, 40);
3790 path1.lineTo(200, 210); 4098 path1.lineTo(200, 210);
3791 path1.lineTo(40, 100); 4099 path1.lineTo(40, 100);
3792 path1.lineTo(240, 100); 4100 path1.lineTo(240, 100);
3793 path1.lineTo(70, 1.1e+10f); 4101 path1.lineTo(70, 1.1e+10f);
3794 path1.lineTo(140, 40); 4102 path1.lineTo(140, 40);
3795 path1.close(); 4103 path1.close();
3796 4104
3797 path1.setFillType(SkPath::kWinding_FillType); 4105 path1.setFillType(SkPath::kWinding_FillType);
3798 path2.moveTo(190, 60); 4106 path2.moveTo(190, 60);
3799 path2.lineTo(250, 230); 4107 path2.lineTo(250, 230);
3800 path2.lineTo(90, 120); 4108 path2.lineTo(90, 120);
3801 path2.lineTo(290, 120); 4109 path2.lineTo(290, 120);
3802 path2.lineTo(120, 1.1e+10f); 4110 path2.lineTo(120, 1.1e+10f);
3803 path2.lineTo(190, 60); 4111 path2.lineTo(190, 60);
3804 path2.close(); 4112 path2.close();
3805 4113
3806 testPathFailOp(reporter, path1, path2, kUnion_PathOp, filename); 4114 testPathOpCheck(reporter, path1, path2, kUnion_PathOp, filename, FLAGS_runFa il);
3807 } 4115 }
3808 4116
3809 static void fuzz487a(skiatest::Reporter* reporter, const char* filename) { 4117 static void fuzz487a(skiatest::Reporter* reporter, const char* filename) {
3810 SkPath path; 4118 SkPath path;
3811 path.setFillType((SkPath::FillType) 0); 4119 path.setFillType((SkPath::FillType) 0);
3812 path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000)); 4120 path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
3813 path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000)); 4121 path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000));
3814 path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x429a6666), SkBits2Float(0x 42f9999a), SkBits2Float(0x4275999a), SkBits2Float(0x42d70001), SkBits2Float(0x42 633333)); 4122 path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x429a6666), SkBits2Float(0x 42f9999a), SkBits2Float(0x4275999a), SkBits2Float(0x42d70001), SkBits2Float(0x42 633333));
3815 path.lineTo(SkBits2Float(0x42e90001), SkBits2Float(0x41b8cccc)); 4123 path.lineTo(SkBits2Float(0x42e90001), SkBits2Float(0x41b8cccc));
3816 path.cubicTo(SkBits2Float(0x42dc6667), SkBits2Float(0x41ab3332), SkBits2Float(0x 42cf3334), SkBits2Float(0x41a3ffff), SkBits2Float(0x42c20001), SkBits2Float(0x41 a3ffff)); 4124 path.cubicTo(SkBits2Float(0x42dc6667), SkBits2Float(0x41ab3332), SkBits2Float(0x 42cf3334), SkBits2Float(0x41a3ffff), SkBits2Float(0x42c20001), SkBits2Float(0x41 a3ffff));
(...skipping 25 matching lines...) Expand all
3842 path.cubicTo(SkBits2Float(0x4272cccc), SkBits2Float(0x4303199a), SkBits2Float(0x 423d3332), SkBits2Float(0x430de667), SkBits2Float(0x422d9999), SkBits2Float(0x43 1cb334)); 4150 path.cubicTo(SkBits2Float(0x4272cccc), SkBits2Float(0x4303199a), SkBits2Float(0x 423d3332), SkBits2Float(0x430de667), SkBits2Float(0x422d9999), SkBits2Float(0x43 1cb334));
3843 path.lineTo(SkBits2Float(0x7086a1dc), SkBits2Float(0x42eecccd)); 4151 path.lineTo(SkBits2Float(0x7086a1dc), SkBits2Float(0x42eecccd));
3844 path.lineTo(SkBits2Float(0x41eb3333), SkBits2Float(0xc12ccccd)); 4152 path.lineTo(SkBits2Float(0x41eb3333), SkBits2Float(0xc12ccccd));
3845 path.lineTo(SkBits2Float(0x42053333), SkBits2Float(0xc1cccccd)); 4153 path.lineTo(SkBits2Float(0x42053333), SkBits2Float(0xc1cccccd));
3846 path.lineTo(SkBits2Float(0x42780000), SkBits2Float(0xc18f3334)); 4154 path.lineTo(SkBits2Float(0x42780000), SkBits2Float(0xc18f3334));
3847 path.cubicTo(SkBits2Float(0x43206666), SkBits2Float(0x43134ccd), SkBits2Float(0x 43213333), SkBits2Float(0x430db333), SkBits2Float(0x43213333), SkBits2Float(0x43 080000)); 4155 path.cubicTo(SkBits2Float(0x43206666), SkBits2Float(0x43134ccd), SkBits2Float(0x 43213333), SkBits2Float(0x430db333), SkBits2Float(0x43213333), SkBits2Float(0x43 080000));
3848 path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000)); 4156 path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
3849 path.close(); 4157 path.close();
3850 4158
3851 SkPath path2(path); 4159 SkPath path2(path);
3852 testPathFailOp(reporter, path1, path2, (SkPathOp) 2, filename); 4160 testPathOpCheck(reporter, path1, path2, (SkPathOp) 2, filename, FLAGS_runFai l);
3853 } 4161 }
3854 4162
3855 static void fuzz487b(skiatest::Reporter* reporter, const char* filename) { 4163 static void fuzz487b(skiatest::Reporter* reporter, const char* filename) {
3856 SkPath path; 4164 SkPath path;
3857 path.setFillType((SkPath::FillType) 0); 4165 path.setFillType((SkPath::FillType) 0);
3858 path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000)); 4166 path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
3859 path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000)); 4167 path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000));
3860 path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x429a6666), SkBits2Float(0x 42f9999a), SkBits2Float(0x4275999a), SkBits2Float(0x42d70001), SkBits2Float(0x42 633333)); 4168 path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x429a6666), SkBits2Float(0x 42f9999a), SkBits2Float(0x4275999a), SkBits2Float(0x42d70001), SkBits2Float(0x42 633333));
3861 path.lineTo(SkBits2Float(0x42e90001), SkBits2Float(0x41b8cccc)); 4169 path.lineTo(SkBits2Float(0x42e90001), SkBits2Float(0x41b8cccc));
3862 path.cubicTo(SkBits2Float(0x42dc6667), SkBits2Float(0x41ab3332), SkBits2Float(0x 42cf3334), SkBits2Float(0x41a3ffff), SkBits2Float(0x42c20001), SkBits2Float(0x41 a3ffff)); 4170 path.cubicTo(SkBits2Float(0x42dc6667), SkBits2Float(0x41ab3332), SkBits2Float(0x 42cf3334), SkBits2Float(0x41a3ffff), SkBits2Float(0x42c20001), SkBits2Float(0x41 a3ffff));
(...skipping 25 matching lines...) Expand all
3888 path.cubicTo(SkBits2Float(0x4272cccc), SkBits2Float(0x4303199a), SkBits2Float(0x 423d3332), SkBits2Float(0x430de667), SkBits2Float(0x422d9999), SkBits2Float(0x43 1cb334)); 4196 path.cubicTo(SkBits2Float(0x4272cccc), SkBits2Float(0x4303199a), SkBits2Float(0x 423d3332), SkBits2Float(0x430de667), SkBits2Float(0x422d9999), SkBits2Float(0x43 1cb334));
3889 path.lineTo(SkBits2Float(0x7086a1dc), SkBits2Float(0x42eecccd)); 4197 path.lineTo(SkBits2Float(0x7086a1dc), SkBits2Float(0x42eecccd));
3890 path.lineTo(SkBits2Float(0x41eb3333), SkBits2Float(0xc12ccccd)); 4198 path.lineTo(SkBits2Float(0x41eb3333), SkBits2Float(0xc12ccccd));
3891 path.lineTo(SkBits2Float(0x42053333), SkBits2Float(0xc1cccccd)); 4199 path.lineTo(SkBits2Float(0x42053333), SkBits2Float(0xc1cccccd));
3892 path.lineTo(SkBits2Float(0x42780000), SkBits2Float(0xc18f3334)); 4200 path.lineTo(SkBits2Float(0x42780000), SkBits2Float(0xc18f3334));
3893 path.cubicTo(SkBits2Float(0x43206666), SkBits2Float(0x43134ccd), SkBits2Float(0x 43213333), SkBits2Float(0x430db333), SkBits2Float(0x43213333), SkBits2Float(0x43 080000)); 4201 path.cubicTo(SkBits2Float(0x43206666), SkBits2Float(0x43134ccd), SkBits2Float(0x 43213333), SkBits2Float(0x430db333), SkBits2Float(0x43213333), SkBits2Float(0x43 080000));
3894 path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000)); 4202 path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
3895 path.close(); 4203 path.close();
3896 4204
3897 SkPath path2(path); 4205 SkPath path2(path);
3898 testPathFailOp(reporter, path1, path2, (SkPathOp) 2, filename); 4206 testPathOpCheck(reporter, path1, path2, (SkPathOp) 2, filename, FLAGS_runFai l);
3899 } 4207 }
3900 4208
3901 static void fuzz714(skiatest::Reporter* reporter, const char* filename) { 4209 static void fuzz714(skiatest::Reporter* reporter, const char* filename) {
3902 SkPath path; 4210 SkPath path;
3903 path.setFillType((SkPath::FillType) 1); 4211 path.setFillType((SkPath::FillType) 1);
3904 path.moveTo(SkBits2Float(0x430c0000), SkBits2Float(0x42200000)); 4212 path.moveTo(SkBits2Float(0x430c0000), SkBits2Float(0x42200000));
3905 path.lineTo(SkBits2Float(0x43480000), SkBits2Float(0x43520000)); 4213 path.lineTo(SkBits2Float(0x43480000), SkBits2Float(0x43520000));
3906 path.lineTo(SkBits2Float(0x42200000), SkBits2Float(0x42c80000)); 4214 path.lineTo(SkBits2Float(0x42200000), SkBits2Float(0x42c80000));
3907 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x42c80000)); 4215 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x42c80000));
3908 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x43520000)); 4216 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x43520000));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
3955 TEST(fuzz433), 4263 TEST(fuzz433),
3956 TEST(bufferOverflow), 4264 TEST(bufferOverflow),
3957 }; 4265 };
3958 4266
3959 static const size_t failTestCount = SK_ARRAY_COUNT(failTests); 4267 static const size_t failTestCount = SK_ARRAY_COUNT(failTests);
3960 4268
3961 DEF_TEST(PathOpsFailOp, reporter) { 4269 DEF_TEST(PathOpsFailOp, reporter) {
3962 #if DEBUG_SHOW_TEST_NAME 4270 #if DEBUG_SHOW_TEST_NAME
3963 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); 4271 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
3964 #endif 4272 #endif
3965 RunTestSet(reporter, failTests, failTestCount, 0, 0, false); 4273 RunTestSet(reporter, failTests, failTestCount, NULL, NULL, NULL, false);
3966 } 4274 }
OLDNEW
« no previous file with comments | « tests/PathOpsOpLoopThreadedTest.cpp ('k') | tests/PathOpsQuadIntersectionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698