2 * Copyright 2012 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
7 #include "PathOpsExtendedTest.h"
8 #include "PathOpsTestCommon.h"
10 #define TEST(name) { name, #name }
12 static void cubicOp1d(skiatest::Reporter* reporter, const char* filename) {
14 path.setFillType(SkPath::kWinding_FillType);
16 path.cubicTo(0,2, 1,0, 1,0);
18 pathB.setFillType(SkPath::kWinding_FillType);
20 pathB.cubicTo(0,1, 1,0, 2,0);
22 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
25 static void cubicOp2d(skiatest::Reporter* reporter, const char* filename) {
27 path.setFillType(SkPath::kWinding_FillType);
29 path.cubicTo(0,1, 1,0, 1,0);
31 pathB.setFillType(SkPath::kWinding_FillType);
33 pathB.cubicTo(0,1, 2,0, 1,0);
35 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
38 static void cubicOp3d(skiatest::Reporter* reporter, const char* filename) {
40 path.setFillType(SkPath::kWinding_FillType);
42 path.cubicTo(2,3, 1,0, 1,0);
44 pathB.setFillType(SkPath::kWinding_FillType);
46 pathB.cubicTo(0,1, 1,0, 3,2);
48 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
51 static void cubicOp5d(skiatest::Reporter* reporter, const char* filename) {
53 path.setFillType(SkPath::kWinding_FillType);
55 path.cubicTo(0,2, 1,0, 2,0);
57 pathB.setFillType(SkPath::kWinding_FillType);
59 pathB.cubicTo(0,2, 1,0, 2,0);
61 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
64 static void cubicOp6d(skiatest::Reporter* reporter, const char* filename) {
66 path.setFillType(SkPath::kWinding_FillType);
68 path.cubicTo(0,6, 1,0, 3,0);
70 pathB.setFillType(SkPath::kWinding_FillType);
72 pathB.cubicTo(0,3, 1,0, 6,0);
74 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
77 static void cubicOp7d(skiatest::Reporter* reporter, const char* filename) {
79 path.setFillType(SkPath::kWinding_FillType);
81 path.cubicTo(3,4, 1,0, 3,0);
83 pathB.setFillType(SkPath::kWinding_FillType);
85 pathB.cubicTo(0,3, 1,0, 4,3);
87 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
90 static void cubicOp8d(skiatest::Reporter* reporter, const char* filename) {
92 path.setFillType(SkPath::kWinding_FillType);
94 path.cubicTo(0,5, 1,0, 4,0);
96 pathB.setFillType(SkPath::kWinding_FillType);
98 pathB.cubicTo(0,4, 1,0, 5,0);
100 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
103 static void cubicOp9d(skiatest::Reporter* reporter, const char* filename) {
105 path.setFillType(SkPath::kWinding_FillType);
107 path.cubicTo(1,6, 1,0, 2,1);
109 pathB.setFillType(SkPath::kWinding_FillType);
111 pathB.cubicTo(1,2, 1,0, 6,1);
113 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
116 static void quadOp9d(skiatest::Reporter* reporter, const char* filename) {
118 path.setFillType(SkPath::kWinding_FillType);
120 path.quadTo(1,6, 1.5f,1);
121 path.quadTo(1.5f,0.5f, 2,1);
123 pathB.setFillType(SkPath::kWinding_FillType);
125 pathB.quadTo(1,2, 1.4f,1);
126 pathB.quadTo(3,0.4f, 6,1);
128 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
131 static void lineOp9d(skiatest::Reporter* reporter, const char* filename) {
133 path.setFillType(SkPath::kWinding_FillType);
137 path.lineTo(1.8f,0.8f);
140 pathB.setFillType(SkPath::kWinding_FillType);
143 pathB.lineTo(1.4f,1);
144 pathB.lineTo(3,0.4f);
147 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
150 static void cubicOp1i(skiatest::Reporter* reporter, const char* filename) {
152 path.setFillType(SkPath::kWinding_FillType);
154 path.cubicTo(1,2, 1,0, 2,1);
156 pathB.setFillType(SkPath::kWinding_FillType);
158 pathB.cubicTo(1,2, 1,0, 2,1);
160 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
163 static void cubicOp10d(skiatest::Reporter* reporter, const char* filename) {
165 path.setFillType(SkPath::kWinding_FillType);
167 path.cubicTo(1,3, 1,0, 4,1);
169 pathB.setFillType(SkPath::kWinding_FillType);
171 pathB.cubicTo(1,4, 1,0, 3,1);
173 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
176 static void cubicOp11d(skiatest::Reporter* reporter, const char* filename) {
178 path.setFillType(SkPath::kWinding_FillType);
180 path.cubicTo(3,4, 1,0, 5,1);
182 pathB.setFillType(SkPath::kWinding_FillType);
184 pathB.cubicTo(1,5, 1,0, 4,3);
186 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
189 static void cubicOp12d(skiatest::Reporter* reporter, const char* filename) {
191 path.setFillType(SkPath::kWinding_FillType);
193 path.cubicTo(1,6, 1,0, 1,0);
195 pathB.setFillType(SkPath::kWinding_FillType);
197 pathB.cubicTo(0,1, 1,0, 6,1);
199 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
202 static void cubicOp13d(skiatest::Reporter* reporter, const char* filename) {
204 path.setFillType(SkPath::kWinding_FillType);
206 path.cubicTo(4,5, 1,0, 5,3);
208 pathB.setFillType(SkPath::kWinding_FillType);
210 pathB.cubicTo(3,5, 1,0, 5,4);
212 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
215 static void cubicOp14d(skiatest::Reporter* reporter, const char* filename) {
217 path.setFillType(SkPath::kWinding_FillType);
219 path.cubicTo(0,2, 2,0, 2,1);
221 pathB.setFillType(SkPath::kWinding_FillType);
223 pathB.cubicTo(1,2, 1,0, 2,0);
225 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
228 static void cubicOp15d(skiatest::Reporter* reporter, const char* filename) {
230 path.setFillType(SkPath::kWinding_FillType);
232 path.cubicTo(3,6, 2,0, 2,1);
234 pathB.setFillType(SkPath::kWinding_FillType);
236 pathB.cubicTo(1,2, 1,0, 6,3);
238 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
241 static void cubicOp16d(skiatest::Reporter* reporter, const char* filename) {
243 path.setFillType(SkPath::kWinding_FillType);
245 path.cubicTo(0,1, 3,0, 1,0);
247 pathB.setFillType(SkPath::kWinding_FillType);
249 pathB.cubicTo(0,1, 2,0, 1,0);
251 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
254 static void cubicOp17d(skiatest::Reporter* reporter, const char* filename) {
256 path.setFillType(SkPath::kWinding_FillType);
258 path.cubicTo(0,2, 4,0, 2,1);
260 pathB.setFillType(SkPath::kWinding_FillType);
262 pathB.cubicTo(1,2, 2,0, 2,0);
264 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
267 static void cubicOp18d(skiatest::Reporter* reporter, const char* filename) {
269 path.setFillType(SkPath::kWinding_FillType);
271 path.cubicTo(3,5, 2,0, 2,1);
273 pathB.setFillType(SkPath::kWinding_FillType);
275 pathB.cubicTo(1,2, 1,0, 5,3);
277 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
280 static void cubicOp19i(skiatest::Reporter* reporter, const char* filename) {
282 path.setFillType(SkPath::kWinding_FillType);
284 path.cubicTo(0,1, 2,1, 6,2);
286 pathB.setFillType(SkPath::kWinding_FillType);
288 pathB.cubicTo(2,6, 2,0, 1,0);
290 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
293 static void cubicOp20d(skiatest::Reporter* reporter, const char* filename) {
295 path.setFillType(SkPath::kWinding_FillType);
297 path.cubicTo(0,1, 6,0, 2,1);
299 pathB.setFillType(SkPath::kWinding_FillType);
301 pathB.cubicTo(1,2, 1,0, 1,0);
303 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
306 static void cubicOp21d(skiatest::Reporter* reporter, const char* filename) {
308 path.setFillType(SkPath::kWinding_FillType);
310 path.cubicTo(0,1, 2,1, 6,5);
312 pathB.setFillType(SkPath::kWinding_FillType);
314 pathB.cubicTo(5,6, 1,0, 1,0);
316 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
319 static void cubicOp22d(skiatest::Reporter* reporter, const char* filename) {
321 path.setFillType(SkPath::kWinding_FillType);
323 path.cubicTo(2,3, 3,0, 2,1);
325 pathB.setFillType(SkPath::kWinding_FillType);
327 pathB.cubicTo(1,2, 1,0, 3,2);
329 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
332 static void cubicOp23d(skiatest::Reporter* reporter, const char* filename) {
334 path.setFillType(SkPath::kWinding_FillType);
336 path.cubicTo(1,2, 4,0, 2,1);
338 pathB.setFillType(SkPath::kWinding_FillType);
340 pathB.cubicTo(1,2, 1,0, 2,1);
342 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
345 static void cubicOp24d(skiatest::Reporter* reporter, const char* filename) {
347 path.setFillType(SkPath::kWinding_FillType);
349 path.cubicTo(1,2, 2,0, 3,2);
351 pathB.setFillType(SkPath::kWinding_FillType);
353 pathB.cubicTo(2,3, 1,0, 2,1);
355 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
358 static void testIntersect1(skiatest::Reporter* reporter, const char* filename) {
360 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
361 two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
362 testPathOp(reporter, one, two, kIntersect_PathOp, filename);
365 static void testUnion1(skiatest::Reporter* reporter, const char* filename) {
367 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
368 two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
369 testPathOp(reporter, one, two, kUnion_PathOp, filename);
372 static void testDiff1(skiatest::Reporter* reporter, const char* filename) {
374 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
375 two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
376 testPathOp(reporter, one, two, kDifference_PathOp, filename);
379 static void testXor1(skiatest::Reporter* reporter, const char* filename) {
381 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
382 two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
383 testPathOp(reporter, one, two, kXOR_PathOp, filename);
386 static void testIntersect2(skiatest::Reporter* reporter, const char* filename) {
388 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
389 two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
390 testPathOp(reporter, one, two, kIntersect_PathOp, filename);
393 static void testUnion2(skiatest::Reporter* reporter, const char* filename) {
395 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
396 two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
397 testPathOp(reporter, one, two, kUnion_PathOp, filename);
400 static void testDiff2(skiatest::Reporter* reporter, const char* filename) {
402 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
403 two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
404 testPathOp(reporter, one, two, kDifference_PathOp, filename);
407 static void testXor2(skiatest::Reporter* reporter, const char* filename) {
409 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
410 two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
411 testPathOp(reporter, one, two, kXOR_PathOp, filename);
414 static void testOp1d(skiatest::Reporter* reporter, const char* filename) {
416 path.setFillType(SkPath::kWinding_FillType);
417 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
418 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
419 pathB.setFillType(SkPath::kWinding_FillType);
420 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
421 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
422 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
425 static void testOp2d(skiatest::Reporter* reporter, const char* filename) {
427 path.setFillType(SkPath::kWinding_FillType);
428 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
429 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
430 pathB.setFillType(SkPath::kEvenOdd_FillType);
431 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
432 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
433 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
436 static void testOp3d(skiatest::Reporter* reporter, const char* filename) {
438 path.setFillType(SkPath::kWinding_FillType);
439 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
440 path.addRect(1, 1, 2, 2, SkPath::kCW_Direction);
441 pathB.setFillType(SkPath::kWinding_FillType);
442 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
443 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
444 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
447 static void testOp1u(skiatest::Reporter* reporter, const char* filename) {
449 path.setFillType(SkPath::kWinding_FillType);
450 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
451 path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
452 pathB.setFillType(SkPath::kWinding_FillType);
453 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
454 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
455 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
458 static void testOp4d(skiatest::Reporter* reporter, const char* filename) {
460 path.setFillType(SkPath::kWinding_FillType);
461 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
462 path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
463 pathB.setFillType(SkPath::kWinding_FillType);
464 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
465 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
466 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
469 static void testOp5d(skiatest::Reporter* reporter, const char* filename) {
471 path.setFillType(SkPath::kEvenOdd_FillType);
472 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
473 path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
474 pathB.setFillType(SkPath::kEvenOdd_FillType);
475 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
476 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
477 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
480 static void testOp6d(skiatest::Reporter* reporter, const char* filename) {
482 path.setFillType(SkPath::kEvenOdd_FillType);
483 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
484 path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
485 pathB.setFillType(SkPath::kWinding_FillType);
486 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
487 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
488 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
491 static void testOp7d(skiatest::Reporter* reporter, const char* filename) {
493 path.setFillType(SkPath::kEvenOdd_FillType);
494 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
495 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
496 pathB.setFillType(SkPath::kEvenOdd_FillType);
497 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
498 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
499 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
502 static void testOp2u(skiatest::Reporter* reporter, const char* filename) {
504 path.setFillType(SkPath::kEvenOdd_FillType);
505 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
506 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
507 pathB.setFillType(SkPath::kWinding_FillType);
508 pathB.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
509 pathB.addRect(1, 1, 2, 2, SkPath::kCW_Direction);
510 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
513 static void testOp8d(skiatest::Reporter* reporter, const char* filename) {
515 path.addRect(0, 0, 640, 480);
516 pathB.moveTo(577330, 1971.72f);
517 pathB.cubicTo(10.7082f, -116.596f, 262.057f, 45.6468f, 294.694f, 1.96237f);
519 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
521 static void cubicOp25i(skiatest::Reporter* reporter, const char* filename) {
523 path.setFillType(SkPath::kWinding_FillType);
525 path.cubicTo(2,4, 5,0, 3,2);
527 pathB.setFillType(SkPath::kWinding_FillType);
529 pathB.cubicTo(2,3, 1,0, 4,2);
531 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
534 static void cubicOp26d(skiatest::Reporter* reporter, const char* filename) {
536 path.setFillType(SkPath::kWinding_FillType);
538 path.cubicTo(3,4, 4,0, 3,2);
540 pathB.setFillType(SkPath::kWinding_FillType);
542 pathB.cubicTo(2,3, 1,0, 4,3);
544 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
547 static void cubicOp27d(skiatest::Reporter* reporter, const char* filename) {
549 path.setFillType(SkPath::kWinding_FillType);
551 path.cubicTo(3,6, 1,0, 5,2);
553 pathB.setFillType(SkPath::kWinding_FillType);
555 pathB.cubicTo(2,5, 1,0, 6,3);
557 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
560 static void cubicOp28u(skiatest::Reporter* reporter, const char* filename) {
562 path.setFillType(SkPath::kWinding_FillType);
564 path.cubicTo(1,4, 6,0, 3,2);
566 pathB.setFillType(SkPath::kWinding_FillType);
568 pathB.cubicTo(2,3, 1,0, 4,1);
570 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
573 static void cubicOp29d(skiatest::Reporter* reporter, const char* filename) {
575 path.setFillType(SkPath::kWinding_FillType);
577 path.cubicTo(2,5, 6,0, 4,2);
579 pathB.setFillType(SkPath::kWinding_FillType);
581 pathB.cubicTo(2,4, 1,0, 5,2);
583 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
586 static void cubicOp30d(skiatest::Reporter* reporter, const char* filename) {
588 path.setFillType(SkPath::kWinding_FillType);
590 path.cubicTo(2,5, 6,0, 5,3);
592 pathB.setFillType(SkPath::kWinding_FillType);
594 pathB.cubicTo(3,5, 1,0, 5,2);
596 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
599 static void cubicOp31d(skiatest::Reporter* reporter, const char* filename) {
601 path.setFillType(SkPath::kWinding_FillType);
603 path.cubicTo(0,3, 2,1, 4,0);
605 pathB.setFillType(SkPath::kWinding_FillType);
607 pathB.cubicTo(0,4, 2,0, 3,0);
609 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
612 static void cubicOp31u(skiatest::Reporter* reporter, const char* filename) {
614 path.setFillType(SkPath::kWinding_FillType);
616 path.cubicTo(0,3, 2,1, 4,0);
618 pathB.setFillType(SkPath::kWinding_FillType);
620 pathB.cubicTo(0,4, 2,0, 3,0);
622 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
625 static void cubicOp31x(skiatest::Reporter* reporter, const char* filename) {
627 path.setFillType(SkPath::kWinding_FillType);
629 path.cubicTo(0,3, 2,1, 4,0);
631 pathB.setFillType(SkPath::kWinding_FillType);
633 pathB.cubicTo(0,4, 2,0, 3,0);
635 testPathOp(reporter, path, pathB, kXOR_PathOp, filename);
638 static void cubicOp32d(skiatest::Reporter* reporter, const char* filename) {
640 path.setFillType(SkPath::kWinding_FillType);
642 path.cubicTo(1,2, 6,0, 3,1);
644 pathB.setFillType(SkPath::kWinding_FillType);
646 pathB.cubicTo(1,3, 1,0, 2,1);
648 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
651 static void cubicOp33i(skiatest::Reporter* reporter, const char* filename) {
653 path.setFillType(SkPath::kWinding_FillType);
655 path.cubicTo(1,2, 6,0, 3,1);
657 pathB.setFillType(SkPath::kWinding_FillType);
659 pathB.cubicTo(1,3, 1,0, 2,1);
661 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
664 static void cubicOp34d(skiatest::Reporter* reporter, const char* filename) {
666 path.setFillType(SkPath::kWinding_FillType);
668 path.cubicTo(3,5, 2,1, 3,1);
670 pathB.setFillType(SkPath::kWinding_FillType);
672 pathB.cubicTo(1,3, 1,0, 5,3);
674 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
677 static void cubicOp35d(skiatest::Reporter* reporter, const char* filename) {
679 path.setFillType(SkPath::kWinding_FillType);
681 path.cubicTo(1,5, 2,1, 4,0);
683 pathB.setFillType(SkPath::kWinding_FillType);
685 pathB.cubicTo(0,4, 1,0, 5,1);
687 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
690 static void cubicOp36u(skiatest::Reporter* reporter, const char* filename) {
692 path.setFillType(SkPath::kWinding_FillType);
694 path.cubicTo(1,6, 2,0, 5,1);
696 pathB.setFillType(SkPath::kWinding_FillType);
698 pathB.cubicTo(1,5, 1,0, 6,1);
700 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
703 static void cubicOp37d(skiatest::Reporter* reporter, const char* filename) {
705 path.setFillType(SkPath::kWinding_FillType);
707 path.cubicTo(2,6, 6,1, 4,3);
709 pathB.setFillType(SkPath::kWinding_FillType);
711 pathB.cubicTo(3,4, 1,0, 6,2);
713 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
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 intersection
719 // if the line/cubic was a matching line/approx.quadratic then the missing intersection
720 // could have been detected
721 static void cubicOp38d(skiatest::Reporter* reporter, const char* filename) {
723 path.setFillType(SkPath::kWinding_FillType);
725 path.cubicTo(0,6, 3,2, 4,1);
727 pathB.setFillType(SkPath::kWinding_FillType);
729 pathB.cubicTo(1,4, 1,0, 6,0);
731 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
734 static void cubicOp39d(skiatest::Reporter* reporter, const char* filename) {
736 path.setFillType(SkPath::kWinding_FillType);
738 path.cubicTo(2,3, 5,1, 4,3);
740 pathB.setFillType(SkPath::kWinding_FillType);
742 pathB.cubicTo(3,4, 1,0, 3,2);
744 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
747 static void cubicOp40d(skiatest::Reporter* reporter, const char* filename) {
749 path.setFillType(SkPath::kWinding_FillType);
751 path.cubicTo(1,5, 3,2, 4,2);
753 pathB.setFillType(SkPath::kWinding_FillType);
755 pathB.cubicTo(2,4, 1,0, 5,1);
757 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
760 static void cubicOp41i(skiatest::Reporter* reporter, const char* filename) {
762 path.setFillType(SkPath::kWinding_FillType);
764 path.cubicTo(2,6, 4,3, 6,4);
766 pathB.setFillType(SkPath::kWinding_FillType);
768 pathB.cubicTo(4,6, 1,0, 6,2);
770 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
773 static void cubicOp42d(skiatest::Reporter* reporter, const char* filename) {
775 path.setFillType(SkPath::kWinding_FillType);
777 path.cubicTo(1,2, 6,5, 5,4);
779 pathB.setFillType(SkPath::kWinding_FillType);
781 pathB.cubicTo(4,5, 1,0, 2,1);
783 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
786 static void cubicOp43d(skiatest::Reporter* reporter, const char* filename) {
788 path.setFillType(SkPath::kWinding_FillType);
790 path.cubicTo(1,2, 4,0, 3,1);
792 pathB.setFillType(SkPath::kWinding_FillType);
794 pathB.cubicTo(1,3, 2,0, 2,1);
796 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
799 static void cubicOp44d(skiatest::Reporter* reporter, const char* filename) {
801 path.setFillType(SkPath::kWinding_FillType);
803 path.cubicTo(3,6, 4,0, 3,2);
805 pathB.setFillType(SkPath::kWinding_FillType);
807 pathB.cubicTo(2,3, 2,0, 6,3);
809 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
812 static void cubicOp45d(skiatest::Reporter* reporter, const char* filename) {
814 path.setFillType(SkPath::kWinding_FillType);
816 path.cubicTo(2,4, 4,0, 3,2);
818 pathB.setFillType(SkPath::kWinding_FillType);
820 pathB.cubicTo(2,3, 2,0, 4,2);
822 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
825 static void cubicOp46d(skiatest::Reporter* reporter, const char* filename) {
827 path.setFillType(SkPath::kWinding_FillType);
829 path.cubicTo(3,5, 5,0, 4,2);
831 pathB.setFillType(SkPath::kWinding_FillType);
833 pathB.cubicTo(2,4, 2,0, 5,3);
835 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
838 static void cubicOp47d(skiatest::Reporter* reporter, const char* filename) {
840 path.setFillType(SkPath::kWinding_FillType);
842 path.cubicTo(1,6, 6,2, 5,4);
844 pathB.setFillType(SkPath::kWinding_FillType);
846 pathB.cubicTo(4,5, 1,0, 6,1);
848 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
851 static void cubicOp48d(skiatest::Reporter* reporter, const char* filename) {
853 path.setFillType(SkPath::kWinding_FillType);
855 path.cubicTo(2,3, 5,1, 3,2);
857 pathB.setFillType(SkPath::kWinding_FillType);
859 pathB.cubicTo(2,3, 2,0, 3,2);
861 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
864 static void cubicOp49d(skiatest::Reporter* reporter, const char* filename) {
866 path.setFillType(SkPath::kWinding_FillType);
868 path.cubicTo(1,5, 3,2, 4,1);
870 pathB.setFillType(SkPath::kWinding_FillType);
872 pathB.cubicTo(1,4, 2,0, 5,1);
874 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
877 static void cubicOp50d(skiatest::Reporter* reporter, const char* filename) {
879 path.setFillType(SkPath::kWinding_FillType);
881 path.cubicTo(1,6, 5,0, 5,1);
883 pathB.setFillType(SkPath::kWinding_FillType);
885 pathB.cubicTo(1,5, 3,0, 6,1);
887 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
890 static void cubicOp51d(skiatest::Reporter* reporter, const char* filename) {
892 path.setFillType(SkPath::kWinding_FillType);
894 path.cubicTo(1,2, 4,1, 6,0);
896 pathB.setFillType(SkPath::kWinding_FillType);
898 pathB.cubicTo(0,6, 3,0, 2,1);
900 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
903 static void cubicOp52d(skiatest::Reporter* reporter, const char* filename) {
905 path.setFillType(SkPath::kWinding_FillType);
907 path.cubicTo(1,2, 5,4, 4,3);
909 pathB.setFillType(SkPath::kWinding_FillType);
911 pathB.cubicTo(3,4, 2,0, 2,1);
913 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
916 static void cubicOp53d(skiatest::Reporter* reporter, const char* filename) {
918 path.setFillType(SkPath::kWinding_FillType);
920 path.cubicTo(1,2, 5,3, 2,1);
922 pathB.setFillType(SkPath::kWinding_FillType);
924 pathB.cubicTo(1,2, 3,0, 2,1);
926 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
929 static void cubicOp54d(skiatest::Reporter* reporter, const char* filename) {
931 path.setFillType(SkPath::kWinding_FillType);
933 path.cubicTo(1,3, 5,4, 4,2);
935 pathB.setFillType(SkPath::kWinding_FillType);
937 pathB.cubicTo(2,4, 4,0, 3,1);
939 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
942 static void cubicOp55d(skiatest::Reporter* reporter, const char* filename) {
944 path.setFillType(SkPath::kWinding_FillType);
946 path.cubicTo(1,3, 3,2, 5,0);
948 pathB.setFillType(SkPath::kWinding_FillType);
950 pathB.cubicTo(0,5, 5,0, 3,1);
952 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
955 static void cubicOp56d(skiatest::Reporter* reporter, const char* filename) {
957 path.setFillType(SkPath::kWinding_FillType);
959 path.cubicTo(2,6, 5,0, 2,1);
961 pathB.setFillType(SkPath::kWinding_FillType);
963 pathB.cubicTo(1,2, 1,0, 6,2);
965 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
968 static void cubicOp57d(skiatest::Reporter* reporter, const char* filename) {
970 path.setFillType(SkPath::kWinding_FillType);
972 path.cubicTo(0,5, 5,4, 6,4);
974 pathB.setFillType(SkPath::kWinding_FillType);
976 pathB.cubicTo(4,6, 5,0, 5,0);
978 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
981 static void cubicOp58d(skiatest::Reporter* reporter, const char* filename) {
983 path.setFillType(SkPath::kWinding_FillType);
985 path.cubicTo(3,4, 6,5, 5,3);
987 pathB.setFillType(SkPath::kWinding_FillType);
989 pathB.cubicTo(3,5, 5,0, 4,3);
991 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
994 static void cubicOp59d(skiatest::Reporter* reporter, const char* filename) {
996 path.setFillType(SkPath::kWinding_FillType);
998 path.cubicTo(5,6, 4,0, 4,1);
1000 pathB.setFillType(SkPath::kWinding_FillType);
1002 pathB.cubicTo(1,4, 1,0, 6,5);
1004 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
1007 static void cubicOp60d(skiatest::Reporter* reporter, const char* filename) {
1009 path.setFillType(SkPath::kWinding_FillType);
1011 path.cubicTo(4,6, 6,0, 5,2);
1013 pathB.setFillType(SkPath::kWinding_FillType);
1015 pathB.cubicTo(2,5, 2,0, 6,4);
1017 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
1020 static void cubicOp61d(skiatest::Reporter* reporter, const char* filename) {
1022 path.setFillType(SkPath::kWinding_FillType);
1024 path.cubicTo(0,5, 3,2, 6,1);
1026 pathB.setFillType(SkPath::kWinding_FillType);
1028 pathB.cubicTo(1,6, 2,1, 5,0);
1030 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
1033 static void cubicOp62d(skiatest::Reporter* reporter, const char* filename) {
1035 path.setFillType(SkPath::kWinding_FillType);
1037 path.cubicTo(5,6, 5,3, 5,4);
1039 pathB.setFillType(SkPath::kWinding_FillType);
1041 pathB.cubicTo(4,5, 3,1, 6,5);
1043 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
1046 static void cubicOp63d(skiatest::Reporter* reporter, const char* filename) {
1048 path.setFillType(SkPath::kWinding_FillType);
1050 path.cubicTo(0,4, 3,2, 5,3);
1052 pathB.setFillType(SkPath::kWinding_FillType);
1054 pathB.cubicTo(3,5, 3,2, 4,0);
1056 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
1059 static void cubicOp64d(skiatest::Reporter* reporter, const char* filename) {
1062 path.cubicTo(0,1, 1,0, 3,0);
1066 pathB.cubicTo(0,3, 1,0, 1,0);
1069 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
1072 static void cubicOp65d(skiatest::Reporter* reporter, const char* filename) {
1075 path.cubicTo(1,5, 1,0, 1,0);
1079 pathB.cubicTo(0,1, 1,0, 5,1);
1082 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
1085 static void rectOp1d(skiatest::Reporter* reporter, const char* filename) {
1088 path.cubicTo(0,1, 1,0, 3,0);
1092 pathB.cubicTo(0,3, 1,0, 1,0);
1095 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
1098 static void cubicOp66u(skiatest::Reporter* reporter, const char* filename) {
1100 path.setFillType(SkPath::kWinding_FillType);
1102 path.cubicTo(2,6, 4,2, 5,3);
1104 pathB.setFillType(SkPath::kWinding_FillType);
1106 pathB.cubicTo(3,5, 1,0, 6,2);
1108 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
1111 static void cubicOp67u(skiatest::Reporter* reporter, const char* filename) {
1114 path.cubicTo(1,6, 5,0, 3,1);
1118 pathB.cubicTo(1,3, 5,3, 6,1);
1121 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
1124 static void cubicOp68u(skiatest::Reporter* reporter, const char* filename) {
1127 path.cubicTo(4,5, 4,1, 5,0);
1130 pathB.cubicTo(0,5, 5,0, 5,4);
1132 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
1135 static void cubicOp69d(skiatest::Reporter* reporter, const char* filename) {
1138 path.cubicTo(0,1, 3,1, 2,0);
1141 pathB.cubicTo(0,2, 3,1, 1,0);
1143 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
1149 kReverseDifference_PathOp,
1151 kReverseDifference_PathOp,
1154 static void rRect1(skiatest::Reporter* reporter, const char* filename) {
1155 SkScalar xA = 0.65f;
1156 SkScalar xB = 10.65f;
1157 SkScalar xC = 20.65f;
1158 SkScalar xD = 30.65f;
1159 SkScalar xE = 40.65f;
1160 SkScalar xF = 50.65f;
1162 SkScalar yA = 0.65f;
1163 SkScalar yB = 10.65f;
1164 SkScalar yC = 20.65f;
1165 SkScalar yD = 30.65f;
1166 SkScalar yE = 40.65f;
1167 SkScalar yF = 50.65f;
1170 rects[0].set(xB, yB, xE, yE);
1171 paths[0].addRoundRect(rects[0], SkIntToScalar(5), SkIntToScalar(5)); // red
1172 rects[1].set(xA, yA, xD, yD);
1173 paths[1].addRoundRect(rects[1], SkIntToScalar(5), SkIntToScalar(5)); // green
1174 rects[2].set(xC, yA, xF, yD);
1175 paths[2].addRoundRect(rects[2], SkIntToScalar(5), SkIntToScalar(5)); // blue
1176 rects[3].set(xA, yC, xD, yF);
1177 paths[3].addRoundRect(rects[3], SkIntToScalar(5), SkIntToScalar(5)); // yellow
1178 rects[4].set(xC, yC, xF, yF);
1179 paths[4].addRoundRect(rects[4], SkIntToScalar(5), SkIntToScalar(5)); // cyan
1181 path.setFillType(SkPath::kInverseEvenOdd_FillType);
1182 for (int index = 0; index < 5; ++index) {
1183 testPathOp(reporter, path, paths[index], ops[index], filename);
1184 Op(path, paths[index], ops[index], &path);
1188 static void skp1(skiatest::Reporter* reporter, const char* filename) {
1190 path.setFillType(SkPath::kEvenOdd_FillType);
1192 path.cubicTo(189,5.34314585f, 190.34314f,4, 192,4);
1194 path.cubicTo(244.65686f,4, 246,5.34314585f, 246,7);
1195 path.lineTo(246,21);
1196 path.cubicTo(246,22.6568546f, 244.65686f,24, 243,24);
1197 path.lineTo(192,24);
1198 path.cubicTo(190.34314f,24, 189,22.6568546f, 189,21);
1202 path.cubicTo(191,6.89543009f, 191.895432f,6, 193,6);
1204 path.cubicTo(243.104568f,6, 244,6.89543009f, 244,8);
1205 path.lineTo(244,20);
1206 path.cubicTo(244,21.1045704f, 243.104568f,22, 242,22);
1207 path.lineTo(193,22);
1208 path.cubicTo(191.895432f,22, 191,21.1045704f, 191,20);
1212 pathB.setFillType(SkPath::kWinding_FillType);
1213 pathB.moveTo(189,4);
1214 pathB.lineTo(199,14);
1215 pathB.lineTo(236,14);
1216 pathB.lineTo(246,4);
1217 pathB.lineTo(189,4);
1219 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1222 static void skp2(skiatest::Reporter* reporter, const char* filename) {
1224 path.setFillType(SkPath::kEvenOdd_FillType);
1225 path.moveTo(253.000000f, 11757.0000f);
1226 path.lineTo(253.000000f, 222.000000f);
1227 path.lineTo(823.000000f, 222.000000f);
1228 path.lineTo(823.000000f, 11757.0000f);
1229 path.lineTo(253.000000f, 11757.0000f);
1232 pathB.setFillType(SkPath::kWinding_FillType);
1233 pathB.moveTo(258.000000f, 1028.00000f);
1234 pathB.lineTo(258.000000f, 1027.00000f);
1235 pathB.lineTo(823.000000f, 1027.00000f);
1236 pathB.lineTo(823.000000f, 1028.00000f);
1237 pathB.lineTo(258.000000f, 1028.00000f);
1239 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1242 static void skp3(skiatest::Reporter* reporter, const char* filename) {
1244 path.setFillType(SkPath::kEvenOdd_FillType);
1245 path.moveTo(717.000000f, 507.000000f);
1246 path.lineTo(717.000000f, 425.000000f);
1247 path.lineTo(973.000000f, 425.000000f);
1248 path.lineTo(973.000000f, 507.000000f);
1249 path.quadTo(973.000000f, 508.242645f, 972.121582f, 509.121613f);
1250 path.quadTo(971.242615f, 510.000000f, 970.000000f, 510.000000f);
1251 path.lineTo(720.000000f, 510.000000f);
1252 path.quadTo(718.757385f, 510.000000f, 717.878418f, 509.121613f);
1253 path.quadTo(717.000000f, 508.242645f, 717.000000f, 507.000000f);
1255 path.moveTo(719.000000f, 426.000000f);
1256 path.lineTo(971.000000f, 426.000000f);
1257 path.lineTo(971.000000f, 506.000000f);
1258 path.cubicTo(971.000000f, 507.104584f, 970.104553f, 508.000000f, 969.000000f, 508.000000f);
1259 path.lineTo(721.000000f, 508.000000f);
1260 path.cubicTo(719.895447f, 508.000000f, 719.000000f, 507.104584f, 719.000000f, 506.000000f);
1261 path.lineTo(719.000000f, 426.000000f);
1264 pathB.setFillType(SkPath::kWinding_FillType);
1265 pathB.moveTo(717.000000f, 510.000000f);
1266 pathB.lineTo(760.000000f, 467.000000f);
1267 pathB.lineTo(930.000000f, 467.000000f);
1268 pathB.lineTo(973.000000f, 510.000000f);
1269 pathB.lineTo(717.000000f, 510.000000f);
1271 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1274 static void skp4(skiatest::Reporter* reporter, const char* filename) {
1276 path.setFillType(SkPath::kEvenOdd_FillType);
1277 path.moveTo(230.756805f, 591.756775f);
1278 path.quadTo(232.514725f, 590.000000f, 235.000000f, 590.000000f);
1279 path.lineTo(300.000000f, 590.000000f);
1280 path.quadTo(302.485291f, 590.000000f, 304.243195f, 591.756775f);
1281 path.quadTo(306.000000f, 593.514709f, 306.000000f, 596.000000f);
1282 path.lineTo(306.000000f, 617.000000f);
1283 path.lineTo(229.000000f, 617.000000f);
1284 path.lineTo(229.000000f, 596.000000f);
1285 path.quadTo(229.000000f, 593.514709f, 230.756805f, 591.756775f);
1287 path.moveTo(231.000000f, 597.000000f);
1288 path.cubicTo(231.000000f, 594.238586f, 233.238571f, 592.000000f, 236.000000f, 592.000000f);
1289 path.lineTo(299.000000f, 592.000000f);
1290 path.cubicTo(301.761414f, 592.000000f, 304.000000f, 594.238586f, 304.000000f, 597.000000f);
1291 path.lineTo(304.000000f, 616.000000f);
1292 path.lineTo(231.000000f, 616.000000f);
1293 path.lineTo(231.000000f, 597.000000f);
1296 pathB.setFillType(SkPath::kWinding_FillType);
1297 pathB.moveTo(306.000000f, 590.000000f);
1298 pathB.lineTo(292.000000f, 604.000000f);
1299 pathB.lineTo(305.000000f, 617.000000f);
1300 pathB.lineTo(306.000000f, 617.000000f);
1301 pathB.lineTo(306.000000f, 590.000000f);
1303 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1306 static void skp5(skiatest::Reporter* reporter, const char* filename) {
1308 path.setFillType(SkPath::kEvenOdd_FillType);
1309 path.moveTo(18.0000000f, 226.000000f);
1310 path.quadTo(14.6862917f, 226.000000f, 12.3423996f, 228.342407f);
1311 path.quadTo(10.0000000f, 230.686295f, 10.0000000f, 234.000000f);
1312 path.lineTo(10.0000000f, 253.000000f);
1313 path.lineTo(1247.00000f, 253.000000f);
1314 path.lineTo(1247.00000f, 234.000000f);
1315 path.quadTo(1247.00000f, 230.686295f, 1244.65759f, 228.342407f);
1316 path.quadTo(1242.31372f, 226.000000f, 1239.00000f, 226.000000f);
1317 path.lineTo(18.0000000f, 226.000000f);
1320 pathB.setFillType(SkPath::kInverseWinding_FillType);
1321 pathB.moveTo(18.0000000f, 226.000000f);
1322 pathB.lineTo(1239.00000f, 226.000000f);
1323 pathB.cubicTo(1243.41833f, 226.000000f, 1247.00000f, 229.581726f, 1247.00000f, 234.000000f);
1324 pathB.lineTo(1247.00000f, 252.000000f);
1325 pathB.lineTo(10.0000000f, 252.000000f);
1326 pathB.lineTo(10.0000000f, 234.000000f);
1327 pathB.cubicTo(10.0000000f, 229.581726f, 13.5817204f, 226.000000f, 18.0000000f, 226.000000f);
1329 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1332 static void cubicOp70d(skiatest::Reporter* reporter, const char* filename) {
1334 path.setFillType(SkPath::kWinding_FillType);
1336 path.cubicTo(0,5, 4,0, 5,0);
1338 pathB.setFillType(SkPath::kWinding_FillType);
1340 pathB.cubicTo(0,5, 1,0, 5,0);
1342 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
1345 static void cubicOp71d(skiatest::Reporter* reporter, const char* filename) {
1347 path.setFillType(SkPath::kWinding_FillType);
1349 path.cubicTo(0,5, 4,1, 6,4);
1351 pathB.setFillType(SkPath::kWinding_FillType);
1353 pathB.cubicTo(4,6, 1,0, 5,0);
1355 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
1358 static void cubicOp72i(skiatest::Reporter* reporter, const char* filename) {
1360 path.setFillType(SkPath::kWinding_FillType);
1362 path.cubicTo(0,5, 5,2, 5,4);
1364 pathB.setFillType(SkPath::kWinding_FillType);
1366 pathB.cubicTo(4,5, 1,0, 5,0);
1368 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1371 static void cubicOp73d(skiatest::Reporter* reporter, const char* filename) {
1373 path.setFillType(SkPath::kWinding_FillType);
1375 path.cubicTo(3,4, 4,0, 6,4);
1378 pathB.setFillType(SkPath::kWinding_FillType);
1380 pathB.cubicTo(4,6, 1,0, 4,3);
1383 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
1386 static void cubicOp74d(skiatest::Reporter* reporter, const char* filename) {
1388 path.setFillType(SkPath::kWinding_FillType);
1390 path.cubicTo(1,5, 5,1, 5,1);
1393 pathB.setFillType(SkPath::kWinding_FillType);
1395 pathB.cubicTo(1,5, 1,0, 5,1);
1398 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
1401 static void cubicOp75d(skiatest::Reporter* reporter, const char* filename) {
1403 path.setFillType(SkPath::kWinding_FillType);
1405 path.cubicTo(0,4, 5,1, 6,4);
1408 pathB.setFillType(SkPath::kWinding_FillType);
1410 pathB.cubicTo(4,6, 1,0, 4,0);
1413 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
1416 static void cubicOp76u(skiatest::Reporter* reporter, const char* filename) {
1418 path.setFillType(SkPath::kWinding_FillType);
1420 path.cubicTo(0,2, 2,0, 5,3);
1422 pathB.setFillType(SkPath::kWinding_FillType);
1424 pathB.cubicTo(3,5, 1,0, 2,0);
1426 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
1429 static void cubicOp77i(skiatest::Reporter* reporter, const char* filename) {
1431 path.setFillType(SkPath::kEvenOdd_FillType);
1433 path.cubicTo(1,3, 2,0, 3,2);
1436 pathB.setFillType(SkPath::kEvenOdd_FillType);
1438 pathB.cubicTo(2,3, 1,0, 3,1);
1441 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1444 static void cubicOp78u(skiatest::Reporter* reporter, const char* filename) {
1446 path.setFillType(SkPath::kEvenOdd_FillType);
1448 path.cubicTo(1,6, 5,0, 6,1);
1451 pathB.setFillType(SkPath::kEvenOdd_FillType);
1453 pathB.cubicTo(1,6, 6,1, 6,1);
1456 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
1459 static void cubicOp79u(skiatest::Reporter* reporter, const char* filename) {
1461 path.setFillType(SkPath::kWinding_FillType);
1463 path.cubicTo(1,3, 1,0, 6,4);
1465 pathB.setFillType(SkPath::kWinding_FillType);
1467 pathB.cubicTo(4,6, 1,0, 3,1);
1469 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1472 static void cubicOp80i(skiatest::Reporter* reporter, const char* filename) {
1474 path.setFillType(SkPath::kWinding_FillType);
1476 path.cubicTo(2,3, 2,1, 4,3);
1479 pathB.setFillType(SkPath::kWinding_FillType);
1481 pathB.cubicTo(3,4, 1,0, 3,2);
1484 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1487 static void cubicOp81d(skiatest::Reporter* reporter, const char* filename) {
1489 path.setFillType(SkPath::kWinding_FillType);
1491 path.cubicTo(4,6, 4,3, 5,4);
1493 pathB.setFillType(SkPath::kWinding_FillType);
1495 pathB.cubicTo(4,5, 1,0, 6,4);
1497 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
1500 static void cubicOp82i(skiatest::Reporter* reporter, const char* filename) {
1502 path.setFillType(SkPath::kEvenOdd_FillType);
1504 path.cubicTo(2,3, 5,2, 3,0);
1507 pathB.setFillType(SkPath::kWinding_FillType);
1509 pathB.cubicTo(0,3, 1,0, 3,2);
1512 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1515 static void cubicOp83i(skiatest::Reporter* reporter, const char* filename) {
1517 path.setFillType(SkPath::kWinding_FillType);
1519 path.cubicTo(0,3, 2,1, 4,1);
1522 pathB.setFillType(SkPath::kWinding_FillType);
1524 pathB.cubicTo(1,4, 1,0, 3,0);
1527 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1530 static void cubicOp84d(skiatest::Reporter* reporter, const char* filename) {
1532 path.setFillType(SkPath::kWinding_FillType);
1534 path.cubicTo(2,3, 6,3, 3,2);
1536 pathB.setFillType(SkPath::kWinding_FillType);
1538 pathB.cubicTo(2,3, 4,0, 3,2);
1540 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
1543 static void skpClip1(skiatest::Reporter* reporter, const char* filename) {
1545 path.setFillType(SkPath::kEvenOdd_FillType);
1546 path.moveTo(1126.17114f, 877.171204f);
1547 path.quadTo(1127.34314f, 876.000000f, 1129.00000f, 876.000000f);
1548 path.lineTo(1243.00000f, 876.000000f);
1549 path.quadTo(1244.65686f, 876.000000f, 1245.82886f, 877.171204f);
1550 path.quadTo(1247.00000f, 878.343140f, 1247.00000f, 880.000000f);
1551 path.lineTo(1247.00000f, 907.000000f);
1552 path.lineTo(1246.00000f, 907.000000f);
1553 path.lineTo(1246.00000f, 880.000000f);
1554 path.cubicTo(1246.00000f, 878.343140f, 1244.65686f, 877.000000f, 1243.00000f, 877.000000f);
1555 path.lineTo(1129.00000f, 877.000000f);
1556 path.cubicTo(1127.34314f, 877.000000f, 1126.00000f, 878.343140f, 1126.00000f, 880.000000f);
1557 path.lineTo(1126.00000f, 907.000000f);
1558 path.lineTo(1125.00000f, 907.000000f);
1559 path.lineTo(1125.00000f, 880.000000f);
1560 path.quadTo(1125.00000f, 878.343140f, 1126.17114f, 877.171204f);
1563 pathB.setFillType(SkPath::kWinding_FillType);
1564 pathB.moveTo(1247.00000f, 876.000000f);
1565 pathB.lineTo(1231.00000f, 892.000000f);
1566 pathB.lineTo(1246.00000f, 907.000000f);
1567 pathB.lineTo(1247.00000f, 907.000000f);
1568 pathB.lineTo(1247.00000f, 876.000000f);
1570 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1573 static void skpClip2(skiatest::Reporter* reporter, const char* filename) {
1575 path.setFillType(SkPath::kEvenOdd_FillType);
1576 path.moveTo(134.000000f, 11414.0000f);
1577 path.cubicTo(131.990234f, 11414.0000f, 130.326660f, 11415.4824f, 130.042755f, 11417.4131f);
1578 path.cubicTo(130.233124f, 11418.3193f, 131.037079f, 11419.0000f, 132.000000f, 11419.0000f);
1579 path.lineTo(806.000000f, 11419.0000f);
1580 path.cubicTo(806.962891f, 11419.0000f, 807.766907f, 11418.3193f, 807.957275f, 11417.4131f);
1581 path.cubicTo(807.673401f, 11415.4824f, 806.009766f, 11414.0000f, 804.000000f, 11414.0000f);
1582 path.lineTo(134.000000f, 11414.0000f);
1585 pathB.setFillType(SkPath::kInverseWinding_FillType);
1586 pathB.moveTo(132.000000f, 11415.0000f);
1587 pathB.lineTo(806.000000f, 11415.0000f);
1588 pathB.cubicTo(807.104553f, 11415.0000f, 808.000000f, 11415.4473f, 808.000000f, 11416.0000f);
1589 pathB.lineTo(808.000000f, 11417.0000f);
1590 pathB.cubicTo(808.000000f, 11418.1045f, 807.104553f, 11419.0000f, 806.000000f, 11419.0000f);
1591 pathB.lineTo(132.000000f, 11419.0000f);
1592 pathB.cubicTo(130.895432f, 11419.0000f, 130.000000f, 11418.1045f, 130.000000f, 11417.0000f);
1593 pathB.lineTo(130.000000f, 11416.0000f);
1594 pathB.cubicTo(130.000000f, 11415.4473f, 130.895432f, 11415.0000f, 132.000000f, 11415.0000f);
1596 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1599 static void skp96prezzi1(skiatest::Reporter* reporter, const char* filename) {
1601 path.setFillType(SkPath::kEvenOdd_FillType);
1602 path.moveTo(157.464005f, 670.463989f);
1603 path.quadTo(158.928925f, 669.000000f, 161.000000f, 669.000000f);
1604 path.lineTo(248.000000f, 669.000000f);
1605 path.quadTo(250.071075f, 669.000000f, 251.535995f, 670.463989f);
1606 path.quadTo(253.000000f, 671.928955f, 253.000000f, 674.000000f);
1607 path.lineTo(253.000000f, 706.000000f);
1608 path.lineTo(251.000000f, 706.000000f);
1609 path.lineTo(251.000000f, 675.000000f);
1610 path.cubicTo(251.000000f, 672.790833f, 249.209137f, 671.000000f, 247.000000f, 671.000000f);
1611 path.lineTo(162.000000f, 671.000000f);
1612 path.cubicTo(159.790863f, 671.000000f, 158.000000f, 672.790833f, 158.000000f, 675.000000f);
1613 path.lineTo(158.000000f, 706.000000f);
1614 path.lineTo(156.000000f, 706.000000f);
1615 path.lineTo(156.000000f, 674.000000f);
1616 path.quadTo(156.000000f, 671.928955f, 157.464005f, 670.463989f);
1619 pathB.setFillType(SkPath::kWinding_FillType);
1620 pathB.moveTo(156.000000f, 669.000000f);
1621 pathB.lineTo(178.500000f, 691.500000f);
1622 pathB.lineTo(230.500000f, 691.500000f);
1623 pathB.lineTo(253.000000f, 669.000000f);
1624 pathB.lineTo(156.000000f, 669.000000f);
1626 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1629 static void skpancestry_com1(skiatest::Reporter* reporter, const char* filename) {
1631 path.setFillType(SkPath::kEvenOdd_FillType);
1632 path.moveTo(161.000000f, 925.000000f);
1633 path.cubicTo(159.874390f, 925.000000f, 158.835663f, 925.371948f, 158.000000f, 925.999634f);
1634 path.lineTo(158.000000f, 926.000000f);
1635 path.lineTo(1108.00000f, 926.000000f);
1636 path.lineTo(1108.00000f, 925.999634f);
1637 path.cubicTo(1107.16443f, 925.371948f, 1106.12561f, 925.000000f, 1105.00000f, 925.000000f);
1638 path.lineTo(161.000000f, 925.000000f);
1641 pathB.setFillType(SkPath::kEvenOdd_FillType);
1642 pathB.moveTo(161.000000f, 926.000000f);
1643 pathB.lineTo(1105.00000f, 926.000000f);
1644 pathB.cubicTo(1107.20911f, 926.000000f, 1109.00000f, 927.790833f, 1109.00000f, 930.000000f);
1645 pathB.lineTo(1109.00000f, 956.000000f);
1646 pathB.cubicTo(1109.00000f, 958.209167f, 1107.20911f, 960.000000f, 1105.00000f, 960.000000f);
1647 pathB.lineTo(161.000000f, 960.000000f);
1648 pathB.cubicTo(158.790863f, 960.000000f, 157.000000f, 958.209167f, 157.000000f, 956.000000f);
1649 pathB.lineTo(157.000000f, 930.000000f);
1650 pathB.cubicTo(157.000000f, 927.790833f, 158.790863f, 926.000000f, 161.000000f, 926.000000f);
1652 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1655 static void skpeldorado_com_ua1(skiatest::Reporter* reporter, const char* filename) {
1657 path.setFillType(SkPath::kEvenOdd_FillType);
1658 path.moveTo(286.695129f, 291.000000f);
1659 path.lineTo(229.304855f, 561.000000f);
1660 path.lineTo(979.304871f, 561.000000f);
1661 path.lineTo(1036.69507f, 291.000000f);
1662 path.lineTo(286.695129f, 291.000000f);
1665 pathB.setFillType(SkPath::kWinding_FillType);
1666 pathB.moveTo(1006.69513f, 291.000000f);
1667 pathB.cubicTo(1023.26367f, 291.000000f, 1033.84021f, 304.431458f, 1030.31836f, 321.000000f);
1668 pathB.lineTo(985.681519f, 531.000000f);
1669 pathB.cubicTo(982.159790f, 547.568542f, 965.873413f, 561.000000f, 949.304871f, 561.000000f);
1670 pathB.lineTo(259.304871f, 561.000000f);
1671 pathB.cubicTo(242.736313f, 561.000000f, 232.159805f, 547.568542f, 235.681549f, 531.000000f);
1672 pathB.lineTo(280.318420f, 321.000000f);
1673 pathB.cubicTo(283.840179f, 304.431458f, 300.126587f, 291.000000f, 316.695129f, 291.000000f);
1674 pathB.lineTo(1006.69513f, 291.000000f);
1676 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1679 static void skpbyte_com1(skiatest::Reporter* reporter, const char* filename) {
1681 path.setFillType(SkPath::kEvenOdd_FillType);
1682 path.moveTo(968.000000f, 14.0000000f);
1683 path.cubicTo(965.238586f, 14.0000000f, 963.000000f, 16.2385769f, 963.000000f, 19.0000000f);
1684 path.lineTo(963.000000f, 32.0000000f);
1685 path.cubicTo(963.000000f, 34.7614250f, 965.238586f, 37.0000000f, 968.000000f, 37.0000000f);
1686 path.lineTo(1034.00000f, 37.0000000f);
1687 path.cubicTo(1036.76147f, 37.0000000f, 1039.00000f, 34.7614250f, 1039.00000f, 32.0000000f);
1688 path.lineTo(1039.00000f, 19.0000000f);
1689 path.cubicTo(1039.00000f, 16.2385769f, 1036.76147f, 14.0000000f, 1034.00000f, 14.0000000f);
1690 path.lineTo(968.000000f, 14.0000000f);
1693 pathB.setFillType(SkPath::kInverseWinding_FillType);
1694 pathB.moveTo(968.000000f, 14.0000000f);
1695 pathB.lineTo(1034.00000f, 14.0000000f);
1696 pathB.cubicTo(1036.76147f, 14.0000000f, 1039.00000f, 16.2385750f, 1039.00000f, 19.0000000f);
1697 pathB.lineTo(1039.00000f, 32.0000000f);
1698 pathB.cubicTo(1039.00000f, 34.2091408f, 1036.76147f, 36.0000000f, 1034.00000f, 36.0000000f);
1699 pathB.lineTo(968.000000f, 36.0000000f);
1700 pathB.cubicTo(965.238586f, 36.0000000f, 963.000000f, 34.2091408f, 963.000000f, 32.0000000f);
1701 pathB.lineTo(963.000000f, 19.0000000f);
1702 pathB.cubicTo(963.000000f, 16.2385750f, 965.238586f, 14.0000000f, 968.000000f, 14.0000000f);
1704 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1707 static void skphealth_com76(skiatest::Reporter* reporter, const char* filename) {
1709 path.setFillType(SkPath::kEvenOdd_FillType);
1710 path.moveTo(708.099182f, 7.09919119f);
1711 path.lineTo(708.099182f, 7.09920025f);
1712 path.quadTo(704.000000f, 11.2010098f, 704.000000f, 17.0000000f);
1713 path.lineTo(704.000000f, 33.0000000f);
1714 path.lineTo(705.000000f, 33.0000000f);
1715 path.lineTo(705.000000f, 17.0000000f);
1716 path.cubicTo(705.000000f, 13.4101496f, 706.455078f, 10.1601505f, 708.807617f, 7.80761385f);
1717 path.lineTo(708.099182f, 7.09919119f);
1720 pathB.setFillType(SkPath::kWinding_FillType);
1721 pathB.moveTo(704.000000f, 3.00000000f);
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);
1728 pathB.lineTo(704.000000f, 33.0000000f);
1729 pathB.lineTo(705.000000f, 33.0000000f);
1730 pathB.lineTo(719.500000f, 3.00000000f);
1731 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1735 static void skpahrefs_com88(skiatest::Reporter* reporter, const char* filename) {
1737 path.setFillType(SkPath::kEvenOdd_FillType);
1738 path.moveTo(1099.82886f, 7.17117119f);
1739 path.lineTo(1099.12134f, 7.87867832f);
1740 path.cubicTo(1099.66418f, 8.42157173f, 1100.00000f, 9.17157173f, 1100.00000f, 10.0000000f);
1741 path.lineTo(1100.00000f, 28.0000000f);
1742 path.cubicTo(1100.00000f, 29.6568546f, 1098.65686f, 31.0000000f, 1097.00000f, 31.0000000f);
1743 path.lineTo(1088.00000f, 31.0000000f);
1744 path.lineTo(1088.00000f, 32.0000000f);
1745 path.lineTo(1097.00000f, 32.0000000f);
1746 path.quadTo(1098.65686f, 32.0000000f, 1099.82886f, 30.8288002f);
1747 path.quadTo(1101.00000f, 29.6568546f, 1101.00000f, 28.0000000f);
1748 path.lineTo(1101.00000f, 10.0000000f);
1749 path.quadTo(1101.00000f, 8.34314537f, 1099.82886f, 7.17119980f);
1750 path.lineTo(1099.82886f, 7.17117119f);
1753 pathB.setFillType(SkPath::kWinding_FillType);
1754 pathB.moveTo(1101.00000f, 6.00000000f);
1755 pathB.lineTo(1088.00000f, 6.00000000f);
1756 pathB.lineTo(1088.00000f, 19.0000000f);
1757 pathB.lineTo(1101.00000f, 32.0000000f);
1758 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1761 static void skpahrefs_com29(skiatest::Reporter* reporter, const char* filename) {
1763 path.setFillType(SkPath::kEvenOdd_FillType);
1764 path.moveTo(1037.17114f, 7.17119980f);
1765 path.quadTo(1038.34314f, 6.00000000f, 1040.00000f, 6.00000000f);
1766 path.lineTo(1074.00000f, 6.00000000f);
1767 path.lineTo(1074.00000f, 32.0000000f);
1768 path.lineTo(1040.00000f, 32.0000000f);
1769 path.quadTo(1038.34314f, 32.0000000f, 1037.17114f, 30.8288002f);
1770 path.quadTo(1036.00000f, 29.6568546f, 1036.00000f, 28.0000000f);
1771 path.lineTo(1036.00000f, 10.0000000f);
1772 path.quadTo(1036.00000f, 8.34314537f, 1037.17114f, 7.17119980f);
1774 path.moveTo(1037.00000f, 10.0000000f);
1775 path.cubicTo(1037.00000f, 8.34314537f, 1038.34314f, 7.00000000f, 1040.00000f, 7.00000000f);
1776 path.lineTo(1073.00000f, 7.00000000f);
1777 path.lineTo(1073.00000f, 31.0000000f);
1778 path.lineTo(1040.00000f, 31.0000000f);
1779 path.cubicTo(1038.34314f, 31.0000000f, 1037.00000f, 29.6568546f, 1037.00000f, 28.0000000f);
1780 path.lineTo(1037.00000f, 10.0000000f);
1783 pathB.setFillType(SkPath::kWinding_FillType);
1784 pathB.moveTo(1036.00000f, 32.0000000f);
1785 pathB.lineTo(1049.00000f, 19.0000000f);
1786 pathB.lineTo(1073.00000f, 31.0000000f);
1787 pathB.lineTo(1074.00000f, 32.0000000f);
1788 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1791 static void cubicOp85d(skiatest::Reporter* reporter, const char* filename) {
1793 path.setFillType(SkPath::kWinding_FillType);
1795 path.cubicTo(1,6, 1,0, 6,2);
1798 pathB.setFillType(SkPath::kWinding_FillType);
1800 pathB.cubicTo(2,6, 1,0, 6,1);
1802 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
1805 // this fails because the pair of nearly coincident cubics intersect at the ends
1806 // but the line connected to one of the cubics at the same point does not intersect
1808 static void skpkkiste_to98(skiatest::Reporter* reporter, const char* filename) {
1810 path.setFillType(SkPath::kEvenOdd_FillType);
1811 path.moveTo(96, 122);
1812 path.cubicTo(94.6192932f, 122, 93.3692932f, 122.559647f, 92.4644699f, 123.46447f);
1813 path.lineTo(94.1715698f, 125.17157f);
1814 path.cubicTo(94.8954315f, 124.447708f, 95.8954315f, 124, 97, 124);
1815 path.lineTo(257, 124);
1816 path.cubicTo(258.104553f, 124, 259.104584f, 124.447708f, 259.82843f, 125.17157f);
1817 path.lineTo(261.535522f, 123.46447f);
1818 path.cubicTo(260.630707f, 122.559647f, 259.380707f, 122, 258, 122);
1819 path.lineTo(96, 122);
1822 pathB.setFillType(SkPath::kWinding_FillType);
1823 pathB.moveTo(258, 122);
1824 pathB.cubicTo(260.761414f, 122, 263, 124.238579f, 263, 127);
1825 pathB.lineTo(263, 284);
1826 pathB.cubicTo(263, 286.761414f, 260.761414f, 289, 258, 289);
1827 pathB.lineTo(96, 289);
1828 pathB.cubicTo(93.2385788f, 289, 91, 286.761414f, 91, 284);
1829 pathB.lineTo(91, 127);
1830 pathB.cubicTo(91, 124.238579f, 93.2385788f, 122, 96, 122);
1831 pathB.lineTo(258, 122);
1833 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1836 static void issue1417(skiatest::Reporter* reporter, const char* filename) {
1838 path1.moveTo(122.58908843994140625f, 82.2836456298828125f);
1839 path1.quadTo(129.8215789794921875f, 80, 138, 80);
1840 path1.quadTo(147.15692138671875f, 80, 155.1280364990234375f, 82.86279296875f);
1841 path1.lineTo(161.1764678955078125f, 100);
1842 path1.lineTo(161.1764678955078125f, 100);
1843 path1.lineTo(115.29412078857421875f, 100);
1844 path1.lineTo(115.29412078857421875f, 100);
1845 path1.lineTo(122.58908843994140625f, 82.2836456298828125f);
1846 path1.lineTo(122.58908843994140625f, 82.2836456298828125f);
1848 path1.moveTo(98.68194580078125f, 140.343841552734375f);
1849 path1.lineTo(115.29412078857421875f, 100);
1850 path1.lineTo(115.29412078857421875f, 100);
1851 path1.lineTo(97.9337615966796875f, 100);
1852 path1.lineTo(97.9337615966796875f, 100);
1853 path1.quadTo(88, 112.94264984130859375f, 88, 130);
1854 path1.quadTo(88, 131.544830322265625f, 88.08148956298828125f, 133.0560302734375f);
1855 path1.lineTo(98.68194580078125f, 140.343841552734375f);
1856 path1.lineTo(98.68194580078125f, 140.343841552734375f);
1858 path1.moveTo(136.969696044921875f, 166.6666717529296875f);
1859 path1.lineTo(98.68194580078125f, 140.343841552734375f);
1860 path1.lineTo(98.68194580078125f, 140.343841552734375f);
1861 path1.lineTo(93.45894622802734375f, 153.02825927734375f);
1862 path1.lineTo(93.45894622802734375f, 153.02825927734375f);
1863 path1.quadTo(96.94116973876953125f, 159.65185546875f, 102.64466094970703125f, 165.3553466796875f);
1864 path1.quadTo(110.7924652099609375f, 173.503143310546875f, 120.8179779052734375f, 177.1177825927734375f);
1865 path1.lineTo(136.969696044921875f, 166.6666717529296875f);
1866 path1.lineTo(136.969696044921875f, 166.6666717529296875f);
1868 path1.moveTo(175.8309783935546875f, 141.5211334228515625f);
1869 path1.lineTo(136.969696044921875f, 166.6666717529296875f);
1870 path1.lineTo(136.969696044921875f, 166.6666717529296875f);
1871 path1.lineTo(153.15728759765625f, 177.7956390380859375f);
1872 path1.lineTo(153.15728759765625f, 177.7956390380859375f);
1873 path1.quadTo(164.392425537109375f, 174.318267822265625f, 173.3553466796875f, 165.3553466796875f);
1874 path1.quadTo(177.805816650390625f, 160.9048614501953125f, 180.90380859375f, 155.8941650390625f);
1875 path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
1876 path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
1878 path1.moveTo(175.8309783935546875f, 141.5211334228515625f);
1879 path1.lineTo(187.8782806396484375f, 133.7258148193359375f);
1880 path1.lineTo(187.8782806396484375f, 133.7258148193359375f);
1881 path1.quadTo(188, 131.8880615234375f, 188, 130);
1882 path1.quadTo(188, 112.942657470703125f, 178.0662384033203125f, 100);
1883 path1.lineTo(161.1764678955078125f, 100);
1884 path1.lineTo(161.1764678955078125f, 100);
1885 path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
1886 path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
1890 path2.moveTo(174.117645263671875f, 100);
1891 path2.lineTo(161.1764678955078125f, 100);
1892 path2.lineTo(161.1764678955078125f, 100);
1893 path2.lineTo(155.1280364990234375f, 82.86279296875f);
1894 path2.lineTo(155.1280364990234375f, 82.86279296875f);
1895 path2.quadTo(153.14971923828125f, 82.15229034423828125f, 151.098419189453125f, 81.618133544921875f);
1896 path2.lineTo(143.5294189453125f, 100);
1897 path2.lineTo(143.5294189453125f, 100);
1898 path2.lineTo(161.1764678955078125f, 100);
1899 path2.lineTo(161.1764678955078125f, 100);
1900 path2.lineTo(168.23529052734375f, 120);
1901 path2.lineTo(168.23529052734375f, 120);
1902 path2.lineTo(181.1764678955078125f, 120);
1903 path2.lineTo(181.1764678955078125f, 120);
1904 path2.lineTo(186.3661956787109375f, 134.7042236328125f);
1905 path2.lineTo(186.3661956787109375f, 134.7042236328125f);
1906 path2.lineTo(187.8782806396484375f, 133.7258148193359375f);
1907 path2.lineTo(187.8782806396484375f, 133.7258148193359375f);
1908 path2.quadTo(188, 131.8880615234375f, 188, 130);
1909 path2.quadTo(188, 124.80947113037109375f, 187.080169677734375f, 120);
1910 path2.lineTo(181.1764678955078125f, 120);
1911 path2.lineTo(181.1764678955078125f, 120);
1912 path2.lineTo(174.117645263671875f, 100);
1913 path2.lineTo(174.117645263671875f, 100);
1915 path2.moveTo(88.91983795166015625f, 120);
1916 path2.lineTo(107.0588226318359375f, 120);
1917 path2.lineTo(107.0588226318359375f, 120);
1918 path2.lineTo(98.68194580078125f, 140.343841552734375f);
1919 path2.lineTo(98.68194580078125f, 140.343841552734375f);
1920 path2.lineTo(88.08148956298828125f, 133.0560302734375f);
1921 path2.lineTo(88.08148956298828125f, 133.0560302734375f);
1922 path2.quadTo(88, 131.544830322265625f, 88, 130);
1923 path2.quadTo(88, 124.80951690673828125f, 88.91983795166015625f, 120);
1925 path2.moveTo(96.67621612548828125f, 145.21490478515625f);
1926 path2.lineTo(98.68194580078125f, 140.343841552734375f);
1927 path2.lineTo(98.68194580078125f, 140.343841552734375f);
1928 path2.lineTo(120.68767547607421875f, 155.4727783203125f);
1929 path2.lineTo(120.68767547607421875f, 155.4727783203125f);
1930 path2.lineTo(118.68194580078125f, 160.343841552734375f);
1931 path2.lineTo(118.68194580078125f, 160.343841552734375f);
1932 path2.lineTo(96.67621612548828125f, 145.21490478515625f);
1933 path2.lineTo(96.67621612548828125f, 145.21490478515625f);
1935 path2.moveTo(113.232177734375f, 173.5789947509765625f);
1936 path2.quadTo(116.8802642822265625f, 175.69805908203125f, 120.8179779052734375f, 177.1177825927734375f);
1937 path2.lineTo(132.2864990234375f, 169.6969757080078125f);
1938 path2.lineTo(132.2864990234375f, 169.6969757080078125f);
1939 path2.lineTo(118.68194580078125f, 160.343841552734375f);
1940 path2.lineTo(118.68194580078125f, 160.343841552734375f);
1941 path2.lineTo(113.232177734375f, 173.5789947509765625f);
1942 path2.lineTo(113.232177734375f, 173.5789947509765625f);
1945 testPathOp(reporter, path1, path2, kUnion_PathOp, filename);
1948 static void issue1418(skiatest::Reporter* reporter, const char* filename) {
1962 path2.moveTo(0.64644664525985717773f, -0.35355341434478759766f);
1963 path2.quadTo(0.79289329051971435547f, -0.50000005960464477539f, 1.0000001192092895508f, -0.50000005960464477539f);
1964 path2.quadTo(1.2071068286895751953f, -0.50000005960464477539f, 1.3535535335540771484f, -0.35355341434478759766f);
1965 path2.quadTo(1.5000001192092895508f, -0.20710679888725280762f, 1.5000001192092895508f, 0);
1966 path2.quadTo(1.5000001192092895508f, 0.20710679888725280762f, 1.3535535335540771484f, 0.35355341434478759766f);
1967 path2.quadTo(1.2071068286895751953f, 0.50000005960464477539f, 1.0000001192092895508f, 0.50000005960464477539f);
1968 path2.quadTo(0.79289329051971435547f, 0.50000005960464477539f, 0.64644664525985717773f, 0.35355341434478759766f);
1969 path2.quadTo(0.50000005960464477539f, 0.20710679888725280762f, 0.50000005960464477539f, 0);
1970 path2.quadTo(0.50000005960464477539f, -0.20710679888725280762f, 0.64644664525985717773f, -0.35355341434478759766f);
1971 testPathOp(reporter, path1, path2, kIntersect_PathOp, filename);
1974 static void cubicOp85i(skiatest::Reporter* reporter, const char* filename) {
1976 path.setFillType(SkPath::kWinding_FillType);
1978 path.cubicTo(1, 5, 4, 3, 6, 4);
1980 pathB.setFillType(SkPath::kWinding_FillType);
1982 pathB.cubicTo(4, 6, 4, 3, 5, 1);
1984 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
1987 static void issue1418b(skiatest::Reporter* reporter, const char* filename) {
1995 path1.setFillType(SkPath::kWinding_FillType);
1997 path2.moveTo(0.646446645f, -0.353553414f);
1998 path2.quadTo(0.792893291f, -0.50000006f, 1.00000012f, -0.50000006f);
1999 path2.quadTo(1.20710683f, -0.50000006f, 1.35355353f, -0.353553414f);
2000 path2.quadTo(1.50000012f, -0.207106799f, 1.50000012f, 0);
2001 path2.quadTo(1.50000012f, 0.207106799f, 1.35355353f, 0.353553414f);
2002 path2.quadTo(1.20710683f, 0.50000006f, 1.00000012f, 0.50000006f);
2003 path2.quadTo(0.792893291f, 0.50000006f, 0.646446645f, 0.353553414f);
2004 path2.quadTo(0.50000006f, 0.207106799f, 0.50000006f, 0);
2005 path2.quadTo(0.50000006f, -0.207106799f, 0.646446645f, -0.353553414f);
2007 path2.moveTo(1.00000012f, 0.50000006f);
2008 path2.lineTo(1.00000012f, 1.00000012f);
2009 path2.lineTo(0.50000006f, 1.00000012f);
2010 path2.quadTo(0.50000006f, 0.792893291f, 0.646446645f, 0.646446645f);
2011 path2.quadTo(0.792893291f, 0.50000006f, 1.00000012f, 0.50000006f);
2013 path2.setFillType(SkPath::kEvenOdd_FillType);
2014 testPathOp(reporter, path1, path2, kIntersect_PathOp, filename);
2017 static void rectOp1i(skiatest::Reporter* reporter, const char* filename) {
2019 path.setFillType(SkPath::kWinding_FillType);
2020 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
2021 path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
2022 pathB.setFillType(SkPath::kWinding_FillType);
2023 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
2024 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
2025 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2028 static void rectOp2i(skiatest::Reporter* reporter, const char* filename) {
2030 path.setFillType(SkPath::kEvenOdd_FillType);
2031 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
2032 path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
2033 pathB.setFillType(SkPath::kWinding_FillType);
2034 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
2035 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
2036 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2039 static void rectOp3x(skiatest::Reporter* reporter, const char* filename) {
2041 path.setFillType(SkPath::kEvenOdd_FillType);
2052 pathB.setFillType(SkPath::kWinding_FillType);
2063 testPathOp(reporter, path, pathB, kXOR_PathOp, filename);
2066 // this fails to generate two interior line segments
2067 // an earlier pathops succeeded, but still failed to generate one interior line segment
2068 // (but was saved by assemble, which works around a single line missing segment)
2069 static void issue1435(skiatest::Reporter* reporter, const char* filename) {
2071 path1.moveTo(160, 60);
2072 path1.lineTo(220, 230);
2073 path1.lineTo(60, 120);
2074 path1.lineTo(260, 120);
2075 path1.lineTo(90, 230);
2076 path1.lineTo(160, 60);
2078 path1.setFillType(SkPath::kEvenOdd_FillType);
2081 path2.moveTo(142.589081f, 102.283646f);
2082 path2.quadTo(149.821579f, 100, 158, 100);
2083 path2.quadTo(167.156921f, 100, 175.128036f, 102.862793f);
2084 path2.lineTo(181.176468f, 120);
2085 path2.lineTo(135.294128f, 120);
2086 path2.lineTo(142.589081f, 102.283646f);
2088 path2.moveTo(118.681946f, 160.343842f);
2089 path2.lineTo(135.294128f, 120);
2090 path2.lineTo(117.933762f, 120);
2091 path2.quadTo(108, 132.942657f, 108, 150);
2092 path2.quadTo(108, 151.54483f, 108.08149f, 153.05603f);
2093 path2.lineTo(118.681946f, 160.343842f);
2095 path2.moveTo(156.969696f, 186.666672f);
2096 path2.lineTo(118.681946f, 160.343842f);
2097 path2.lineTo(113.458946f, 173.028259f);
2098 path2.quadTo(116.94117f, 179.651855f, 122.644661f, 185.355347f);
2099 path2.quadTo(130.792465f, 193.503143f, 140.817978f, 197.117783f);
2100 path2.lineTo(156.969696f, 186.666672f);
2102 path2.moveTo(195.830978f, 161.521133f);
2103 path2.lineTo(156.969696f, 186.666672f);
2104 path2.lineTo(173.157288f, 197.795639f);
2105 path2.quadTo(184.392426f, 194.318268f, 193.355347f, 185.355347f);
2106 path2.quadTo(197.805817f, 180.904861f, 200.903809f, 175.894165f);
2107 path2.lineTo(195.830978f, 161.521133f);
2109 path2.moveTo(195.830978f, 161.521133f);
2110 path2.lineTo(207.878281f, 153.725815f);
2111 path2.quadTo(208, 151.888062f, 208, 150);
2112 path2.quadTo(208, 132.942657f, 198.066238f, 120);
2113 path2.lineTo(181.176468f, 120);
2114 path2.lineTo(195.830978f, 161.521133f);
2116 path2.setFillType(SkPath::kEvenOdd_FillType);
2117 testPathOp(reporter, path1, path2, kIntersect_PathOp, filename);
2120 static void skpkkiste_to716(skiatest::Reporter* reporter, const char* filename) {
2122 path.setFillType(SkPath::kEvenOdd_FillType);
2123 path.moveTo(1173, 284);
2124 path.cubicTo(1173, 285.125824f, 1173.37207f, 286.164734f, 1174, 287.000488f);
2125 path.lineTo(1174, 123.999496f);
2126 path.cubicTo(1173.37207f, 124.835243f, 1173, 125.874168f, 1173, 127);
2127 path.lineTo(1173, 284);
2130 pathB.setFillType(SkPath::kWinding_FillType);
2131 pathB.moveTo(1340, 122);
2132 pathB.cubicTo(1342.76147f, 122, 1345, 124.238579f, 1345, 127);
2133 pathB.lineTo(1345, 284);
2134 pathB.cubicTo(1345, 286.761414f, 1342.76147f, 289, 1340, 289);
2135 pathB.lineTo(1178, 289);
2136 pathB.cubicTo(1175.23853f, 289, 1173, 286.761414f, 1173, 284);
2137 pathB.lineTo(1173, 127);
2138 pathB.cubicTo(1173, 124.238579f, 1175.23853f, 122, 1178, 122);
2139 pathB.lineTo(1340, 122);
2141 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2144 static void loopEdge1(skiatest::Reporter* reporter, const char* filename) {
2146 path.setFillType(SkPath::kEvenOdd_FillType);
2157 pathB.setFillType(SkPath::kEvenOdd_FillType);
2163 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2166 static void loopEdge2(skiatest::Reporter* reporter, const char* filename) {
2168 path.setFillType(SkPath::kEvenOdd_FillType);
2179 pathB.setFillType(SkPath::kEvenOdd_FillType);
2180 pathB.moveTo(1 - 1e-6f,2);
2181 pathB.lineTo(2 - 1e-6f,2);
2182 pathB.lineTo(2 - 1e-6f,4);
2183 pathB.lineTo(1 - 1e-6f,4);
2185 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2188 static void cubicOp86i(skiatest::Reporter* reporter, const char* filename) {
2190 path.setFillType(SkPath::kWinding_FillType);
2192 path.cubicTo(3, 4, 6, 2, 5, 2);
2194 pathB.setFillType(SkPath::kEvenOdd_FillType);
2196 pathB.cubicTo(2, 5, 4, 0, 4, 3);
2198 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2201 static void cubicOp87u(skiatest::Reporter* reporter, const char* filename) {
2203 path.setFillType(SkPath::kWinding_FillType);
2205 path.cubicTo(0,2, 2,0, 6,4);
2207 pathB.setFillType(SkPath::kWinding_FillType);
2209 pathB.cubicTo(4,6, 1,0, 2,0);
2211 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
2214 static void cubicOp88u(skiatest::Reporter* reporter, const char* filename) {
2216 path.setFillType(SkPath::kWinding_FillType);
2218 path.cubicTo(2,5, 5,0, 6,4);
2220 pathB.setFillType(SkPath::kWinding_FillType);
2222 pathB.cubicTo(4,6, 1,0, 5,2);
2224 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
2227 static void cubicOp89u(skiatest::Reporter* reporter, const char* filename) {
2229 path.setFillType(SkPath::kWinding_FillType);
2231 path.cubicTo(1, 6, 5, 0, 6, 3);
2233 pathB.setFillType(SkPath::kWinding_FillType);
2235 pathB.cubicTo(3, 6, 3, 0, 6, 1);
2237 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
2240 static void cubicOp90u(skiatest::Reporter* reporter, const char* filename) {
2242 path.setFillType(SkPath::kEvenOdd_FillType);
2244 path.cubicTo(1, 2, 5, 2, 4, 1);
2246 pathB.setFillType(SkPath::kEvenOdd_FillType);
2248 pathB.cubicTo(1, 4, 5, 0, 2, 1);
2250 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
2253 static void cubicOp91u(skiatest::Reporter* reporter, const char* filename) {
2255 path.setFillType(SkPath::kWinding_FillType);
2257 path.cubicTo(0, 3, 6, 3, 5, 0);
2259 pathB.setFillType(SkPath::kWinding_FillType);
2261 pathB.cubicTo(0, 5, 6, 1, 3, 0);
2263 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
2266 static void skpaaalgarve_org53(skiatest::Reporter* reporter, const char* filename) { // add t cancel
2268 path.setFillType(SkPath::kEvenOdd_FillType);
2269 path.moveTo(-1.24344979e-014f, 348);
2270 path.lineTo(258, 348);
2271 path.lineTo(258, 322);
2272 path.quadTo(258, 317.857849f, 255.072006f, 314.928009f);
2273 path.quadTo(252.142136f, 312, 248, 312);
2274 path.lineTo(1.77635684e-015f, 312);
2275 path.lineTo(-1.24344979e-014f, 348);
2278 pathB.setFillType(SkPath::kWinding_FillType);
2279 pathB.moveTo(0, 312);
2280 pathB.lineTo(258, 312);
2281 pathB.lineTo(258, 348);
2282 pathB.lineTo(0, 348);
2284 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2287 static void skpabcspark_ca103(skiatest::Reporter* reporter, const char* filename) { // add t cancel
2289 path.setFillType(SkPath::kEvenOdd_FillType);
2290 path.moveTo(1.99840144e-015f, 494);
2291 path.lineTo(97, 494);
2292 path.quadTo(100.313705f, 494, 102.6576f, 491.657593f);
2293 path.quadTo(105, 489.313721f, 105, 486);
2294 path.lineTo(105, 425);
2295 path.quadTo(105, 421.686279f, 102.6576f, 419.342407f);
2296 path.quadTo(100.313705f, 417, 97, 417);
2297 path.lineTo(2.22044605e-016f, 417);
2298 path.lineTo(1.99840144e-015f, 494);
2301 pathB.setFillType(SkPath::kWinding_FillType);
2302 pathB.moveTo(0, 417);
2303 pathB.lineTo(105, 417);
2304 pathB.lineTo(105, 494);
2305 pathB.lineTo(0, 494);
2307 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2310 static void skpacesoftech_com47(skiatest::Reporter* reporter, const char* filename) { // partial coincidence
2312 path.setFillType(SkPath::kEvenOdd_FillType);
2313 path.moveTo(670.537415f, 285);
2314 path.lineTo(670.387451f, 285);
2315 path.lineTo(596.315186f, 314.850708f);
2316 path.lineTo(626.19696f, 389);
2317 path.lineTo(626.346863f, 389);
2318 path.lineTo(700.419189f, 359.149261f);
2319 path.lineTo(670.537415f, 285);
2322 pathB.setFillType(SkPath::kWinding_FillType);
2323 pathB.moveTo(663.318542f, 374.100616f);
2324 pathB.quadTo(647.950989f, 380.293671f, 632.705322f, 373.806305f);
2325 pathB.quadTo(617.459595f, 367.318909f, 611.266541f, 351.951355f);
2326 pathB.quadTo(605.073486f, 336.58374f, 611.560913f, 321.338074f);
2327 pathB.quadTo(618.048279f, 306.092407f, 633.415833f, 299.899353f);
2328 pathB.quadTo(648.783447f, 293.706299f, 664.029114f, 300.193665f);
2329 pathB.quadTo(679.27478f, 306.68103f, 685.467834f, 322.048645f);
2330 pathB.quadTo(691.660889f, 337.416199f, 685.173523f, 352.661896f);
2331 pathB.quadTo(678.686157f, 367.907562f, 663.318542f, 374.100616f);
2333 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2336 static void skpact_com43(skiatest::Reporter* reporter, const char* filename) { // bridge op
2338 path.setFillType(SkPath::kEvenOdd_FillType);
2339 path.moveTo(1.45716772e-016f, 924.336121f);
2340 path.lineTo(-1.11022302e-016f, 920);
2341 path.lineTo(6, 920);
2342 path.lineTo(6, 926);
2343 path.lineTo(1.66389287f, 926);
2344 path.quadTo(1.18842196f, 925.674561f, 0.756800175f, 925.243225f);
2345 path.quadTo(0.325406998f, 924.811523f, 1.45716772e-016f, 924.336121f);
2347 path.moveTo(1, 921);
2348 path.lineTo(5, 921);
2349 path.lineTo(5, 925);
2350 path.cubicTo(2.79086018f, 925, 1, 923.209167f, 1, 921);
2353 pathB.setFillType(SkPath::kWinding_FillType);
2354 pathB.moveTo(-1, 920);
2355 pathB.lineTo(0, 920);
2356 pathB.lineTo(3, 927);
2357 pathB.lineTo(-1, 927);
2358 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2361 static void skpadbox_lt8(skiatest::Reporter* reporter, const char* filename) { // zero span
2363 path.setFillType(SkPath::kEvenOdd_FillType);
2364 path.moveTo(320.097229f, 628.573669f);
2365 path.lineTo(610.227173f, 85.7786865f);
2366 path.lineTo(946.652588f, 265.601807f);
2367 path.lineTo(656.522644f, 808.39679f);
2368 path.lineTo(320.097229f, 628.573669f);
2371 pathB.setFillType(SkPath::kInverseWinding_FillType);
2372 pathB.moveTo(333.866608f, 623.496155f);
2373 pathB.lineTo(613.368042f, 100.585754f);
2374 pathB.cubicTo(613.685303f, 99.9921265f, 614.423767f, 99.7681885f, 615.017395f, 100.085449f);
2375 pathB.lineTo(932.633057f, 269.854553f);
2376 pathB.cubicTo(933.226685f, 270.171875f, 933.450623f, 270.910278f, 933.133301f, 271.503906f);
2377 pathB.lineTo(653.631897f, 794.414307f);
2378 pathB.cubicTo(653.314636f, 795.007935f, 652.576172f, 795.231934f, 651.982544f, 794.914612f);
2379 pathB.lineTo(334.366943f, 625.145508f);
2380 pathB.cubicTo(333.773315f, 624.828247f, 333.549286f, 624.089783f, 333.866608f, 623.496155f);
2382 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2385 static void skpadindex_de4(skiatest::Reporter* reporter, const char* filename) { // find chase op
2387 path.setFillType(SkPath::kEvenOdd_FillType);
2388 path.moveTo(0, 926);
2390 path.lineTo(1280, 0);
2391 path.lineTo(1280, 926);
2392 path.lineTo(0, 926);
2395 pathB.setFillType(SkPath::kWinding_FillType);
2396 pathB.moveTo(0, 312);
2397 pathB.lineTo(8.20486257e-015f, 178);
2398 pathB.lineTo(49, 178);
2399 pathB.lineTo(49, 312);
2401 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2404 static void skpadithya_putr4_blogspot_com551(skiatest::Reporter* reporter, const char* filename) { // calc common
2406 path.setFillType(SkPath::kEvenOdd_FillType);
2407 path.moveTo(205.605804f, 142.334625f);
2408 path.lineTo(254.665359f, 85.6058044f);
2409 path.lineTo(311.394196f, 134.665359f);
2410 path.lineTo(262.334625f, 191.39418f);
2411 path.lineTo(205.605804f, 142.334625f);
2414 pathB.setFillType(SkPath::kWinding_FillType);
2415 pathB.moveTo(283.407959f, 110.462646f);
2416 pathB.cubicTo(298.864319f, 123.829437f, 300.558258f, 147.195221f, 287.191467f, 162.651581f);
2417 pathB.lineTo(286.537354f, 163.407959f);
2418 pathB.cubicTo(273.170563f, 178.864334f, 249.804779f, 180.558258f, 234.348419f, 167.191467f);
2419 pathB.lineTo(233.592026f, 166.537338f);
2420 pathB.cubicTo(218.135666f, 153.170547f, 216.441727f, 129.804779f, 229.808517f, 114.348412f);
2421 pathB.lineTo(230.462646f, 113.592026f);
2422 pathB.cubicTo(243.829437f, 98.1356659f, 267.195221f, 96.4417267f, 282.651581f, 109.808517f);
2423 pathB.lineTo(283.407959f, 110.462646f);
2425 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2428 static void skpadspert_de11(skiatest::Reporter* reporter, const char* filename) { // mark and chase winding
2430 path.setFillType(SkPath::kEvenOdd_FillType);
2431 path.moveTo(-4.4408921e-016f, 682.5f);
2432 path.lineTo(30.5f, 682.5f);
2433 path.cubicTo(32.709137f, 682.5f, 34.5f, 680.709167f, 34.5f, 678.5f);
2434 path.lineTo(34.5f, 486.5f);
2435 path.cubicTo(34.5f, 484.290863f, 32.709137f, 482.5f, 30.5f, 482.5f);
2436 path.lineTo(0, 482.5f);
2437 path.lineTo(-4.4408921e-016f, 682.5f);
2440 pathB.setFillType(SkPath::kWinding_FillType);
2441 pathB.moveTo(0, 482);
2442 pathB.lineTo(35, 482);
2443 pathB.lineTo(35, 683);
2444 pathB.lineTo(0, 683);
2446 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2449 static void skpaiaigames_com870(skiatest::Reporter* reporter, const char* filename) { // cubic/cubic intersect
2451 path.setFillType(SkPath::kEvenOdd_FillType);
2452 path.moveTo(324.071075f, 845.071045f);
2453 path.cubicTo(324.405151f, 844.737f, 324.715668f, 844.379395f, 325, 844.000977f);
2454 path.lineTo(325, 842.127197f);
2455 path.cubicTo(324.571411f, 842.956238f, 324.017761f, 843.710144f, 323.363953f, 844.363953f);
2456 path.lineTo(324.071075f, 845.071045f);
2458 path.moveTo(323.363953f, 714.636047f);
2459 path.lineTo(324.071075f, 713.928955f);
2460 path.cubicTo(324.405151f, 714.263f, 324.715668f, 714.620605f, 325, 714.999023f);
2461 path.lineTo(325, 716.872803f);
2462 path.cubicTo(324.571411f, 716.043762f, 324.017761f, 715.289856f, 323.363953f, 714.636047f);
2465 pathB.setFillType(SkPath::kWinding_FillType);
2466 pathB.moveTo(317, 711);
2467 pathB.cubicTo(322.522858f, 711, 327, 715.477173f, 327, 721);
2468 pathB.lineTo(327, 838);
2469 pathB.cubicTo(327, 843.522827f, 322.522858f, 848, 317, 848);
2470 pathB.lineTo(155, 848);
2471 pathB.cubicTo(149.477158f, 848, 145, 843.522827f, 145, 838);
2472 pathB.lineTo(145, 721);
2473 pathB.cubicTo(145, 715.477173f, 149.477158f, 711, 155, 711);
2474 pathB.lineTo(317, 711);
2476 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2479 static void cubicOp92i(skiatest::Reporter* reporter, const char* filename) {
2481 path.setFillType(SkPath::kWinding_FillType);
2483 path.cubicTo(2, 6, 4, 1, 5, 4);
2485 pathB.setFillType(SkPath::kWinding_FillType);
2487 pathB.cubicTo(4, 5, 1, 0, 6, 2);
2489 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2492 static void cubicOp93d(skiatest::Reporter* reporter, const char* filename) {
2494 path.setFillType(SkPath::kWinding_FillType);
2496 path.cubicTo(1, 6, 4, 1, 4, 3);
2498 pathB.setFillType(SkPath::kWinding_FillType);
2500 pathB.cubicTo(3, 4, 1, 0, 6, 1);
2502 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
2505 static void cubicOp94u(skiatest::Reporter* reporter, const char* filename) {
2507 path.setFillType(SkPath::kEvenOdd_FillType);
2509 path.cubicTo(2, 3, 5, 0, 5, 3);
2511 pathB.setFillType(SkPath::kEvenOdd_FillType);
2513 pathB.cubicTo(3, 5, 3, 0, 3, 2);
2515 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
2518 static void skpadbox_lt15(skiatest::Reporter* reporter, const char* filename) {
2520 path.setFillType(SkPath::kEvenOdd_FillType);
2521 path.moveTo(333.292084f, 624.570984f);
2522 path.lineTo(614.229797f, 98.9735107f);
2523 path.lineTo(933.457764f, 269.604431f);
2524 path.lineTo(652.52002f, 795.201904f);
2525 path.lineTo(333.292084f, 624.570984f);
2528 pathB.setFillType(SkPath::kWinding_FillType);
2529 pathB.moveTo(613.368042f, 100.585754f);
2530 pathB.cubicTo(613.685303f, 99.9921265f, 614.423767f, 99.7681885f, 615.017395f, 100.085449f);
2531 pathB.lineTo(932.633057f, 269.854553f);
2532 pathB.cubicTo(933.226685f, 270.171875f, 933.450623f, 270.910278f, 933.133301f, 271.503906f);
2533 pathB.lineTo(653.631897f, 794.414307f);
2534 pathB.cubicTo(653.314636f, 795.007935f, 652.576172f, 795.231934f, 651.982544f, 794.914612f);
2535 pathB.lineTo(334.366943f, 625.145508f);
2536 pathB.cubicTo(333.773315f, 624.828247f, 333.549286f, 624.089783f, 333.866608f, 623.496155f);
2537 pathB.lineTo(613.368042f, 100.585754f);
2539 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2542 static void skpadoption_org196(skiatest::Reporter* reporter, const char* filename) {
2544 path.setFillType(SkPath::kEvenOdd_FillType);
2545 path.moveTo(802, 367);
2546 path.lineTo(802, 324);
2547 path.lineTo(956, 324);
2548 path.lineTo(956, 371);
2549 path.quadTo(956, 373.071075f, 954.536011f, 374.536011f);
2550 path.quadTo(953.071045f, 376, 951, 376);
2551 path.lineTo(811, 376);
2552 path.cubicTo(806.029419f, 376, 802, 371.970551f, 802, 367);
2555 pathB.setFillType(SkPath::kInverseWinding_FillType);
2556 pathB.moveTo(803, 326);
2557 pathB.lineTo(955, 326);
2558 pathB.lineTo(955, 370);
2559 pathB.cubicTo(955, 372.761414f, 952.761414f, 375, 950, 375);
2560 pathB.lineTo(808, 375);
2561 pathB.cubicTo(805.238586f, 375, 803, 372.761414f, 803, 370);
2562 pathB.lineTo(803, 326);
2564 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2567 static void skpadspert_net23(skiatest::Reporter* reporter, const char* filename) {
2569 path.setFillType(SkPath::kEvenOdd_FillType);
2570 path.moveTo(-2.220446e-018f, 483.5f);
2571 path.lineTo(0, 482.5f);
2572 path.lineTo(30.5f, 482.5f);
2573 path.cubicTo(32.709137f, 482.5f, 34.5f, 484.290863f, 34.5f, 486.5f);
2574 path.lineTo(34.5f, 678.5f);
2575 path.cubicTo(34.5f, 680.709167f, 32.709137f, 682.5f, 30.5f, 682.5f);
2576 path.lineTo(-4.4408921e-016f, 682.5f);
2577 path.lineTo(-4.41868766e-016f, 681.5f);
2578 path.lineTo(30.5f, 681.5f);
2579 path.cubicTo(32.1568565f, 681.5f, 33.5f, 680.15686f, 33.5f, 678.5f);
2580 path.lineTo(33.5f, 486.5f);
2581 path.cubicTo(33.5f, 484.84314f, 32.1568565f, 483.5f, 30.5f, 483.5f);
2582 path.lineTo(-2.220446e-018f, 483.5f);
2585 pathB.setFillType(SkPath::kWinding_FillType);
2586 pathB.moveTo(0, 482);
2587 pathB.lineTo(35, 482);
2588 pathB.lineTo(35, 683);
2589 pathB.lineTo(0, 683);
2591 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2594 static void skpadventistmission_org572(skiatest::Reporter* reporter, const char* filename) {
2596 path.setFillType(SkPath::kEvenOdd_FillType);
2597 path.moveTo(1182.00037f, 926);
2598 path.cubicTo(1181.08813f, 924.785583f, 1179.63586f, 924, 1178, 924);
2599 path.lineTo(938, 924);
2600 path.cubicTo(936.364197f, 924, 934.911865f, 924.785583f, 933.999634f, 926);
2601 path.lineTo(1182.00037f, 926);
2604 pathB.setFillType(SkPath::kWinding_FillType);
2605 pathB.moveTo(934, 924);
2606 pathB.lineTo(1182, 924);
2607 pathB.lineTo(1182, 926);
2608 pathB.lineTo(934, 926);
2610 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2613 static void skpagentxsites_com55(skiatest::Reporter* reporter, const char* filename) {
2615 path.setFillType(SkPath::kEvenOdd_FillType);
2616 path.moveTo(925, 27);
2617 path.cubicTo(924.447693f, 27, 924, 27.4477158f, 924, 28);
2618 path.lineTo(924, 55);
2619 path.cubicTo(924, 55.5522842f, 924.447693f, 56, 925, 56);
2620 path.lineTo(1103, 56);
2621 path.cubicTo(1103.55225f, 56, 1104, 55.5522842f, 1104, 55);
2622 path.lineTo(1104, 28);
2623 path.cubicTo(1104, 27.4477158f, 1103.55225f, 27, 1103, 27);
2624 path.lineTo(925, 27);
2627 pathB.setFillType(SkPath::kWinding_FillType);
2628 pathB.moveTo(1103, 27);
2629 pathB.cubicTo(1104.10461f, 27, 1105, 27.8954315f, 1105, 29);
2630 pathB.lineTo(1105, 54);
2631 pathB.cubicTo(1105, 55.1045685f, 1104.10461f, 56, 1103, 56);
2632 pathB.lineTo(926, 56);
2633 pathB.cubicTo(924.895447f, 56, 924, 55.1045685f, 924, 54);
2634 pathB.lineTo(924, 29);
2635 pathB.cubicTo(924, 27.8954315f, 924.895447f, 27, 926, 27);
2636 pathB.lineTo(1103, 27);
2638 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2641 static void skpbakosoft_com10(skiatest::Reporter* reporter, const char* filename) {
2643 path.setFillType(SkPath::kEvenOdd_FillType);
2644 path.moveTo(190, 170);
2645 path.cubicTo(178.9543f, 170, 170, 178.9543f, 170, 190);
2646 path.cubicTo(170, 201.0457f, 178.9543f, 210, 190, 210);
2647 path.lineTo(370, 210);
2648 path.cubicTo(381.045685f, 210, 390, 201.0457f, 390, 190);
2649 path.cubicTo(390, 178.9543f, 381.045685f, 170, 370, 170);
2650 path.lineTo(190, 170);
2653 pathB.setFillType(SkPath::kWinding_FillType);
2654 pathB.moveTo(210, 190);
2655 pathB.quadTo(210, 198.284271f, 204.142136f, 204.142136f);
2656 pathB.quadTo(198.284271f, 210, 190, 210);
2657 pathB.quadTo(181.715729f, 210, 175.857864f, 204.142136f);
2658 pathB.quadTo(170, 198.284271f, 170, 190);
2659 pathB.quadTo(170, 181.715729f, 175.857864f, 175.857864f);
2660 pathB.quadTo(181.715729f, 170, 190, 170);
2661 pathB.quadTo(198.284271f, 170, 204.142136f, 175.857864f);
2662 pathB.quadTo(210, 181.715729f, 210, 190);
2664 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2667 static void skpbambootheme_com12(skiatest::Reporter* reporter, const char* filename) {
2669 path.setFillType(SkPath::kEvenOdd_FillType);
2670 path.moveTo(47.8780937f, 58);
2672 path.lineTo(-8.65973959e-015f, 96.9914017f);
2673 path.quadTo(20.0654926f, 96.6451874f, 34.3553391f, 82.3553391f);
2674 path.quadTo(44.9466133f, 71.764061f, 47.8780937f, 58);
2677 pathB.setFillType(SkPath::kEvenOdd_FillType);
2678 pathB.moveTo(-1, -3);
2679 pathB.lineTo(-1, -3);
2680 pathB.cubicTo(26.6142502f, -3, 49, 19.3857498f, 49, 47);
2681 pathB.lineTo(49, 47);
2682 pathB.cubicTo(49, 74.6142502f, 26.6142502f, 97, -1, 97);
2683 pathB.lineTo(-1, 97);
2684 pathB.cubicTo(-28.6142502f, 97, -51, 74.6142502f, -51, 47);
2685 pathB.lineTo(-51, 47);
2686 pathB.cubicTo(-51, 19.3857498f, -28.6142502f, -3, -1, -3);
2688 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2691 static void skpakmmos_ru100(skiatest::Reporter* reporter, const char* filename) {
2693 path.setFillType(SkPath::kEvenOdd_FillType);
2694 path.moveTo(693.000488f, 926);
2695 path.cubicTo(692.164734f, 925.37207f, 691.125793f, 925, 690, 925);
2696 path.lineTo(578, 925);
2697 path.cubicTo(576.874207f, 925, 575.835266f, 925.37207f, 574.999512f, 926);
2698 path.lineTo(693.000488f, 926);
2701 pathB.setFillType(SkPath::kWinding_FillType);
2702 pathB.moveTo(575, 925);
2703 pathB.lineTo(693, 925);
2704 pathB.lineTo(693, 926);
2705 pathB.lineTo(575, 926);
2707 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2710 static void skpcarpetplanet_ru22(skiatest::Reporter* reporter, const char* filename) {
2712 path.setFillType(SkPath::kEvenOdd_FillType);
2713 path.moveTo(195, 785);
2714 path.cubicTo(124.307556f, 785, 67, 841.859863f, 67, 912);
2715 path.lineTo(67, 913);
2716 path.cubicTo(67, 917.388916f, 67.2243805f, 921.725769f, 67.662384f, 926);
2717 path.lineTo(322, 926);
2718 path.lineTo(322, 896.048035f);
2719 path.cubicTo(314.09201f, 833.437622f, 260.247131f, 785, 195, 785);
2722 pathB.setFillType(SkPath::kWinding_FillType);
2723 pathB.moveTo(195, 785);
2724 pathB.cubicTo(265.140167f, 785, 322, 842.307556f, 322, 913);
2725 pathB.cubicTo(322, 983.692444f, 265.140167f, 1041, 195, 1041);
2726 pathB.lineTo(194, 1041);
2727 pathB.cubicTo(123.85984f, 1041, 67, 983.692444f, 67, 913);
2728 pathB.cubicTo(67, 842.307556f, 123.85984f, 785, 194, 785);
2729 pathB.lineTo(195, 785);
2731 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2734 // 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) {
2736 if (!FLAGS_runFail) {
2740 path.setFillType(SkPath::kEvenOdd_FillType);
2741 path.moveTo(945, 597);
2742 path.quadTo(913.93396f, 597, 891.96698f, 618.96698f);
2743 path.quadTo(870, 640.93396f, 870, 672);
2744 path.quadTo(870, 703.06604f, 891.96698f, 725.03302f);
2745 path.quadTo(913.93396f, 747, 945, 747);
2746 path.quadTo(976.06604f, 747, 998.03302f, 725.03302f);
2747 path.quadTo(1020, 703.06604f, 1020, 672);
2748 path.quadTo(1020, 640.93396f, 998.03302f, 618.96698f);
2749 path.quadTo(976.06604f, 597, 945, 597);
2752 pathB.setFillType(SkPath::kWinding_FillType);
2753 pathB.moveTo(945.080994f, 597.161987f);
2754 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.971008f, 683.726013f);
2756 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.19104f, 683.726013f);
2758 pathB.cubicTo(1019.77502f, 679.955017f, 1020.08099f, 676.094971f, 1020.08099f, 672.161987f);
2759 pathB.cubicTo(1020.08002f, 630.73999f, 986.502014f, 597.161987f, 945.080994f, 597.161987f);
2761 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2764 static void skpbangalorenest_com4(skiatest::Reporter* reporter, const char* filename) {
2766 path.setFillType(SkPath::kEvenOdd_FillType);
2767 path.moveTo(0, 926);
2769 path.lineTo(1265, 0);
2770 path.lineTo(1265, 926);
2771 path.lineTo(0, 926);
2774 pathB.setFillType(SkPath::kWinding_FillType);
2775 pathB.moveTo(0, 290);
2776 pathB.lineTo(-2.64514972e-014f, 146);
2777 pathB.lineTo(30, 146);
2778 pathB.lineTo(30, 290);
2780 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2783 static void skpbenzoteh_ru152(skiatest::Reporter* reporter, const char* filename) {
2785 path.setFillType(SkPath::kEvenOdd_FillType);
2786 path.moveTo(883, 23);
2787 path.lineTo(883, 0);
2788 path.lineTo(1122.5f, 0);
2789 path.lineTo(1122.5f, 25.2136822f);
2790 path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2791 path.quadTo(1120.07104f, 28, 1118, 28);
2792 path.lineTo(888, 28);
2793 path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2794 path.quadTo(883, 25.0710678f, 883, 23);
2797 pathB.setFillType(SkPath::kWinding_FillType);
2798 pathB.moveTo(883, 0);
2799 pathB.lineTo(1123, 0);
2800 pathB.lineTo(1123, 23);
2801 pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2802 pathB.quadTo(1120.07104f, 28, 1118, 28);
2803 pathB.lineTo(888, 28);
2804 pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2805 pathB.quadTo(883, 25.0710678f, 883, 23);
2807 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2810 static void skpbestred_ru37(skiatest::Reporter* reporter, const char* filename) {
2812 path.setFillType(SkPath::kEvenOdd_FillType);
2813 path.moveTo(883, 23);
2814 path.lineTo(883, 0);
2815 path.lineTo(1122.5f, 0);
2816 path.lineTo(1122.5f, 25.2136822f);
2817 path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2818 path.quadTo(1120.07104f, 28, 1118, 28);
2819 path.lineTo(888, 28);
2820 path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2821 path.quadTo(883, 25.0710678f, 883, 23);
2824 pathB.setFillType(SkPath::kWinding_FillType);
2825 pathB.moveTo(883, 0);
2826 pathB.lineTo(1123, 0);
2827 pathB.lineTo(1123, 23);
2828 pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2829 pathB.quadTo(1120.07104f, 28, 1118, 28);
2830 pathB.lineTo(888, 28);
2831 pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2832 pathB.quadTo(883, 25.0710678f, 883, 23);
2834 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2837 static void skpbingoentertainment_net189(skiatest::Reporter* reporter, const char* filename) {
2839 path.setFillType(SkPath::kEvenOdd_FillType);
2840 path.moveTo(896, 745.38678f);
2841 path.lineTo(896, 873.38678f);
2842 path.lineTo(922.567993f, 876.683716f);
2843 path.lineTo(922.567993f, 748.683716f);
2844 path.lineTo(896, 745.38678f);
2847 pathB.setFillType(SkPath::kWinding_FillType);
2848 pathB.moveTo(899.200928f, 745.783997f);
2849 pathB.cubicTo(897.119385f, 745.525696f, 895.432007f, 752.031982f, 895.432007f, 760.316284f);
2850 pathB.lineTo(895.432007f, 858.316284f);
2851 pathB.cubicTo(895.432007f, 866.600586f, 897.119385f, 873.525696f, 899.200928f, 873.783997f);
2852 pathB.lineTo(918.799133f, 876.216003f);
2853 pathB.cubicTo(920.880615f, 876.474304f, 922.567993f, 869.968018f, 922.567993f, 861.683716f);
2854 pathB.lineTo(922.567993f, 763.683716f);
2855 pathB.cubicTo(922.567993f, 755.399414f, 920.880615f, 748.474304f, 918.799133f, 748.216003f);
2856 pathB.lineTo(899.200928f, 745.783997f);
2858 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2861 static void skpcarrefour_ro62(skiatest::Reporter* reporter, const char* filename) {
2863 path.setFillType(SkPath::kEvenOdd_FillType);
2864 path.moveTo(1104, 453);
2865 path.lineTo(399, 453);
2866 path.lineTo(399, 657);
2867 path.cubicTo(399, 661.970581f, 403.029449f, 666, 408, 666);
2868 path.lineTo(1095, 666);
2869 path.cubicTo(1099.97058f, 666, 1104, 661.970581f, 1104, 657);
2870 path.lineTo(1104, 453);
2873 pathB.setFillType(SkPath::kInverseWinding_FillType);
2874 pathB.moveTo(400, 453);
2875 pathB.lineTo(1103, 453);
2876 pathB.lineTo(1103, 666);
2877 pathB.lineTo(406, 666);
2878 pathB.cubicTo(402.686279f, 666, 400, 663.313721f, 400, 660);
2879 pathB.lineTo(400, 453);
2881 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2884 static void skpcaffelavazzait_com_ua21(skiatest::Reporter* reporter, const char* filename) {
2886 path.setFillType(SkPath::kEvenOdd_FillType);
2887 path.moveTo(883, 23);
2888 path.lineTo(883, 0);
2889 path.lineTo(1122.5f, 0);
2890 path.lineTo(1122.5f, 25.2136822f);
2891 path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2892 path.quadTo(1120.07104f, 28, 1118, 28);
2893 path.lineTo(888, 28);
2894 path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2895 path.quadTo(883, 25.0710678f, 883, 23);
2898 pathB.setFillType(SkPath::kWinding_FillType);
2899 pathB.moveTo(883, 0);
2900 pathB.lineTo(1123, 0);
2901 pathB.lineTo(1123, 23);
2902 pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2903 pathB.quadTo(1120.07104f, 28, 1118, 28);
2904 pathB.lineTo(888, 28);
2905 pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2906 pathB.quadTo(883, 25.0710678f, 883, 23);
2908 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2911 static void skpcamcorder_kz21(skiatest::Reporter* reporter, const char* filename) {
2913 path.setFillType(SkPath::kEvenOdd_FillType);
2914 path.moveTo(883, 23);
2915 path.lineTo(883, 0);
2916 path.lineTo(1122.5f, 0);
2917 path.lineTo(1122.5f, 25.2136822f);
2918 path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2919 path.quadTo(1120.07104f, 28, 1118, 28);
2920 path.lineTo(888, 28);
2921 path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2922 path.quadTo(883, 25.0710678f, 883, 23);
2925 pathB.setFillType(SkPath::kWinding_FillType);
2926 pathB.moveTo(883, 0);
2927 pathB.lineTo(1123, 0);
2928 pathB.lineTo(1123, 23);
2929 pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2930 pathB.quadTo(1120.07104f, 28, 1118, 28);
2931 pathB.lineTo(888, 28);
2932 pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2933 pathB.quadTo(883, 25.0710678f, 883, 23);
2935 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2938 static void skpcavablar_net563(skiatest::Reporter* reporter, const char* filename) {
2940 path.setFillType(SkPath::kEvenOdd_FillType);
2941 path.moveTo(160.000488f, 918);
2942 path.cubicTo(159.164749f, 917.37207f, 158.125824f, 917, 157, 917);
2943 path.lineTo(94, 917);
2944 path.cubicTo(92.874176f, 917, 91.8352661f, 917.37207f, 90.9995193f, 918);
2945 path.lineTo(160.000488f, 918);
2948 pathB.setFillType(SkPath::kWinding_FillType);
2949 pathB.moveTo(91, 917);
2950 pathB.lineTo(160, 917);
2951 pathB.lineTo(160, 918);
2952 pathB.lineTo(91, 918);
2954 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2957 static void skpinsomnia_gr72(skiatest::Reporter* reporter, const char* filename) {
2959 path.setFillType(SkPath::kEvenOdd_FillType);
2960 path.moveTo(1138, 231);
2961 path.lineTo(1137, 243.625748f);
2962 path.lineTo(1137, 926);
2963 path.lineTo(1139, 926);
2964 path.lineTo(1139, 231);
2965 path.lineTo(1138, 231);
2968 pathB.setFillType(SkPath::kWinding_FillType);
2969 pathB.moveTo(1139, 231);
2970 pathB.lineTo(1138, 231);
2971 pathB.lineTo(633, 6101);
2972 pathB.lineTo(1139, 6607);
2973 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
2976 static void cubicOp95u(skiatest::Reporter* reporter, const char* filename) {
2978 path.setFillType(SkPath::kEvenOdd_FillType);
2980 path.cubicTo(2, 3, 5, 1, 3, 2);
2982 pathB.setFillType(SkPath::kEvenOdd_FillType);
2984 pathB.cubicTo(2, 3, 2, 0, 3, 2);
2986 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
2989 static void cubicOp96d(skiatest::Reporter* reporter, const char* filename) {
2991 path.setFillType(SkPath::kEvenOdd_FillType);
2993 path.cubicTo(0, 3, 6, 3, 5, 0);
2995 pathB.setFillType(SkPath::kEvenOdd_FillType);
2997 pathB.cubicTo(0, 5, 6, 1, 3, 0);
2999 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3002 static void cubicOp97x(skiatest::Reporter* reporter, const char* filename) {
3004 path.setFillType(SkPath::kEvenOdd_FillType);
3006 path.cubicTo(0, 6, 2, 1, 2, 1);
3008 pathB.setFillType(SkPath::kEvenOdd_FillType);
3010 pathB.cubicTo(1, 2, 2, 0, 6, 0);
3012 testPathOp(reporter, path, pathB, kXOR_PathOp, filename);
3015 static void cubicOp98x(skiatest::Reporter* reporter, const char* filename) {
3017 path.setFillType(SkPath::kEvenOdd_FillType);
3019 path.cubicTo(3, 6, 4, 1, 6, 3);
3021 pathB.setFillType(SkPath::kEvenOdd_FillType);
3023 pathB.cubicTo(3, 6, 3, 0, 6, 3);
3025 testPathOp(reporter, path, pathB, kXOR_PathOp, filename);
3028 static void cubicOp99(skiatest::Reporter* reporter, const char* filename) {
3030 path.setFillType(SkPath::kWinding_FillType);
3032 path.cubicTo(0,3, 6,5, 5,4);
3034 pathB.setFillType(SkPath::kWinding_FillType);
3036 pathB.cubicTo(4,5, 6,3, 3,0);
3038 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3041 static void cubicOp100(skiatest::Reporter* reporter, const char* filename) {
3043 path.setFillType(SkPath::kWinding_FillType);
3045 path.cubicTo(0,2, 2,1, 4,2);
3047 pathB.setFillType(SkPath::kWinding_FillType);
3049 pathB.cubicTo(2,4, 1,0, 2,0);
3051 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3054 static void cubicOp101(skiatest::Reporter* reporter, const char* filename) {
3056 path.setFillType(SkPath::kWinding_FillType);
3058 path.cubicTo(2, 3, 2, 1, 5, 3);
3060 pathB.setFillType(SkPath::kWinding_FillType);
3062 pathB.cubicTo(3, 5, 1, 0, 3, 2);
3064 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3067 static void cubicOp102(skiatest::Reporter* reporter, const char* filename) {
3069 path.setFillType(SkPath::kWinding_FillType);
3071 path.cubicTo(1,2, 1,0, 3,0);
3073 pathB.setFillType(SkPath::kWinding_FillType);
3075 pathB.cubicTo(0,3, 1,0, 2,1);
3077 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3080 static void cubicOp103(skiatest::Reporter* reporter, const char* filename) {
3082 path.setFillType(SkPath::kWinding_FillType);
3084 path.cubicTo(1,5, 2,0, 2,1);
3086 pathB.setFillType(SkPath::kWinding_FillType);
3088 pathB.cubicTo(1,2, 1,0, 5,1);
3090 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3093 static void cubicOp104(skiatest::Reporter* reporter, const char* filename) {
3095 path.setFillType(SkPath::kWinding_FillType);
3097 path.cubicTo(0,6, 4,0, 6,1);
3099 pathB.setFillType(SkPath::kWinding_FillType);
3101 pathB.cubicTo(1,6, 1,0, 6,0);
3103 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3106 static void cubicOp105(skiatest::Reporter* reporter, const char* filename) {
3108 path.setFillType(SkPath::kWinding_FillType);
3110 path.cubicTo(0,4, 6,5, 2,0);
3112 pathB.setFillType(SkPath::kWinding_FillType);
3114 pathB.cubicTo(0,2, 1,0, 4,0);
3116 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3119 static void cubicOp106(skiatest::Reporter* reporter, const char* filename) {
3121 path.setFillType(SkPath::kWinding_FillType);
3123 path.cubicTo(4, 6, 2, 1, 2, 0);
3125 pathB.setFillType(SkPath::kWinding_FillType);
3127 pathB.cubicTo(0, 2, 1, 0, 6, 4);
3129 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3132 static void cubicOp107(skiatest::Reporter* reporter, const char* filename) {
3134 path.setFillType(SkPath::kWinding_FillType);
3136 path.cubicTo(4, 6, 2, 1, 2, 0);
3138 pathB.setFillType(SkPath::kWinding_FillType);
3140 pathB.cubicTo(0, 2, 1, 0, 6, 4);
3142 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3145 static void cubicOp108(skiatest::Reporter* reporter, const char* filename) {
3147 path.setFillType(SkPath::kWinding_FillType);
3149 path.cubicTo(4, 6, 2, 1, 2, 0);
3151 pathB.setFillType(SkPath::kWinding_FillType);
3153 pathB.cubicTo(0, 2, 1, 0, 6, 4);
3155 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
3158 static void cubicOp109(skiatest::Reporter* reporter, const char* filename) {
3160 path.setFillType(SkPath::kWinding_FillType);
3162 path.cubicTo(4,5, 6,3, 5,4);
3164 pathB.setFillType(SkPath::kWinding_FillType);
3166 pathB.cubicTo(4,5, 1,0, 5,4);
3168 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3171 static void cubicOp110(skiatest::Reporter* reporter, const char* filename) {
3173 path.setFillType(SkPath::kEvenOdd_FillType);
3174 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
3175 path.addRect(0, 0, 4, 4, SkPath::kCW_Direction);
3176 pathB.setFillType(SkPath::kEvenOdd_FillType);
3177 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3178 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3179 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3182 static void cubicOp111(skiatest::Reporter* reporter, const char* filename) {
3184 path.setFillType(SkPath::kWinding_FillType);
3186 path.cubicTo(0,5, 4,1, 3,1);
3188 pathB.setFillType(SkPath::kWinding_FillType);
3190 pathB.cubicTo(1,3, 4,1, 5,0);
3192 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3195 static void xOp1u(skiatest::Reporter* reporter, const char* filename) {
3197 path.setFillType(SkPath::kEvenOdd_FillType);
3199 path.cubicTo(4, 5, 3, 2, 6, 3);
3201 pathB.setFillType(SkPath::kEvenOdd_FillType);
3203 pathB.cubicTo(3, 6, 4, 1, 5, 4);
3205 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
3208 static void xOp1i(skiatest::Reporter* reporter, const char* filename) {
3210 path.setFillType(SkPath::kEvenOdd_FillType);
3212 path.cubicTo(1, 5, 6, 0, 5, 1);
3214 pathB.setFillType(SkPath::kEvenOdd_FillType);
3216 pathB.cubicTo(1, 5, 4, 1, 5, 1);
3218 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3221 static void xOp2i(skiatest::Reporter* reporter, const char* filename) {
3223 path.setFillType(SkPath::kEvenOdd_FillType);
3225 path.cubicTo(0, 4, 3, 2, 6, 1);
3227 pathB.setFillType(SkPath::kEvenOdd_FillType);
3229 pathB.cubicTo(1, 6, 5, 1, 4, 0);
3231 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3234 static void xOp3i(skiatest::Reporter* reporter, const char* filename) {
3236 path.setFillType(SkPath::kWinding_FillType);
3238 path.cubicTo(0,5, 4,1, 3,1);
3240 pathB.setFillType(SkPath::kWinding_FillType);
3242 pathB.cubicTo(1,3, 4,1, 5,0);
3244 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3247 static void findFirst1(skiatest::Reporter* reporter, const char* filename) {
3249 path.setFillType(SkPath::kWinding_FillType);
3251 path.cubicTo(1,6, 5,0, 2,1);
3253 pathB.setFillType(SkPath::kWinding_FillType);
3255 pathB.cubicTo(1,2, 1,0, 6,1);
3257 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3260 // triggers addSimpleAngle with non-zero argument
3261 static void cubicOp112(skiatest::Reporter* reporter, const char* filename) {
3263 path.setFillType(SkPath::kWinding_FillType);
3265 path.cubicTo(2,3, 6,4, 1,0);
3267 pathB.setFillType(SkPath::kWinding_FillType);
3269 pathB.cubicTo(0,1, 4,2, 3,2);
3271 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3274 static void cubicOp113(skiatest::Reporter* reporter, const char* filename) {
3277 path.cubicTo(3,5, 2.33333325f,4.33333349f, 3.83333325f,3.83333349f);
3280 pathB.cubicTo(2.33333325f,4.33333349f, 3.83333325f,3.83333349f, 2,4);
3282 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3285 static void cubicOp114(skiatest::Reporter* reporter, const char* filename) {
3286 if (!FLAGS_runFail) {
3290 path.setFillType(SkPath::kWinding_FillType);
3292 path.cubicTo(1, 3, -1, 2, 3.5f, 1.33333337f);
3294 pathB.setFillType(SkPath::kWinding_FillType);
3296 pathB.cubicTo(-1, 2, 3.5f, 1.33333337f, 0, 1);
3298 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3301 static void cubicOp114asQuad(skiatest::Reporter* reporter, const char* filename) {
3303 path.setFillType(SkPath::kWinding_FillType);
3305 path.cubicTo(1, 3, -1, 2, 3.5f, 1.33333337f);
3307 pathB.setFillType(SkPath::kWinding_FillType);
3309 pathB.cubicTo(-1, 2, 3.5f, 1.33333337f, 0, 1);
3311 SkPath qPath, qPathB;
3312 CubicPathToQuads(path, &qPath);
3313 CubicPathToQuads(pathB, &qPathB);
3314 testPathOp(reporter, qPath, qPathB, kIntersect_PathOp, filename);
3317 static void quadOp10i(skiatest::Reporter* reporter, const char* filename) {
3320 path.quadTo(1, 8, 3, 5);
3324 pathB.quadTo(8, 1, 4, 8);
3326 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3329 static void kari1(skiatest::Reporter* reporter, const char* filename) {
3331 path1.moveTo(39.9375, -5.8359375);
3332 path1.lineTo(40.625, -5.7890625);
3333 path1.lineTo(37.7109375, 1.3515625);
3334 path1.lineTo(37.203125, 0.9609375);
3338 path2.moveTo(37.52734375f, -1.44140625f);
3339 path2.cubicTo(37.8736991882324f, -1.69921875f, 38.1640625f, -2.140625f, 38.3984375f, -2.765625f);
3340 path2.lineTo(38.640625f, -2.609375f);
3341 path2.cubicTo(38.53125f, -1.89583337306976f, 38.0664443969727f, -0.154893040657043f, 38.0664443969727f, -0.154893040657043f);
3342 path2.cubicTo(38.0664443969727f, -0.154893040657043f, 37.1809883117676f, -1.18359375f, 37.52734375, -1.44140625f);
3345 testPathOp(reporter, path1, path2, kDifference_PathOp, filename);
3348 static void issue2504(skiatest::Reporter* reporter, const char* filename) {
3350 path1.moveTo(34.2421875, -5.976562976837158203125);
3351 path1.lineTo(35.453121185302734375, 0);
3352 path1.lineTo(31.9375, 0);
3356 path2.moveTo(36.71843719482421875, 0.8886508941650390625);
3357 path2.cubicTo(36.71843719482421875, 0.8886508941650390625,
3358 35.123386383056640625, 0.554015457630157470703125,
3359 34.511409759521484375, -0.1152553558349609375);
3360 path2.cubicTo(33.899425506591796875, -0.7845261096954345703125,
3361 34.53484344482421875, -5.6777553558349609375,
3362 34.53484344482421875, -5.6777553558349609375);
3364 testPathOp(reporter, path1, path2, kUnion_PathOp, filename);
3367 static void issue2540(skiatest::Reporter* reporter, const char* filename) {
3369 path1.moveTo(26.5054988861083984375, 85.73960113525390625);
3370 path1.cubicTo(84.19739532470703125, 17.77140045166015625, 16.93920135498046875, 101.86199951171875, 12.631000518798828125, 105.24700164794921875);
3371 path1.cubicTo(11.0819997787475585937500000, 106.46399688720703125, 11.5260000228881835937500000, 104.464996337890625, 11.5260000228881835937500000, 104.464996337890625);
3372 path1.lineTo(23.1654987335205078125, 89.72879791259765625);
3373 path1.cubicTo(23.1654987335205078125, 89.72879791259765625, -10.1713008880615234375, 119.9160003662109375, -17.1620006561279296875, 120.8249969482421875);
3374 path1.cubicTo(-19.1149997711181640625, 121.07900238037109375, -18.0380001068115234375, 119.79299163818359375, -18.0380001068115234375, 119.79299163818359375);
3375 path1.cubicTo(-18.0380001068115234375, 119.79299163818359375, 14.22100067138671875, 90.60700225830078125, 26.5054988861083984375, 85.73960113525390625);
3379 path2.moveTo(-25.077999114990234375, 124.9120025634765625);
3380 path2.cubicTo(-25.077999114990234375, 124.9120025634765625, -25.9509983062744140625, 125.95400238037109375, -24.368999481201171875, 125.7480010986328125);
3381 path2.cubicTo(-16.06999969482421875, 124.66899871826171875, 1.2680000066757202148437500, 91.23999786376953125, 37.264003753662109375, 95.35400390625);
3382 path2.cubicTo(37.264003753662109375, 95.35400390625, 11.3710002899169921875, 83.7339935302734375, -25.077999114990234375, 124.9120025634765625);
3384 testPathOp(reporter, path1, path2, kUnion_PathOp, filename);
3387 static void rects1(skiatest::Reporter* reporter, const char* filename) {
3389 path.setFillType(SkPath::kEvenOdd_FillType);
3400 pathB.setFillType(SkPath::kEvenOdd_FillType);
3411 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
3414 static void rects2(skiatest::Reporter* reporter, const char* filename) {
3416 path.setFillType(SkPath::kEvenOdd_FillType);
3427 pathB.setFillType(SkPath::kWinding_FillType);
3438 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3441 static void rects3(skiatest::Reporter* reporter, const char* filename) {
3443 path.setFillType(SkPath::kEvenOdd_FillType);
3444 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
3445 path.addRect(0, 0, 4, 4, SkPath::kCW_Direction);
3446 pathB.setFillType(SkPath::kWinding_FillType);
3447 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3448 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3449 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3452 static void rects4(skiatest::Reporter* reporter, const char* filename) {
3454 path.setFillType(SkPath::kEvenOdd_FillType);
3455 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
3456 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3457 pathB.setFillType(SkPath::kWinding_FillType);
3458 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3459 pathB.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
3460 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3463 static void issue2753(skiatest::Reporter* reporter, const char* filename) {
3464 if (!FLAGS_runFail) {
3468 path1.moveTo(142.701f, 110.568f);
3469 path1.lineTo(142.957f, 100);
3470 path1.lineTo(153.835f, 100);
3471 path1.lineTo(154.592f, 108.188f);
3472 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);
3477 path2.moveTo(39, 124.001f);
3478 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);
3480 path2.cubicTo(188.201f, 117.601f, 174.801f, 93, 39, 124.001f);
3483 testPathOp(reporter, path1, path2, kUnion_PathOp, filename);
3486 static void issue2808(skiatest::Reporter* reporter, const char* filename) {
3487 SkPath path1, path2;
3489 path1.moveTo(509.20300293f, 385.601989746f);
3490 path1.quadTo(509.20300293f, 415.68838501f, 487.928710938f, 436.96270752f);
3491 path1.quadTo(466.654388428f, 458.236999512f, 436.567993164f, 458.236999512f);
3492 path1.quadTo(406.4815979f, 458.236999512f, 385.207275391f, 436.96270752f);
3493 path1.quadTo(363.932983398f, 415.68838501f, 363.932983398f, 385.601989746f);
3494 path1.quadTo(363.932983398f, 355.515594482f, 385.207275391f, 334.241271973f);
3495 path1.quadTo(406.4815979f, 312.96697998f, 436.567993164f, 312.96697998f);
3496 path1.quadTo(466.654388428f, 312.96697998f, 487.928710938f, 334.241271973f);
3497 path1.quadTo(509.20300293f, 355.515594482f, 509.20300293f, 385.601989746f);
3500 path2.moveTo(449.033996582f, 290.87298584f);
3501 path2.quadTo(449.033996582f, 301.028259277f, 441.853149414f, 308.209106445f);
3502 path2.quadTo(434.672271729f, 315.389984131f, 424.516998291f, 315.389984131f);
3503 path2.quadTo(414.361724854f, 315.389984131f, 407.180847168f, 308.209106445f);
3504 path2.quadTo(400, 301.028259277f, 400, 290.87298584f);
3505 path2.quadTo(400, 280.717712402f, 407.180847168f, 273.536865234f);
3506 path2.quadTo(414.361724854f, 266.355987549f, 424.516998291f, 266.355987549f);
3507 path2.quadTo(434.672271729f, 266.355987549f, 441.853149414f, 273.536865234f);
3508 path2.quadTo(449.033996582f, 280.717712402f, 449.033996582f, 290.87298584f);
3511 testPathOp(reporter, path1, path2, kUnion_PathOp, filename);
3514 static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0;
3515 static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0;
3517 static struct TestDesc tests[] = {
3518 TEST(issue2753), // FIXME: pair of cubics miss intersection
3519 TEST(cubicOp114), // FIXME: curve with inflection is ordered the wrong way
3521 TEST(cubicOp114asQuad),
3531 // fails because a cubic/quadratic intersection is missed
3532 // the internal quad/quad is far enough away from the real cubic/quad that it is rejected
3533 TEST(skpcarrot_is24),
3536 TEST(skpadspert_net23),
3537 TEST(skpadspert_de11),
3559 TEST(skpcarpetplanet_ru22), // cubic/cubic intersect detects unwanted coincidence
3562 TEST(skpadbox_lt15),
3563 TEST(skpagentxsites_com55),
3564 TEST(skpadventistmission_org572),
3565 TEST(skpadoption_org196),
3566 TEST(skpbambootheme_com12),
3567 TEST(skpbakosoft_com10),
3568 TEST(skpakmmos_ru100),
3569 TEST(skpbangalorenest_com4),
3570 TEST(skpbingoentertainment_net189),
3571 TEST(skpbestred_ru37),
3572 TEST(skpbenzoteh_ru152),
3573 TEST(skpcamcorder_kz21),
3574 TEST(skpcaffelavazzait_com_ua21),
3575 TEST(skpcarrefour_ro62),
3576 TEST(skpcavablar_net563),
3577 TEST(skpinsomnia_gr72),
3580 TEST(skpacesoftech_com47),
3581 TEST(skpabcspark_ca103),
3585 TEST(skpadithya_putr4_blogspot_com551),
3586 TEST(skpadindex_de4),
3587 TEST(skpaiaigames_com870),
3588 TEST(skpaaalgarve_org53),
3589 TEST(skpkkiste_to716),
3604 TEST(skpkkiste_to98),
3605 TEST(skpahrefs_com29),
3607 TEST(skpahrefs_com88),
3608 TEST(skphealth_com76),
3609 TEST(skpancestry_com1),
3611 TEST(skpeldorado_com_ua1),
3686 TEST(testIntersect1),
3690 TEST(testIntersect2),
3731 static const size_t testCount = SK_ARRAY_COUNT(tests);
3733 static struct TestDesc subTests[] = {
3738 static const size_t subTestCount = SK_ARRAY_COUNT(subTests);
3740 static void (*firstSubTest)(skiatest::Reporter* , const char* filename) = 0;
3742 static bool runSubTests = false;
3743 static bool runSubTestsFirst = false;
3744 static bool runReverse = false;
3746 DEF_TEST(PathOpsOp, reporter) {
3747 #if DEBUG_SHOW_TEST_NAME
3748 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
3750 if (runSubTests && runSubTestsFirst) {
3751 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, runReverse);
3753 RunTestSet(reporter, tests, testCount, firstTest, stopTest, runReverse);
3754 if (runSubTests && !runSubTestsFirst) {
3755 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, runReverse);
3759 static void bufferOverflow(skiatest::Reporter* reporter, const char* filename) {
3761 path.addRect(0,0, 300,170141183460469231731687303715884105728.f);
3763 pathB.addRect(0,0, 300,16);
3764 testPathFailOp(reporter, path, pathB, kUnion_PathOp, filename);
3767 // m 100,0 60,170 -160,-110 200,0 -170,11000000000 z
3768 static void fuzz433(skiatest::Reporter* reporter, const char* filename) {
3769 SkPath path1, path2;
3770 path1.moveTo(100,0);
3771 path1.lineTo(60,170);
3772 path1.lineTo(-160,-110);
3773 path1.lineTo(200,0);
3774 path1.lineTo(-170,11000000000.0f);
3777 path2.moveTo(100 + 20,0 + 20);
3778 path2.lineTo(60 + 20,170 + 20);
3779 path2.lineTo(-160 + 20,-110 + 20);
3780 path2.lineTo(200 + 20,0 + 20);
3781 path2.lineTo(-170 + 20,11000000000.0f + 20);
3784 testPathFailOp(reporter, path1, path2, kIntersect_PathOp, filename);
3787 static void fuzz433b(skiatest::Reporter* reporter, const char* filename) {
3788 SkPath path1, path2;
3789 path1.setFillType(SkPath::kEvenOdd_FillType);
3790 path1.moveTo(140, 40);
3791 path1.lineTo(200, 210);
3792 path1.lineTo(40, 100);
3793 path1.lineTo(240, 100);
3794 path1.lineTo(70, 1.1e+10f);
3795 path1.lineTo(140, 40);
3798 path1.setFillType(SkPath::kWinding_FillType);
3799 path2.moveTo(190, 60);
3800 path2.lineTo(250, 230);
3801 path2.lineTo(90, 120);
3802 path2.lineTo(290, 120);
3803 path2.lineTo(120, 1.1e+10f);
3804 path2.lineTo(190, 60);
3807 testPathFailOp(reporter, path1, path2, kUnion_PathOp, filename);
3810 static void fuzz487a(skiatest::Reporter* reporter, const char* filename) {
3812 path.setFillType((SkPath::FillType) 0);
3813 path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
3814 path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000));
3815 path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x429a6666), SkBits2Float(0x42f9999a), SkBits2Float(0x4275999a), SkBits2Float(0x42d70001), SkBits2Float(0x42633333));
3816 path.lineTo(SkBits2Float(0x42e90001), SkBits2Float(0x41b8cccc));
3817 path.cubicTo(SkBits2Float(0x42dc6667), SkBits2Float(0x41ab3332), SkBits2Float(0x42cf3334), SkBits2Float(0x41a3ffff), SkBits2Float(0x42c20001), SkBits2Float(0x41a3ffff));
3818 path.lineTo(SkBits2Float(0x42c20001), SkBits2Float(0x425d999a));
3819 path.lineTo(SkBits2Float(0x42c20001), SkBits2Float(0x425d999a));
3820 path.cubicTo(SkBits2Float(0x429c6668), SkBits2Float(0x425d999a), SkBits2Float(0x4279999c), SkBits2Float(0x42886667), SkBits2Float(0x42673335), SkBits2Float(0x42ab0000));
3821 path.lineTo(SkBits2Float(0x41c0ccd0), SkBits2Float(0x42990000));
3822 path.cubicTo(SkBits2Float(0x41b33336), SkBits2Float(0x42a5999a), SkBits2Float(0x41ac0003), SkBits2Float(0x42b2cccd), SkBits2Float(0x41ac0003), SkBits2Float(0x42c00000));
3823 path.lineTo(SkBits2Float(0x4261999c), SkBits2Float(0x42c00000));
3824 path.lineTo(SkBits2Float(0x4261999c), SkBits2Float(0x42c00000));
3825 path.cubicTo(SkBits2Float(0x4261999c), SkBits2Float(0x434d3333), SkBits2Float(0x4364e667), SkBits2Float(0x4346b333), SkBits2Float(0x4364e667), SkBits2Float(0x43400000));
3826 path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
3831 path.setFillType((SkPath::FillType) 0);
3832 path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
3833 path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000));
3834 path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x42a20000), SkBits2Float(0x43016667), SkBits2Float(0x4287cccd), SkBits2Float(0x42ea999a), SkBits2Float(0x4273999a));
3835 path.lineTo(SkBits2Float(0x4306cccd), SkBits2Float(0x41f5999a));
3836 path.cubicTo(SkBits2Float(0x42f76667), SkBits2Float(0x41c26667), SkBits2Float(0x42dd999a), SkBits2Float(0x41a4cccd), SkBits2Float(0x42c23334), SkBits2Float(0x41a4cccd));
3837 path.lineTo(SkBits2Float(0x42c23334), SkBits2Float(0x425e0000));
3838 path.cubicTo(SkBits2Float(0x42a43334), SkBits2Float(0x425e0000), SkBits2Float(0x428a0001), SkBits2Float(0x427ecccd), SkBits2Float(0x42780002), SkBits2Float(0x4297999a));
3839 path.lineTo(SkBits2Float(0x41fccccd), SkBits2Float(0x42693333));
3840 path.cubicTo(SkBits2Float(0x41c9999a), SkBits2Float(0x428acccd), SkBits2Float(0x41ac0000), SkBits2Float(0x42a4999a), SkBits2Float(0x41ac0000), SkBits2Float(0x42c00000));
3841 path.lineTo(SkBits2Float(0x4261999a), SkBits2Float(0x42c00000));
3842 path.cubicTo(SkBits2Float(0x4261999a), SkBits2Float(0x42de0000), SkBits2Float(0x42813333), SkBits2Float(0x42f83333), SkBits2Float(0x42996666), SkBits2Float(0x4303199a));
3843 path.cubicTo(SkBits2Float(0x4272cccc), SkBits2Float(0x4303199a), SkBits2Float(0x423d3332), SkBits2Float(0x430de667), SkBits2Float(0x422d9999), SkBits2Float(0x431cb334));
3844 path.lineTo(SkBits2Float(0x7086a1dc), SkBits2Float(0x42eecccd));
3845 path.lineTo(SkBits2Float(0x41eb3333), SkBits2Float(0xc12ccccd));
3846 path.lineTo(SkBits2Float(0x42053333), SkBits2Float(0xc1cccccd));
3847 path.lineTo(SkBits2Float(0x42780000), SkBits2Float(0xc18f3334));
3848 path.cubicTo(SkBits2Float(0x43206666), SkBits2Float(0x43134ccd), SkBits2Float(0x43213333), SkBits2Float(0x430db333), SkBits2Float(0x43213333), SkBits2Float(0x43080000));
3849 path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
3853 testPathFailOp(reporter, path1, path2, (SkPathOp) 2, filename);
3856 static void fuzz487b(skiatest::Reporter* reporter, const char* filename) {
3858 path.setFillType((SkPath::FillType) 0);
3859 path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
3860 path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000));
3861 path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x429a6666), SkBits2Float(0x42f9999a), SkBits2Float(0x4275999a), SkBits2Float(0x42d70001), SkBits2Float(0x42633333));
3862 path.lineTo(SkBits2Float(0x42e90001), SkBits2Float(0x41b8cccc));
3863 path.cubicTo(SkBits2Float(0x42dc6667), SkBits2Float(0x41ab3332), SkBits2Float(0x42cf3334), SkBits2Float(0x41a3ffff), SkBits2Float(0x42c20001), SkBits2Float(0x41a3ffff));
3864 path.lineTo(SkBits2Float(0x42c20001), SkBits2Float(0x425d999a));
3865 path.lineTo(SkBits2Float(0x42c20001), SkBits2Float(0x425d999a));
3866 path.cubicTo(SkBits2Float(0x429c6668), SkBits2Float(0x425d999a), SkBits2Float(0x4279999c), SkBits2Float(0x42886667), SkBits2Float(0x42673335), SkBits2Float(0x42ab0000));
3867 path.lineTo(SkBits2Float(0x41c0ccd0), SkBits2Float(0x42990000));
3868 path.cubicTo(SkBits2Float(0x41b33336), SkBits2Float(0x42a5999a), SkBits2Float(0x41ac0003), SkBits2Float(0x42b2cccd), SkBits2Float(0x41ac0003), SkBits2Float(0x42c00000));
3869 path.lineTo(SkBits2Float(0x4261999c), SkBits2Float(0x42c00000));
3870 path.lineTo(SkBits2Float(0x4261999c), SkBits2Float(0x42c00000));
3871 path.cubicTo(SkBits2Float(0x4261999c), SkBits2Float(0x434d3333), SkBits2Float(0x4364e667), SkBits2Float(0x4346b333), SkBits2Float(0x4364e667), SkBits2Float(0x43400000));
3872 path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
3877 path.setFillType((SkPath::FillType) 0);
3878 path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
3879 path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000));
3880 path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x42a20000), SkBits2Float(0x43016667), SkBits2Float(0x4287cccd), SkBits2Float(0x42ea999a), SkBits2Float(0x4273999a));
3881 path.lineTo(SkBits2Float(0x4306cccd), SkBits2Float(0x41f5999a));
3882 path.cubicTo(SkBits2Float(0x42f76667), SkBits2Float(0x41c26667), SkBits2Float(0x42dd999a), SkBits2Float(0x41a4cccd), SkBits2Float(0x42c23334), SkBits2Float(0x41a4cccd));
3883 path.lineTo(SkBits2Float(0x42c23334), SkBits2Float(0x425e0000));
3884 path.cubicTo(SkBits2Float(0x42a43334), SkBits2Float(0x425e0000), SkBits2Float(0x428a0001), SkBits2Float(0x427ecccd), SkBits2Float(0x42780002), SkBits2Float(0x4297999a));
3885 path.lineTo(SkBits2Float(0x41fccccd), SkBits2Float(0x42693333));
3886 path.cubicTo(SkBits2Float(0x41c9999a), SkBits2Float(0x428acccd), SkBits2Float(0x41ac0000), SkBits2Float(0x42a4999a), SkBits2Float(0x41ac0000), SkBits2Float(0x42c00000));
3887 path.lineTo(SkBits2Float(0x4261999a), SkBits2Float(0x42c00000));
3888 path.cubicTo(SkBits2Float(0x4261999a), SkBits2Float(0x42de0000), SkBits2Float(0x42813333), SkBits2Float(0x42f83333), SkBits2Float(0x42996666), SkBits2Float(0x4303199a));
3889 path.cubicTo(SkBits2Float(0x4272cccc), SkBits2Float(0x4303199a), SkBits2Float(0x423d3332), SkBits2Float(0x430de667), SkBits2Float(0x422d9999), SkBits2Float(0x431cb334));
3890 path.lineTo(SkBits2Float(0x7086a1dc), SkBits2Float(0x42eecccd));
3891 path.lineTo(SkBits2Float(0x41eb3333), SkBits2Float(0xc12ccccd));
3892 path.lineTo(SkBits2Float(0x42053333), SkBits2Float(0xc1cccccd));
3893 path.lineTo(SkBits2Float(0x42780000), SkBits2Float(0xc18f3334));
3894 path.cubicTo(SkBits2Float(0x43206666), SkBits2Float(0x43134ccd), SkBits2Float(0x43213333), SkBits2Float(0x430db333), SkBits2Float(0x43213333), SkBits2Float(0x43080000));
3895 path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
3899 testPathFailOp(reporter, path1, path2, (SkPathOp) 2, filename);
3902 static struct TestDesc failTests[] = {
3907 TEST(bufferOverflow),
3910 static const size_t failTestCount = SK_ARRAY_COUNT(failTests);
3912 DEF_TEST(PathOpsFailOp, reporter) {
3913 #if DEBUG_SHOW_TEST_NAME
3914 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
3916 RunTestSet(reporter, failTests, failTestCount, 0, 0, false);