1 /*
2  * Copyright 2012 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 #include "PathOpsExtendedTest.h"
8 #include "PathOpsTestCommon.h"
9 
10 class PathTest_Private {
11 public:
PathTest_Private(SkPath * path)12     PathTest_Private(SkPath* path)
13         : fPath(path) {}
14 
setPt(int index,SkScalar x,SkScalar y)15     void setPt(int index, SkScalar x, SkScalar y) {
16         fPath->setPt(index, x, y);
17     }
18 
19     SkPath* fPath;
20 };
21 
path_edit(const SkPoint & from,const SkPoint & to,SkPath * path)22 static void path_edit(const SkPoint& from, const SkPoint& to, SkPath* path) {
23     PathTest_Private testPath(path);
24     for (int index = 0; index < path->countPoints(); ++index) {
25         if (SkDPoint::ApproximatelyEqual(path->getPoint(index), from)) {
26             testPath.setPt(index, to.fX, to.fY);
27             return;
28         }
29     }
30 }
31 
cubicOp1d(skiatest::Reporter * reporter,const char * filename)32 static void cubicOp1d(skiatest::Reporter* reporter, const char* filename) {
33     SkPath path, pathB;
34     path.setFillType(SkPath::kWinding_FillType);
35     path.moveTo(0,1);
36     path.cubicTo(0,2, 1,0, 1,0);
37     path.close();
38     pathB.setFillType(SkPath::kWinding_FillType);
39     pathB.moveTo(0,1);
40     pathB.cubicTo(0,1, 1,0, 2,0);
41     pathB.close();
42     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
43 }
44 
cubicOp2d(skiatest::Reporter * reporter,const char * filename)45 static void cubicOp2d(skiatest::Reporter* reporter, const char* filename) {
46     SkPath path, pathB;
47     path.setFillType(SkPath::kWinding_FillType);
48     path.moveTo(0,2);
49     path.cubicTo(0,1, 1,0, 1,0);
50     path.close();
51     pathB.setFillType(SkPath::kWinding_FillType);
52     pathB.moveTo(0,1);
53     pathB.cubicTo(0,1, 2,0, 1,0);
54     pathB.close();
55     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
56 }
57 
cubicOp3d(skiatest::Reporter * reporter,const char * filename)58 static void cubicOp3d(skiatest::Reporter* reporter, const char* filename) {
59     SkPath path, pathB;
60     path.setFillType(SkPath::kWinding_FillType);
61     path.moveTo(0,1);
62     path.cubicTo(2,3, 1,0, 1,0);
63     path.close();
64     pathB.setFillType(SkPath::kWinding_FillType);
65     pathB.moveTo(0,1);
66     pathB.cubicTo(0,1, 1,0, 3,2);
67     pathB.close();
68     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
69 }
70 
cubicOp5d(skiatest::Reporter * reporter,const char * filename)71 static void cubicOp5d(skiatest::Reporter* reporter, const char* filename) {
72     SkPath path, pathB;
73     path.setFillType(SkPath::kWinding_FillType);
74     path.moveTo(0,1);
75     path.cubicTo(0,2, 1,0, 2,0);
76     path.close();
77     pathB.setFillType(SkPath::kWinding_FillType);
78     pathB.moveTo(0,1);
79     pathB.cubicTo(0,2, 1,0, 2,0);
80     pathB.close();
81     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
82 }
83 
cubicOp6d(skiatest::Reporter * reporter,const char * filename)84 static void cubicOp6d(skiatest::Reporter* reporter, const char* filename) {
85     SkPath path, pathB;
86     path.setFillType(SkPath::kWinding_FillType);
87     path.moveTo(0,1);
88     path.cubicTo(0,6, 1,0, 3,0);
89     path.close();
90     pathB.setFillType(SkPath::kWinding_FillType);
91     pathB.moveTo(0,1);
92     pathB.cubicTo(0,3, 1,0, 6,0);
93     pathB.close();
94     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
95 }
96 
cubicOp7d(skiatest::Reporter * reporter,const char * filename)97 static void cubicOp7d(skiatest::Reporter* reporter, const char* filename) {
98     SkPath path, pathB;
99     path.setFillType(SkPath::kWinding_FillType);
100     path.moveTo(0,1);
101     path.cubicTo(3,4, 1,0, 3,0);
102     path.close();
103     pathB.setFillType(SkPath::kWinding_FillType);
104     pathB.moveTo(0,1);
105     pathB.cubicTo(0,3, 1,0, 4,3);
106     pathB.close();
107     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
108 }
109 
cubicOp8d(skiatest::Reporter * reporter,const char * filename)110 static void cubicOp8d(skiatest::Reporter* reporter, const char* filename) {
111     SkPath path, pathB;
112     path.setFillType(SkPath::kWinding_FillType);
113     path.moveTo(0,1);
114     path.cubicTo(0,5, 1,0, 4,0);
115     path.close();
116     pathB.setFillType(SkPath::kWinding_FillType);
117     pathB.moveTo(0,1);
118     pathB.cubicTo(0,4, 1,0, 5,0);
119     pathB.close();
120     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
121 }
122 
cubicOp9d(skiatest::Reporter * reporter,const char * filename)123 static void cubicOp9d(skiatest::Reporter* reporter, const char* filename) {
124     SkPath path, pathB;
125     path.setFillType(SkPath::kWinding_FillType);
126     path.moveTo(0,1);
127     path.cubicTo(1,6, 1,0, 2,1);
128     path.close();
129     pathB.setFillType(SkPath::kWinding_FillType);
130     pathB.moveTo(0,1);
131     pathB.cubicTo(1,2, 1,0, 6,1);
132     pathB.close();
133     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
134 }
135 
quadOp9d(skiatest::Reporter * reporter,const char * filename)136 static void quadOp9d(skiatest::Reporter* reporter, const char* filename) {
137     SkPath path, pathB;
138     path.setFillType(SkPath::kWinding_FillType);
139     path.moveTo(0,1);
140     path.quadTo(1,6, 1.5f,1);
141     path.quadTo(1.5f,0.5f, 2,1);
142     path.close();
143     pathB.setFillType(SkPath::kWinding_FillType);
144     pathB.moveTo(0,1);
145     pathB.quadTo(1,2, 1.4f,1);
146     pathB.quadTo(3,0.4f, 6,1);
147     pathB.close();
148     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
149 }
150 
lineOp9d(skiatest::Reporter * reporter,const char * filename)151 static void lineOp9d(skiatest::Reporter* reporter, const char* filename) {
152     SkPath path, pathB;
153     path.setFillType(SkPath::kWinding_FillType);
154     path.moveTo(0,1);
155     path.lineTo(1,6);
156     path.lineTo(1.5f,1);
157     path.lineTo(1.8f,0.8f);
158     path.lineTo(2,1);
159     path.close();
160     pathB.setFillType(SkPath::kWinding_FillType);
161     pathB.moveTo(0,1);
162     pathB.lineTo(1,2);
163     pathB.lineTo(1.4f,1);
164     pathB.lineTo(3,0.4f);
165     pathB.lineTo(6,1);
166     pathB.close();
167     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
168 }
169 
cubicOp1i(skiatest::Reporter * reporter,const char * filename)170 static void cubicOp1i(skiatest::Reporter* reporter, const char* filename) {
171     SkPath path, pathB;
172     path.setFillType(SkPath::kWinding_FillType);
173     path.moveTo(0,1);
174     path.cubicTo(1,2, 1,0, 2,1);
175     path.close();
176     pathB.setFillType(SkPath::kWinding_FillType);
177     pathB.moveTo(0,1);
178     pathB.cubicTo(1,2, 1,0, 2,1);
179     pathB.close();
180     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
181 }
182 
cubicOp10d(skiatest::Reporter * reporter,const char * filename)183 static void cubicOp10d(skiatest::Reporter* reporter, const char* filename) {
184     SkPath path, pathB;
185     path.setFillType(SkPath::kWinding_FillType);
186     path.moveTo(0,1);
187     path.cubicTo(1,3, 1,0, 4,1);
188     path.close();
189     pathB.setFillType(SkPath::kWinding_FillType);
190     pathB.moveTo(0,1);
191     pathB.cubicTo(1,4, 1,0, 3,1);
192     pathB.close();
193     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
194 }
195 
cubicOp11d(skiatest::Reporter * reporter,const char * filename)196 static void cubicOp11d(skiatest::Reporter* reporter, const char* filename) {
197     SkPath path, pathB;
198     path.setFillType(SkPath::kWinding_FillType);
199     path.moveTo(0,1);
200     path.cubicTo(3,4, 1,0, 5,1);
201     path.close();
202     pathB.setFillType(SkPath::kWinding_FillType);
203     pathB.moveTo(0,1);
204     pathB.cubicTo(1,5, 1,0, 4,3);
205     pathB.close();
206     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
207 }
208 
cubicOp12d(skiatest::Reporter * reporter,const char * filename)209 static void cubicOp12d(skiatest::Reporter* reporter, const char* filename) {
210     SkPath path, pathB;
211     path.setFillType(SkPath::kWinding_FillType);
212     path.moveTo(0,1);
213     path.cubicTo(1,6, 1,0, 1,0);
214     path.close();
215     pathB.setFillType(SkPath::kWinding_FillType);
216     pathB.moveTo(0,1);
217     pathB.cubicTo(0,1, 1,0, 6,1);
218     pathB.close();
219     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
220 }
221 
cubicOp13d(skiatest::Reporter * reporter,const char * filename)222 static void cubicOp13d(skiatest::Reporter* reporter, const char* filename) {
223     SkPath path, pathB;
224     path.setFillType(SkPath::kWinding_FillType);
225     path.moveTo(0,1);
226     path.cubicTo(4,5, 1,0, 5,3);
227     path.close();
228     pathB.setFillType(SkPath::kWinding_FillType);
229     pathB.moveTo(0,1);
230     pathB.cubicTo(3,5, 1,0, 5,4);
231     pathB.close();
232     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
233 }
234 
cubicOp14d(skiatest::Reporter * reporter,const char * filename)235 static void cubicOp14d(skiatest::Reporter* reporter, const char* filename) {
236     SkPath path, pathB;
237     path.setFillType(SkPath::kWinding_FillType);
238     path.moveTo(0,1);
239     path.cubicTo(0,2, 2,0, 2,1);
240     path.close();
241     pathB.setFillType(SkPath::kWinding_FillType);
242     pathB.moveTo(0,2);
243     pathB.cubicTo(1,2, 1,0, 2,0);
244     pathB.close();
245     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
246 }
247 
cubicOp15d(skiatest::Reporter * reporter,const char * filename)248 static void cubicOp15d(skiatest::Reporter* reporter, const char* filename) {
249     SkPath path, pathB;
250     path.setFillType(SkPath::kWinding_FillType);
251     path.moveTo(0,1);
252     path.cubicTo(3,6, 2,0, 2,1);
253     path.close();
254     pathB.setFillType(SkPath::kWinding_FillType);
255     pathB.moveTo(0,2);
256     pathB.cubicTo(1,2, 1,0, 6,3);
257     pathB.close();
258     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
259 }
260 
cubicOp16d(skiatest::Reporter * reporter,const char * filename)261 static void cubicOp16d(skiatest::Reporter* reporter, const char* filename) {
262     SkPath path, pathB;
263     path.setFillType(SkPath::kWinding_FillType);
264     path.moveTo(0,2);
265     path.cubicTo(0,1, 3,0, 1,0);
266     path.close();
267     pathB.setFillType(SkPath::kWinding_FillType);
268     pathB.moveTo(0,3);
269     pathB.cubicTo(0,1, 2,0, 1,0);
270     pathB.close();
271     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
272 }
273 
cubicOp17d(skiatest::Reporter * reporter,const char * filename)274 static void cubicOp17d(skiatest::Reporter* reporter, const char* filename) {
275     SkPath path, pathB;
276     path.setFillType(SkPath::kWinding_FillType);
277     path.moveTo(0,2);
278     path.cubicTo(0,2, 4,0, 2,1);
279     path.close();
280     pathB.setFillType(SkPath::kWinding_FillType);
281     pathB.moveTo(0,4);
282     pathB.cubicTo(1,2, 2,0, 2,0);
283     pathB.close();
284     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
285 }
286 
cubicOp18d(skiatest::Reporter * reporter,const char * filename)287 static void cubicOp18d(skiatest::Reporter* reporter, const char* filename) {
288     SkPath path, pathB;
289     path.setFillType(SkPath::kWinding_FillType);
290     path.moveTo(0,1);
291     path.cubicTo(3,5, 2,0, 2,1);
292     path.close();
293     pathB.setFillType(SkPath::kWinding_FillType);
294     pathB.moveTo(0,2);
295     pathB.cubicTo(1,2, 1,0, 5,3);
296     pathB.close();
297     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
298 }
299 
cubicOp19i(skiatest::Reporter * reporter,const char * filename)300 static void cubicOp19i(skiatest::Reporter* reporter, const char* filename) {
301     SkPath path, pathB;
302     path.setFillType(SkPath::kWinding_FillType);
303     path.moveTo(0,2);
304     path.cubicTo(0,1, 2,1, 6,2);
305     path.close();
306     pathB.setFillType(SkPath::kWinding_FillType);
307     pathB.moveTo(1,2);
308     pathB.cubicTo(2,6, 2,0, 1,0);
309     pathB.close();
310     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
311 }
312 
cubicOp20d(skiatest::Reporter * reporter,const char * filename)313 static void cubicOp20d(skiatest::Reporter* reporter, const char* filename) {
314     SkPath path, pathB;
315     path.setFillType(SkPath::kWinding_FillType);
316     path.moveTo(0,1);
317     path.cubicTo(0,1, 6,0, 2,1);
318     path.close();
319     pathB.setFillType(SkPath::kWinding_FillType);
320     pathB.moveTo(0,6);
321     pathB.cubicTo(1,2, 1,0, 1,0);
322     pathB.close();
323     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
324 }
325 
cubicOp21d(skiatest::Reporter * reporter,const char * filename)326 static void cubicOp21d(skiatest::Reporter* reporter, const char* filename) {
327     SkPath path, pathB;
328     path.setFillType(SkPath::kWinding_FillType);
329     path.moveTo(0,1);
330     path.cubicTo(0,1, 2,1, 6,5);
331     path.close();
332     pathB.setFillType(SkPath::kWinding_FillType);
333     pathB.moveTo(1,2);
334     pathB.cubicTo(5,6, 1,0, 1,0);
335     pathB.close();
336     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
337 }
338 
cubicOp22d(skiatest::Reporter * reporter,const char * filename)339 static void cubicOp22d(skiatest::Reporter* reporter, const char* filename) {
340     SkPath path, pathB;
341     path.setFillType(SkPath::kWinding_FillType);
342     path.moveTo(0,1);
343     path.cubicTo(2,3, 3,0, 2,1);
344     path.close();
345     pathB.setFillType(SkPath::kWinding_FillType);
346     pathB.moveTo(0,3);
347     pathB.cubicTo(1,2, 1,0, 3,2);
348     pathB.close();
349     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
350 }
351 
cubicOp23d(skiatest::Reporter * reporter,const char * filename)352 static void cubicOp23d(skiatest::Reporter* reporter, const char* filename) {
353     SkPath path, pathB;
354     path.setFillType(SkPath::kWinding_FillType);
355     path.moveTo(0,1);
356     path.cubicTo(1,2, 4,0, 2,1);
357     path.close();
358     pathB.setFillType(SkPath::kWinding_FillType);
359     pathB.moveTo(0,4);
360     pathB.cubicTo(1,2, 1,0, 2,1);
361     pathB.close();
362     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
363 }
364 
cubicOp24d(skiatest::Reporter * reporter,const char * filename)365 static void cubicOp24d(skiatest::Reporter* reporter, const char* filename) {
366     SkPath path, pathB;
367     path.setFillType(SkPath::kWinding_FillType);
368     path.moveTo(0,1);
369     path.cubicTo(1,2, 2,0, 3,2);
370     path.close();
371     pathB.setFillType(SkPath::kWinding_FillType);
372     pathB.moveTo(0,2);
373     pathB.cubicTo(2,3, 1,0, 2,1);
374     pathB.close();
375     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
376 }
377 
testIntersect1(skiatest::Reporter * reporter,const char * filename)378 static void testIntersect1(skiatest::Reporter* reporter, const char* filename) {
379     SkPath one, two;
380     one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
381     two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
382     testPathOp(reporter, one, two, kIntersect_SkPathOp, filename);
383 }
384 
testUnion1(skiatest::Reporter * reporter,const char * filename)385 static void testUnion1(skiatest::Reporter* reporter, const char* filename) {
386     SkPath one, two;
387     one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
388     two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
389     testPathOp(reporter, one, two, kUnion_SkPathOp, filename);
390 }
391 
testDiff1(skiatest::Reporter * reporter,const char * filename)392 static void testDiff1(skiatest::Reporter* reporter, const char* filename) {
393     SkPath one, two;
394     one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
395     two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
396     testPathOp(reporter, one, two, kDifference_SkPathOp, filename);
397 }
398 
testXor1(skiatest::Reporter * reporter,const char * filename)399 static void testXor1(skiatest::Reporter* reporter, const char* filename) {
400     SkPath one, two;
401     one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
402     two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
403     testPathOp(reporter, one, two, kXOR_SkPathOp, filename);
404 }
405 
testIntersect2(skiatest::Reporter * reporter,const char * filename)406 static void testIntersect2(skiatest::Reporter* reporter, const char* filename) {
407     SkPath one, two;
408     one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
409     two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
410     testPathOp(reporter, one, two, kIntersect_SkPathOp, filename);
411 }
412 
testUnion2(skiatest::Reporter * reporter,const char * filename)413 static void testUnion2(skiatest::Reporter* reporter, const char* filename) {
414     SkPath one, two;
415     one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
416     two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
417     testPathOp(reporter, one, two, kUnion_SkPathOp, filename);
418 }
419 
testDiff2(skiatest::Reporter * reporter,const char * filename)420 static void testDiff2(skiatest::Reporter* reporter, const char* filename) {
421     SkPath one, two;
422     one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
423     two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
424     testPathOp(reporter, one, two, kDifference_SkPathOp, filename);
425 }
426 
testXor2(skiatest::Reporter * reporter,const char * filename)427 static void testXor2(skiatest::Reporter* reporter, const char* filename) {
428     SkPath one, two;
429     one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
430     two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
431     testPathOp(reporter, one, two, kXOR_SkPathOp, filename);
432 }
433 
testOp1d(skiatest::Reporter * reporter,const char * filename)434 static void testOp1d(skiatest::Reporter* reporter, const char* filename) {
435     SkPath path, pathB;
436     path.setFillType(SkPath::kWinding_FillType);
437     path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
438     path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
439     pathB.setFillType(SkPath::kWinding_FillType);
440     pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
441     pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
442     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
443 }
444 
testOp2d(skiatest::Reporter * reporter,const char * filename)445 static void testOp2d(skiatest::Reporter* reporter, const char* filename) {
446     SkPath path, pathB;
447     path.setFillType(SkPath::kWinding_FillType);
448     path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
449     path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
450     pathB.setFillType(SkPath::kEvenOdd_FillType);
451     pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
452     pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
453     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
454 }
455 
testOp3d(skiatest::Reporter * reporter,const char * filename)456 static void testOp3d(skiatest::Reporter* reporter, const char* filename) {
457     SkPath path, pathB;
458     path.setFillType(SkPath::kWinding_FillType);
459     path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
460     path.addRect(1, 1, 2, 2, SkPath::kCW_Direction);
461     pathB.setFillType(SkPath::kWinding_FillType);
462     pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
463     pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
464     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
465 }
466 
testOp1u(skiatest::Reporter * reporter,const char * filename)467 static void testOp1u(skiatest::Reporter* reporter, const char* filename) {
468     SkPath path, pathB;
469     path.setFillType(SkPath::kWinding_FillType);
470     path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
471     path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
472     pathB.setFillType(SkPath::kWinding_FillType);
473     pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
474     pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
475     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
476 }
477 
testOp4d(skiatest::Reporter * reporter,const char * filename)478 static void testOp4d(skiatest::Reporter* reporter, const char* filename) {
479     SkPath path, pathB;
480     path.setFillType(SkPath::kWinding_FillType);
481     path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
482     path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
483     pathB.setFillType(SkPath::kWinding_FillType);
484     pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
485     pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
486     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
487 }
488 
testOp5d(skiatest::Reporter * reporter,const char * filename)489 static void testOp5d(skiatest::Reporter* reporter, const char* filename) {
490     SkPath path, pathB;
491     path.setFillType(SkPath::kEvenOdd_FillType);
492     path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
493     path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
494     pathB.setFillType(SkPath::kEvenOdd_FillType);
495     pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
496     pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
497     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
498 }
499 
testOp6d(skiatest::Reporter * reporter,const char * filename)500 static void testOp6d(skiatest::Reporter* reporter, const char* filename) {
501     SkPath path, pathB;
502     path.setFillType(SkPath::kEvenOdd_FillType);
503     path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
504     path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
505     pathB.setFillType(SkPath::kWinding_FillType);
506     pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
507     pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
508     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
509 }
510 
testOp7d(skiatest::Reporter * reporter,const char * filename)511 static void testOp7d(skiatest::Reporter* reporter, const char* filename) {
512     SkPath path, pathB;
513     path.setFillType(SkPath::kEvenOdd_FillType);
514     path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
515     path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
516     pathB.setFillType(SkPath::kEvenOdd_FillType);
517     pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
518     pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
519     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
520 }
521 
testOp2u(skiatest::Reporter * reporter,const char * filename)522 static void testOp2u(skiatest::Reporter* reporter, const char* filename) {
523     SkPath path, pathB;
524     path.setFillType(SkPath::kEvenOdd_FillType);
525     path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
526     path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
527     pathB.setFillType(SkPath::kWinding_FillType);
528     pathB.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
529     pathB.addRect(1, 1, 2, 2, SkPath::kCW_Direction);
530     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
531 }
532 
testOp8d(skiatest::Reporter * reporter,const char * filename)533 static void testOp8d(skiatest::Reporter* reporter, const char* filename) {
534     SkPath path, pathB;
535     path.addRect(0, 0, 640, 480);
536     pathB.moveTo(577330, 1971.72f);
537     pathB.cubicTo(10.7082f, -116.596f, 262.057f, 45.6468f, 294.694f, 1.96237f);
538     pathB.close();
539     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
540 }
cubicOp25i(skiatest::Reporter * reporter,const char * filename)541 static void cubicOp25i(skiatest::Reporter* reporter, const char* filename) {
542     SkPath path, pathB;
543     path.setFillType(SkPath::kWinding_FillType);
544     path.moveTo(0,1);
545     path.cubicTo(2,4, 5,0, 3,2);
546     path.close();
547     pathB.setFillType(SkPath::kWinding_FillType);
548     pathB.moveTo(0,5);
549     pathB.cubicTo(2,3, 1,0, 4,2);
550     pathB.close();
551     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
552 }
553 
cubicOp26d(skiatest::Reporter * reporter,const char * filename)554 static void cubicOp26d(skiatest::Reporter* reporter, const char* filename) {
555     SkPath path, pathB;
556     path.setFillType(SkPath::kWinding_FillType);
557     path.moveTo(0,1);
558     path.cubicTo(3,4, 4,0, 3,2);
559     path.close();
560     pathB.setFillType(SkPath::kWinding_FillType);
561     pathB.moveTo(0,4);
562     pathB.cubicTo(2,3, 1,0, 4,3);
563     pathB.close();
564     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
565 }
566 
cubicOp27d(skiatest::Reporter * reporter,const char * filename)567 static void cubicOp27d(skiatest::Reporter* reporter, const char* filename) {
568     SkPath path, pathB;
569     path.setFillType(SkPath::kWinding_FillType);
570     path.moveTo(0,1);
571     path.cubicTo(3,6, 1,0, 5,2);
572     path.close();
573     pathB.setFillType(SkPath::kWinding_FillType);
574     pathB.moveTo(0,1);
575     pathB.cubicTo(2,5, 1,0, 6,3);
576     pathB.close();
577     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
578 }
579 
cubicOp28u(skiatest::Reporter * reporter,const char * filename)580 static void cubicOp28u(skiatest::Reporter* reporter, const char* filename) {
581     SkPath path, pathB;
582     path.setFillType(SkPath::kWinding_FillType);
583     path.moveTo(0,1);
584     path.cubicTo(1,4, 6,0, 3,2);
585     path.close();
586     pathB.setFillType(SkPath::kWinding_FillType);
587     pathB.moveTo(0,6);
588     pathB.cubicTo(2,3, 1,0, 4,1);
589     pathB.close();
590     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
591 }
592 
cubicOp29d(skiatest::Reporter * reporter,const char * filename)593 static void cubicOp29d(skiatest::Reporter* reporter, const char* filename) {
594     SkPath path, pathB;
595     path.setFillType(SkPath::kWinding_FillType);
596     path.moveTo(0,1);
597     path.cubicTo(2,5, 6,0, 4,2);
598     path.close();
599     pathB.setFillType(SkPath::kWinding_FillType);
600     pathB.moveTo(0,6);
601     pathB.cubicTo(2,4, 1,0, 5,2);
602     pathB.close();
603     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
604 }
605 
cubicOp30d(skiatest::Reporter * reporter,const char * filename)606 static void cubicOp30d(skiatest::Reporter* reporter, const char* filename) {
607     SkPath path, pathB;
608     path.setFillType(SkPath::kWinding_FillType);
609     path.moveTo(0,1);
610     path.cubicTo(2,5, 6,0, 5,3);
611     path.close();
612     pathB.setFillType(SkPath::kWinding_FillType);
613     pathB.moveTo(0,6);
614     pathB.cubicTo(3,5, 1,0, 5,2);
615     pathB.close();
616     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
617 }
618 
cubicOp31d(skiatest::Reporter * reporter,const char * filename)619 static void cubicOp31d(skiatest::Reporter* reporter, const char* filename) {
620     SkPath path, pathB;
621     path.setFillType(SkPath::kWinding_FillType);
622     path.moveTo(0,2);
623     path.cubicTo(0,3, 2,1, 4,0);
624     path.close();
625     pathB.setFillType(SkPath::kWinding_FillType);
626     pathB.moveTo(1,2);
627     pathB.cubicTo(0,4, 2,0, 3,0);
628     pathB.close();
629     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
630 }
631 
cubicOp31u(skiatest::Reporter * reporter,const char * filename)632 static void cubicOp31u(skiatest::Reporter* reporter, const char* filename) {
633     SkPath path, pathB;
634     path.setFillType(SkPath::kWinding_FillType);
635     path.moveTo(0,2);
636     path.cubicTo(0,3, 2,1, 4,0);
637     path.close();
638     pathB.setFillType(SkPath::kWinding_FillType);
639     pathB.moveTo(1,2);
640     pathB.cubicTo(0,4, 2,0, 3,0);
641     pathB.close();
642     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
643 }
644 
cubicOp31x(skiatest::Reporter * reporter,const char * filename)645 static void cubicOp31x(skiatest::Reporter* reporter, const char* filename) {
646     SkPath path, pathB;
647     path.setFillType(SkPath::kWinding_FillType);
648     path.moveTo(0,2);
649     path.cubicTo(0,3, 2,1, 4,0);
650     path.close();
651     pathB.setFillType(SkPath::kWinding_FillType);
652     pathB.moveTo(1,2);
653     pathB.cubicTo(0,4, 2,0, 3,0);
654     pathB.close();
655     testPathOp(reporter, path, pathB, kXOR_SkPathOp, filename);
656 }
657 
cubicOp32d(skiatest::Reporter * reporter,const char * filename)658 static void cubicOp32d(skiatest::Reporter* reporter, const char* filename) {
659     SkPath path, pathB;
660     path.setFillType(SkPath::kWinding_FillType);
661     path.moveTo(0,1);
662     path.cubicTo(1,2, 6,0, 3,1);
663     path.close();
664     pathB.setFillType(SkPath::kWinding_FillType);
665     pathB.moveTo(0,6);
666     pathB.cubicTo(1,3, 1,0, 2,1);
667     pathB.close();
668     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
669 }
670 
cubicOp33i(skiatest::Reporter * reporter,const char * filename)671 static void cubicOp33i(skiatest::Reporter* reporter, const char* filename) {
672     SkPath path, pathB;
673     path.setFillType(SkPath::kWinding_FillType);
674     path.moveTo(0,1);
675     path.cubicTo(1,2, 6,0, 3,1);
676     path.close();
677     pathB.setFillType(SkPath::kWinding_FillType);
678     pathB.moveTo(0,6);
679     pathB.cubicTo(1,3, 1,0, 2,1);
680     pathB.close();
681     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
682 }
683 
cubicOp34d(skiatest::Reporter * reporter,const char * filename)684 static void cubicOp34d(skiatest::Reporter* reporter, const char* filename) {
685     SkPath path, pathB;
686     path.setFillType(SkPath::kWinding_FillType);
687     path.moveTo(0,1);
688     path.cubicTo(3,5, 2,1, 3,1);
689     path.close();
690     pathB.setFillType(SkPath::kWinding_FillType);
691     pathB.moveTo(1,2);
692     pathB.cubicTo(1,3, 1,0, 5,3);
693     pathB.close();
694     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
695 }
696 
cubicOp35d(skiatest::Reporter * reporter,const char * filename)697 static void cubicOp35d(skiatest::Reporter* reporter, const char* filename) {
698     SkPath path, pathB;
699     path.setFillType(SkPath::kWinding_FillType);
700     path.moveTo(0,1);
701     path.cubicTo(1,5, 2,1, 4,0);
702     path.close();
703     pathB.setFillType(SkPath::kWinding_FillType);
704     pathB.moveTo(1,2);
705     pathB.cubicTo(0,4, 1,0, 5,1);
706     pathB.close();
707     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
708 }
709 
cubicOp36u(skiatest::Reporter * reporter,const char * filename)710 static void cubicOp36u(skiatest::Reporter* reporter, const char* filename) {
711     SkPath path, pathB;
712     path.setFillType(SkPath::kWinding_FillType);
713     path.moveTo(0,1);
714     path.cubicTo(1,6, 2,0, 5,1);
715     path.close();
716     pathB.setFillType(SkPath::kWinding_FillType);
717     pathB.moveTo(0,2);
718     pathB.cubicTo(1,5, 1,0, 6,1);
719     pathB.close();
720     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
721 }
722 
cubicOp37d(skiatest::Reporter * reporter,const char * filename)723 static void cubicOp37d(skiatest::Reporter* reporter, const char* filename) {
724     SkPath path, pathB;
725     path.setFillType(SkPath::kWinding_FillType);
726     path.moveTo(0,1);
727     path.cubicTo(2,6, 6,1, 4,3);
728     path.close();
729     pathB.setFillType(SkPath::kWinding_FillType);
730     pathB.moveTo(1,6);
731     pathB.cubicTo(3,4, 1,0, 6,2);
732     pathB.close();
733     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
734 }
735 
cubicOp38d(skiatest::Reporter * reporter,const char * filename)736 static void cubicOp38d(skiatest::Reporter* reporter, const char* filename) {
737     SkPath path, pathB;
738     path.setFillType(SkPath::kWinding_FillType);
739     path.moveTo(0,1);
740     path.cubicTo(0,6, 3,2, 4,1);
741     path.close();
742     pathB.setFillType(SkPath::kWinding_FillType);
743     pathB.moveTo(2,3);
744     pathB.cubicTo(1,4, 1,0, 6,0);
745     pathB.close();
746     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
747 }
748 
cubicOp39d(skiatest::Reporter * reporter,const char * filename)749 static void cubicOp39d(skiatest::Reporter* reporter, const char* filename) {
750     SkPath path, pathB;
751     path.setFillType(SkPath::kWinding_FillType);
752     path.moveTo(0,1);
753     path.cubicTo(2,3, 5,1, 4,3);
754     path.close();
755     pathB.setFillType(SkPath::kWinding_FillType);
756     pathB.moveTo(1,5);
757     pathB.cubicTo(3,4, 1,0, 3,2);
758     pathB.close();
759     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
760 }
761 
cubicOp40d(skiatest::Reporter * reporter,const char * filename)762 static void cubicOp40d(skiatest::Reporter* reporter, const char* filename) {
763     SkPath path, pathB;
764     path.setFillType(SkPath::kWinding_FillType);
765     path.moveTo(0,1);
766     path.cubicTo(1,5, 3,2, 4,2);
767     path.close();
768     pathB.setFillType(SkPath::kWinding_FillType);
769     pathB.moveTo(2,3);
770     pathB.cubicTo(2,4, 1,0, 5,1);
771     pathB.close();
772     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
773 }
774 
cubicOp41i(skiatest::Reporter * reporter,const char * filename)775 static void cubicOp41i(skiatest::Reporter* reporter, const char* filename) {
776     SkPath path, pathB;
777     path.setFillType(SkPath::kWinding_FillType);
778     path.moveTo(0,1);
779     path.cubicTo(2,6, 4,3, 6,4);
780     path.close();
781     pathB.setFillType(SkPath::kWinding_FillType);
782     pathB.moveTo(3,4);
783     pathB.cubicTo(4,6, 1,0, 6,2);
784     pathB.close();
785     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
786 }
787 
cubicOp42d(skiatest::Reporter * reporter,const char * filename)788 static void cubicOp42d(skiatest::Reporter* reporter, const char* filename) {
789     SkPath path, pathB;
790     path.setFillType(SkPath::kWinding_FillType);
791     path.moveTo(0,1);
792     path.cubicTo(1,2, 6,5, 5,4);
793     path.close();
794     pathB.setFillType(SkPath::kWinding_FillType);
795     pathB.moveTo(5,6);
796     pathB.cubicTo(4,5, 1,0, 2,1);
797     pathB.close();
798     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
799 }
800 
cubicOp43d(skiatest::Reporter * reporter,const char * filename)801 static void cubicOp43d(skiatest::Reporter* reporter, const char* filename) {
802     SkPath path, pathB;
803     path.setFillType(SkPath::kWinding_FillType);
804     path.moveTo(0,2);
805     path.cubicTo(1,2, 4,0, 3,1);
806     path.close();
807     pathB.setFillType(SkPath::kWinding_FillType);
808     pathB.moveTo(0,4);
809     pathB.cubicTo(1,3, 2,0, 2,1);
810     pathB.close();
811     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
812 }
813 
cubicOp44d(skiatest::Reporter * reporter,const char * filename)814 static void cubicOp44d(skiatest::Reporter* reporter, const char* filename) {
815     SkPath path, pathB;
816     path.setFillType(SkPath::kWinding_FillType);
817     path.moveTo(0,2);
818     path.cubicTo(3,6, 4,0, 3,2);
819     path.close();
820     pathB.setFillType(SkPath::kWinding_FillType);
821     pathB.moveTo(0,4);
822     pathB.cubicTo(2,3, 2,0, 6,3);
823     pathB.close();
824     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
825 }
826 
cubicOp45d(skiatest::Reporter * reporter,const char * filename)827 static void cubicOp45d(skiatest::Reporter* reporter, const char* filename) {
828     SkPath path, pathB;
829     path.setFillType(SkPath::kWinding_FillType);
830     path.moveTo(0,2);
831     path.cubicTo(2,4, 4,0, 3,2);
832     path.close();
833     pathB.setFillType(SkPath::kWinding_FillType);
834     pathB.moveTo(0,4);
835     pathB.cubicTo(2,3, 2,0, 4,2);
836     pathB.close();
837     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
838 }
839 
cubicOp46d(skiatest::Reporter * reporter,const char * filename)840 static void cubicOp46d(skiatest::Reporter* reporter, const char* filename) {
841     SkPath path, pathB;
842     path.setFillType(SkPath::kWinding_FillType);
843     path.moveTo(0,2);
844     path.cubicTo(3,5, 5,0, 4,2);
845     path.close();
846     pathB.setFillType(SkPath::kWinding_FillType);
847     pathB.moveTo(0,5);
848     pathB.cubicTo(2,4, 2,0, 5,3);
849     pathB.close();
850     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
851 }
852 
cubicOp47d(skiatest::Reporter * reporter,const char * filename)853 static void cubicOp47d(skiatest::Reporter* reporter, const char* filename) {
854     SkPath path, pathB;
855     path.setFillType(SkPath::kWinding_FillType);
856     path.moveTo(0,1);
857     path.cubicTo(1,6, 6,2, 5,4);
858     path.close();
859     pathB.setFillType(SkPath::kWinding_FillType);
860     pathB.moveTo(2,6);
861     pathB.cubicTo(4,5, 1,0, 6,1);
862     pathB.close();
863     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
864 }
865 
cubicOp48d(skiatest::Reporter * reporter,const char * filename)866 static void cubicOp48d(skiatest::Reporter* reporter, const char* filename) {
867     SkPath path, pathB;
868     path.setFillType(SkPath::kWinding_FillType);
869     path.moveTo(0,2);
870     path.cubicTo(2,3, 5,1, 3,2);
871     path.close();
872     pathB.setFillType(SkPath::kWinding_FillType);
873     pathB.moveTo(1,5);
874     pathB.cubicTo(2,3, 2,0, 3,2);
875     pathB.close();
876     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
877 }
878 
cubicOp49d(skiatest::Reporter * reporter,const char * filename)879 static void cubicOp49d(skiatest::Reporter* reporter, const char* filename) {
880     SkPath path, pathB;
881     path.setFillType(SkPath::kWinding_FillType);
882     path.moveTo(0,2);
883     path.cubicTo(1,5, 3,2, 4,1);
884     path.close();
885     pathB.setFillType(SkPath::kWinding_FillType);
886     pathB.moveTo(2,3);
887     pathB.cubicTo(1,4, 2,0, 5,1);
888     pathB.close();
889     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
890 }
891 
cubicOp50d(skiatest::Reporter * reporter,const char * filename)892 static void cubicOp50d(skiatest::Reporter* reporter, const char* filename) {
893     SkPath path, pathB;
894     path.setFillType(SkPath::kWinding_FillType);
895     path.moveTo(0,3);
896     path.cubicTo(1,6, 5,0, 5,1);
897     path.close();
898     pathB.setFillType(SkPath::kWinding_FillType);
899     pathB.moveTo(0,5);
900     pathB.cubicTo(1,5, 3,0, 6,1);
901     pathB.close();
902     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
903 }
904 
cubicOp51d(skiatest::Reporter * reporter,const char * filename)905 static void cubicOp51d(skiatest::Reporter* reporter, const char* filename) {
906     SkPath path, pathB;
907     path.setFillType(SkPath::kWinding_FillType);
908     path.moveTo(0,3);
909     path.cubicTo(1,2, 4,1, 6,0);
910     path.close();
911     pathB.setFillType(SkPath::kWinding_FillType);
912     pathB.moveTo(1,4);
913     pathB.cubicTo(0,6, 3,0, 2,1);
914     pathB.close();
915     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
916 }
917 
cubicOp52d(skiatest::Reporter * reporter,const char * filename)918 static void cubicOp52d(skiatest::Reporter* reporter, const char* filename) {
919     SkPath path, pathB;
920     path.setFillType(SkPath::kWinding_FillType);
921     path.moveTo(0,2);
922     path.cubicTo(1,2, 5,4, 4,3);
923     path.close();
924     pathB.setFillType(SkPath::kWinding_FillType);
925     pathB.moveTo(4,5);
926     pathB.cubicTo(3,4, 2,0, 2,1);
927     pathB.close();
928     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
929 }
930 
cubicOp53d(skiatest::Reporter * reporter,const char * filename)931 static void cubicOp53d(skiatest::Reporter* reporter, const char* filename) {
932     SkPath path, pathB;
933     path.setFillType(SkPath::kWinding_FillType);
934     path.moveTo(0,3);
935     path.cubicTo(1,2, 5,3, 2,1);
936     path.close();
937     pathB.setFillType(SkPath::kWinding_FillType);
938     pathB.moveTo(3,5);
939     pathB.cubicTo(1,2, 3,0, 2,1);
940     pathB.close();
941     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
942 }
943 
cubicOp54d(skiatest::Reporter * reporter,const char * filename)944 static void cubicOp54d(skiatest::Reporter* reporter, const char* filename) {
945     SkPath path, pathB;
946     path.setFillType(SkPath::kWinding_FillType);
947     path.moveTo(0,4);
948     path.cubicTo(1,3, 5,4, 4,2);
949     path.close();
950     pathB.setFillType(SkPath::kWinding_FillType);
951     pathB.moveTo(4,5);
952     pathB.cubicTo(2,4, 4,0, 3,1);
953     pathB.close();
954     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
955 }
956 
cubicOp55d(skiatest::Reporter * reporter,const char * filename)957 static void cubicOp55d(skiatest::Reporter* reporter, const char* filename) {
958     SkPath path, pathB;
959     path.setFillType(SkPath::kWinding_FillType);
960     path.moveTo(0,5);
961     path.cubicTo(1,3, 3,2, 5,0);
962     path.close();
963     pathB.setFillType(SkPath::kWinding_FillType);
964     pathB.moveTo(2,3);
965     pathB.cubicTo(0,5, 5,0, 3,1);
966     pathB.close();
967     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
968 }
969 
cubicOp56d(skiatest::Reporter * reporter,const char * filename)970 static void cubicOp56d(skiatest::Reporter* reporter, const char* filename) {
971     SkPath path, pathB;
972     path.setFillType(SkPath::kWinding_FillType);
973     path.moveTo(0,1);
974     path.cubicTo(2,6, 5,0, 2,1);
975     path.close();
976     pathB.setFillType(SkPath::kWinding_FillType);
977     pathB.moveTo(0,5);
978     pathB.cubicTo(1,2, 1,0, 6,2);
979     pathB.close();
980     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
981 }
982 
cubicOp57d(skiatest::Reporter * reporter,const char * filename)983 static void cubicOp57d(skiatest::Reporter* reporter, const char* filename) {
984     SkPath path, pathB;
985     path.setFillType(SkPath::kWinding_FillType);
986     path.moveTo(0,5);
987     path.cubicTo(0,5, 5,4, 6,4);
988     path.close();
989     pathB.setFillType(SkPath::kWinding_FillType);
990     pathB.moveTo(4,5);
991     pathB.cubicTo(4,6, 5,0, 5,0);
992     pathB.close();
993     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
994 }
995 
cubicOp58d(skiatest::Reporter * reporter,const char * filename)996 static void cubicOp58d(skiatest::Reporter* reporter, const char* filename) {
997     SkPath path, pathB;
998     path.setFillType(SkPath::kWinding_FillType);
999     path.moveTo(0,5);
1000     path.cubicTo(3,4, 6,5, 5,3);
1001     path.close();
1002     pathB.setFillType(SkPath::kWinding_FillType);
1003     pathB.moveTo(5,6);
1004     pathB.cubicTo(3,5, 5,0, 4,3);
1005     pathB.close();
1006     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
1007 }
1008 
cubicOp59d(skiatest::Reporter * reporter,const char * filename)1009 static void cubicOp59d(skiatest::Reporter* reporter, const char* filename) {
1010     SkPath path, pathB;
1011     path.setFillType(SkPath::kWinding_FillType);
1012     path.moveTo(0,1);
1013     path.cubicTo(5,6, 4,0, 4,1);
1014     path.close();
1015     pathB.setFillType(SkPath::kWinding_FillType);
1016     pathB.moveTo(0,4);
1017     pathB.cubicTo(1,4, 1,0, 6,5);
1018     pathB.close();
1019     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
1020 }
1021 
cubicOp60d(skiatest::Reporter * reporter,const char * filename)1022 static void cubicOp60d(skiatest::Reporter* reporter, const char* filename) {
1023     SkPath path, pathB;
1024     path.setFillType(SkPath::kWinding_FillType);
1025     path.moveTo(0,2);
1026     path.cubicTo(4,6, 6,0, 5,2);
1027     path.close();
1028     pathB.setFillType(SkPath::kWinding_FillType);
1029     pathB.moveTo(0,6);
1030     pathB.cubicTo(2,5, 2,0, 6,4);
1031     pathB.close();
1032     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
1033 }
1034 
cubicOp61d(skiatest::Reporter * reporter,const char * filename)1035 static void cubicOp61d(skiatest::Reporter* reporter, const char* filename) {
1036     SkPath path, pathB;
1037     path.setFillType(SkPath::kWinding_FillType);
1038     path.moveTo(1,2);
1039     path.cubicTo(0,5, 3,2, 6,1);
1040     path.close();
1041     pathB.setFillType(SkPath::kWinding_FillType);
1042     pathB.moveTo(2,3);
1043     pathB.cubicTo(1,6, 2,1, 5,0);
1044     pathB.close();
1045     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
1046 }
1047 
cubicOp62d(skiatest::Reporter * reporter,const char * filename)1048 static void cubicOp62d(skiatest::Reporter* reporter, const char* filename) {
1049     SkPath path, pathB;
1050     path.setFillType(SkPath::kWinding_FillType);
1051     path.moveTo(1,3);
1052     path.cubicTo(5,6, 5,3, 5,4);
1053     path.close();
1054     pathB.setFillType(SkPath::kWinding_FillType);
1055     pathB.moveTo(3,5);
1056     pathB.cubicTo(4,5, 3,1, 6,5);
1057     pathB.close();
1058     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
1059 }
1060 
cubicOp63d(skiatest::Reporter * reporter,const char * filename)1061 static void cubicOp63d(skiatest::Reporter* reporter, const char* filename) {
1062     SkPath path, pathB;
1063     path.setFillType(SkPath::kWinding_FillType);
1064     path.moveTo(2,3);
1065     path.cubicTo(0,4, 3,2, 5,3);
1066     path.close();
1067     pathB.setFillType(SkPath::kWinding_FillType);
1068     pathB.moveTo(2,3);
1069     pathB.cubicTo(3,5, 3,2, 4,0);
1070     pathB.close();
1071     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
1072 }
1073 
cubicOp64d(skiatest::Reporter * reporter,const char * filename)1074 static void cubicOp64d(skiatest::Reporter* reporter, const char* filename) {
1075     SkPath path, pathB;
1076     path.moveTo(0,1);
1077     path.cubicTo(0,1, 1,0, 3,0);
1078     path.lineTo(0,1);
1079     path.close();
1080     pathB.moveTo(0,1);
1081     pathB.cubicTo(0,3, 1,0, 1,0);
1082     pathB.lineTo(0,1);
1083     pathB.close();
1084     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
1085 }
1086 
cubicOp65d(skiatest::Reporter * reporter,const char * filename)1087 static void cubicOp65d(skiatest::Reporter* reporter, const char* filename) {
1088     SkPath path, pathB;
1089     path.moveTo(0,1);
1090     path.cubicTo(1,5, 1,0, 1,0);
1091     path.lineTo(0,1);
1092     path.close();
1093     pathB.moveTo(0,1);
1094     pathB.cubicTo(0,1, 1,0, 5,1);
1095     pathB.lineTo(0,1);
1096     pathB.close();
1097     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
1098 }
1099 
rectOp1d(skiatest::Reporter * reporter,const char * filename)1100 static void rectOp1d(skiatest::Reporter* reporter, const char* filename) {
1101     SkPath path, pathB;
1102     path.moveTo(0,1);
1103     path.cubicTo(0,1, 1,0, 3,0);
1104     path.lineTo(0,1);
1105     path.close();
1106     pathB.moveTo(0,1);
1107     pathB.cubicTo(0,3, 1,0, 1,0);
1108     pathB.lineTo(0,1);
1109     pathB.close();
1110     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
1111 }
1112 
cubicOp66u(skiatest::Reporter * reporter,const char * filename)1113 static void cubicOp66u(skiatest::Reporter* reporter, const char* filename) {
1114     SkPath path, pathB;
1115     path.setFillType(SkPath::kWinding_FillType);
1116     path.moveTo(0,1);
1117     path.cubicTo(2,6, 4,2, 5,3);
1118     path.close();
1119     pathB.setFillType(SkPath::kWinding_FillType);
1120     pathB.moveTo(2,4);
1121     pathB.cubicTo(3,5, 1,0, 6,2);
1122     pathB.close();
1123     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
1124 }
1125 
cubicOp67u(skiatest::Reporter * reporter,const char * filename)1126 static void cubicOp67u(skiatest::Reporter* reporter, const char* filename) {
1127     SkPath path, pathB;
1128     path.moveTo(3,5);
1129     path.cubicTo(1,6, 5,0, 3,1);
1130     path.lineTo(3,5);
1131     path.close();
1132     pathB.moveTo(0,5);
1133     pathB.cubicTo(1,3, 5,3, 6,1);
1134     pathB.lineTo(0,5);
1135     pathB.close();
1136     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
1137 }
1138 
cubicOp68u(skiatest::Reporter * reporter,const char * filename)1139 static void cubicOp68u(skiatest::Reporter* reporter, const char* filename) {
1140     SkPath path, pathB;
1141     path.moveTo(0,5);
1142     path.cubicTo(4,5, 4,1, 5,0);
1143     path.close();
1144     pathB.moveTo(1,4);
1145     pathB.cubicTo(0,5, 5,0, 5,4);
1146     pathB.close();
1147     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
1148 }
1149 
cubicOp69d(skiatest::Reporter * reporter,const char * filename)1150 static void cubicOp69d(skiatest::Reporter* reporter, const char* filename) {
1151     SkPath path, pathB;
1152     path.moveTo(1,3);
1153     path.cubicTo(0,1, 3,1, 2,0);
1154     path.close();
1155     pathB.moveTo(1,3);
1156     pathB.cubicTo(0,2, 3,1, 1,0);
1157     pathB.close();
1158     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
1159 }
1160 
1161 SkPathOp ops[] = {
1162     kUnion_SkPathOp,
1163     kXOR_SkPathOp,
1164     kReverseDifference_SkPathOp,
1165     kXOR_SkPathOp,
1166     kReverseDifference_SkPathOp,
1167 };
1168 
rRect1(skiatest::Reporter * reporter,const char * filename)1169 static void rRect1(skiatest::Reporter* reporter, const char* filename) {
1170     SkScalar xA = 0.65f;
1171     SkScalar xB = 10.65f;
1172     SkScalar xC = 20.65f;
1173     SkScalar xD = 30.65f;
1174     SkScalar xE = 40.65f;
1175     SkScalar xF = 50.65f;
1176 
1177     SkScalar yA = 0.65f;
1178     SkScalar yB = 10.65f;
1179     SkScalar yC = 20.65f;
1180     SkScalar yD = 30.65f;
1181     SkScalar yE = 40.65f;
1182     SkScalar yF = 50.65f;
1183     SkPath paths[5];
1184     SkRect rects[5];
1185     rects[0].set(xB, yB, xE, yE);
1186     paths[0].addRoundRect(rects[0], SkIntToScalar(5), SkIntToScalar(5));  // red
1187     rects[1].set(xA, yA, xD, yD);
1188     paths[1].addRoundRect(rects[1], SkIntToScalar(5), SkIntToScalar(5));  // green
1189     rects[2].set(xC, yA, xF, yD);
1190     paths[2].addRoundRect(rects[2], SkIntToScalar(5), SkIntToScalar(5));  // blue
1191     rects[3].set(xA, yC, xD, yF);
1192     paths[3].addRoundRect(rects[3], SkIntToScalar(5), SkIntToScalar(5));  // yellow
1193     rects[4].set(xC, yC, xF, yF);
1194     paths[4].addRoundRect(rects[4], SkIntToScalar(5), SkIntToScalar(5));  // cyan
1195     SkPath path;
1196     path.setFillType(SkPath::kInverseEvenOdd_FillType);
1197     for (int index = 0; index < 5; ++index) {
1198         testPathOp(reporter, path, paths[index], ops[index], filename);
1199         Op(path, paths[index], ops[index], &path);
1200     }
1201 }
1202 
skp1(skiatest::Reporter * reporter,const char * filename)1203 static void skp1(skiatest::Reporter* reporter, const char* filename) {
1204     SkPath path;
1205     path.setFillType(SkPath::kEvenOdd_FillType);
1206     path.moveTo(189,7);
1207     path.cubicTo(189,5.34314585f, 190.34314f,4, 192,4);
1208     path.lineTo(243,4);
1209     path.cubicTo(244.65686f,4, 246,5.34314585f, 246,7);
1210     path.lineTo(246,21);
1211     path.cubicTo(246,22.6568546f, 244.65686f,24, 243,24);
1212     path.lineTo(192,24);
1213     path.cubicTo(190.34314f,24, 189,22.6568546f, 189,21);
1214     path.lineTo(189,7);
1215     path.close();
1216     path.moveTo(191,8);
1217     path.cubicTo(191,6.89543009f, 191.895432f,6, 193,6);
1218     path.lineTo(242,6);
1219     path.cubicTo(243.104568f,6, 244,6.89543009f, 244,8);
1220     path.lineTo(244,20);
1221     path.cubicTo(244,21.1045704f, 243.104568f,22, 242,22);
1222     path.lineTo(193,22);
1223     path.cubicTo(191.895432f,22, 191,21.1045704f, 191,20);
1224     path.lineTo(191,8);
1225     path.close();
1226     SkPath pathB;
1227     pathB.setFillType(SkPath::kWinding_FillType);
1228     pathB.moveTo(189,4);
1229     pathB.lineTo(199,14);
1230     pathB.lineTo(236,14);
1231     pathB.lineTo(246,4);
1232     pathB.lineTo(189,4);
1233     pathB.close();
1234     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1235 }
1236 
skp2(skiatest::Reporter * reporter,const char * filename)1237 static void skp2(skiatest::Reporter* reporter, const char* filename) {
1238     SkPath path;
1239     path.setFillType(SkPath::kEvenOdd_FillType);
1240     path.moveTo(253.000000f, 11757.0000f);
1241     path.lineTo(253.000000f, 222.000000f);
1242     path.lineTo(823.000000f, 222.000000f);
1243     path.lineTo(823.000000f, 11757.0000f);
1244     path.lineTo(253.000000f, 11757.0000f);
1245     path.close();
1246     SkPath pathB;
1247     pathB.setFillType(SkPath::kWinding_FillType);
1248     pathB.moveTo(258.000000f, 1028.00000f);
1249     pathB.lineTo(258.000000f, 1027.00000f);
1250     pathB.lineTo(823.000000f, 1027.00000f);
1251     pathB.lineTo(823.000000f, 1028.00000f);
1252     pathB.lineTo(258.000000f, 1028.00000f);
1253     pathB.close();
1254     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1255 }
1256 
skp3(skiatest::Reporter * reporter,const char * filename)1257 static void skp3(skiatest::Reporter* reporter, const char* filename) {
1258     SkPath path;
1259     path.setFillType(SkPath::kEvenOdd_FillType);
1260     path.moveTo(717.000000f, 507.000000f);
1261     path.lineTo(717.000000f, 425.000000f);
1262     path.lineTo(973.000000f, 425.000000f);
1263     path.lineTo(973.000000f, 507.000000f);
1264     path.quadTo(973.000000f, 508.242645f, 972.121582f, 509.121613f);
1265     path.quadTo(971.242615f, 510.000000f, 970.000000f, 510.000000f);
1266     path.lineTo(720.000000f, 510.000000f);
1267     path.quadTo(718.757385f, 510.000000f, 717.878418f, 509.121613f);
1268     path.quadTo(717.000000f, 508.242645f, 717.000000f, 507.000000f);
1269     path.close();
1270     path.moveTo(719.000000f, 426.000000f);
1271     path.lineTo(971.000000f, 426.000000f);
1272     path.lineTo(971.000000f, 506.000000f);
1273     path.cubicTo(971.000000f, 507.104584f, 970.104553f, 508.000000f, 969.000000f, 508.000000f);
1274     path.lineTo(721.000000f, 508.000000f);
1275     path.cubicTo(719.895447f, 508.000000f, 719.000000f, 507.104584f, 719.000000f, 506.000000f);
1276     path.lineTo(719.000000f, 426.000000f);
1277     path.close();
1278     SkPath pathB;
1279     pathB.setFillType(SkPath::kWinding_FillType);
1280     pathB.moveTo(717.000000f, 510.000000f);
1281     pathB.lineTo(760.000000f, 467.000000f);
1282     pathB.lineTo(930.000000f, 467.000000f);
1283     pathB.lineTo(973.000000f, 510.000000f);
1284     pathB.lineTo(717.000000f, 510.000000f);
1285     pathB.close();
1286     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1287 }
1288 
skp4(skiatest::Reporter * reporter,const char * filename)1289 static void skp4(skiatest::Reporter* reporter, const char* filename) {
1290     SkPath path;
1291     path.setFillType(SkPath::kEvenOdd_FillType);
1292     path.moveTo(230.756805f, 591.756775f);
1293     path.quadTo(232.514725f, 590.000000f, 235.000000f, 590.000000f);
1294     path.lineTo(300.000000f, 590.000000f);
1295     path.quadTo(302.485291f, 590.000000f, 304.243195f, 591.756775f);
1296     path.quadTo(306.000000f, 593.514709f, 306.000000f, 596.000000f);
1297     path.lineTo(306.000000f, 617.000000f);
1298     path.lineTo(229.000000f, 617.000000f);
1299     path.lineTo(229.000000f, 596.000000f);
1300     path.quadTo(229.000000f, 593.514709f, 230.756805f, 591.756775f);
1301     path.close();
1302     path.moveTo(231.000000f, 597.000000f);
1303     path.cubicTo(231.000000f, 594.238586f, 233.238571f, 592.000000f, 236.000000f, 592.000000f);
1304     path.lineTo(299.000000f, 592.000000f);
1305     path.cubicTo(301.761414f, 592.000000f, 304.000000f, 594.238586f, 304.000000f, 597.000000f);
1306     path.lineTo(304.000000f, 616.000000f);
1307     path.lineTo(231.000000f, 616.000000f);
1308     path.lineTo(231.000000f, 597.000000f);
1309     path.close();
1310     SkPath pathB;
1311     pathB.setFillType(SkPath::kWinding_FillType);
1312     pathB.moveTo(306.000000f, 590.000000f);
1313     pathB.lineTo(292.000000f, 604.000000f);
1314     pathB.lineTo(305.000000f, 617.000000f);
1315     pathB.lineTo(306.000000f, 617.000000f);
1316     pathB.lineTo(306.000000f, 590.000000f);
1317     pathB.close();
1318     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1319 }
1320 
skp5(skiatest::Reporter * reporter,const char * filename)1321 static void skp5(skiatest::Reporter* reporter, const char* filename) {
1322     SkPath path;
1323     path.setFillType(SkPath::kEvenOdd_FillType);
1324     path.moveTo(18.0000000f, 226.000000f);
1325     path.quadTo(14.6862917f, 226.000000f, 12.3423996f, 228.342407f);
1326     path.quadTo(10.0000000f, 230.686295f, 10.0000000f, 234.000000f);
1327     path.lineTo(10.0000000f, 253.000000f);
1328     path.lineTo(1247.00000f, 253.000000f);
1329     path.lineTo(1247.00000f, 234.000000f);
1330     path.quadTo(1247.00000f, 230.686295f, 1244.65759f, 228.342407f);
1331     path.quadTo(1242.31372f, 226.000000f, 1239.00000f, 226.000000f);
1332     path.lineTo(18.0000000f, 226.000000f);
1333     path.close();
1334     SkPath pathB;
1335     pathB.setFillType(SkPath::kInverseWinding_FillType);
1336     pathB.moveTo(18.0000000f, 226.000000f);
1337     pathB.lineTo(1239.00000f, 226.000000f);
1338     pathB.cubicTo(1243.41833f, 226.000000f, 1247.00000f, 229.581726f, 1247.00000f, 234.000000f);
1339     pathB.lineTo(1247.00000f, 252.000000f);
1340     pathB.lineTo(10.0000000f, 252.000000f);
1341     pathB.lineTo(10.0000000f, 234.000000f);
1342     pathB.cubicTo(10.0000000f, 229.581726f, 13.5817204f, 226.000000f, 18.0000000f, 226.000000f);
1343     pathB.close();
1344     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1345 }
1346 
cubicOp70d(skiatest::Reporter * reporter,const char * filename)1347 static void cubicOp70d(skiatest::Reporter* reporter, const char* filename) {
1348     SkPath path, pathB;
1349     path.setFillType(SkPath::kWinding_FillType);
1350     path.moveTo(0,1);
1351     path.cubicTo(0,5, 4,0, 5,0);
1352     path.close();
1353     pathB.setFillType(SkPath::kWinding_FillType);
1354     pathB.moveTo(0,4);
1355     pathB.cubicTo(0,5, 1,0, 5,0);
1356     pathB.close();
1357     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
1358 }
1359 
cubicOp71d(skiatest::Reporter * reporter,const char * filename)1360 static void cubicOp71d(skiatest::Reporter* reporter, const char* filename) {
1361     SkPath path, pathB;
1362     path.setFillType(SkPath::kWinding_FillType);
1363     path.moveTo(0,1);
1364     path.cubicTo(0,5, 4,1, 6,4);
1365     path.close();
1366     pathB.setFillType(SkPath::kWinding_FillType);
1367     pathB.moveTo(1,4);
1368     pathB.cubicTo(4,6, 1,0, 5,0);
1369     pathB.close();
1370     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
1371 }
1372 
cubicOp72i(skiatest::Reporter * reporter,const char * filename)1373 static void cubicOp72i(skiatest::Reporter* reporter, const char* filename) {
1374     SkPath path, pathB;
1375     path.setFillType(SkPath::kWinding_FillType);
1376     path.moveTo(0,1);
1377     path.cubicTo(0,5, 5,2, 5,4);
1378     path.close();
1379     pathB.setFillType(SkPath::kWinding_FillType);
1380     pathB.moveTo(2,5);
1381     pathB.cubicTo(4,5, 1,0, 5,0);
1382     pathB.close();
1383     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1384 }
1385 
cubicOp73d(skiatest::Reporter * reporter,const char * filename)1386 static void cubicOp73d(skiatest::Reporter* reporter, const char* filename) {
1387     SkPath path, pathB;
1388     path.setFillType(SkPath::kWinding_FillType);
1389     path.moveTo(0,1);
1390     path.cubicTo(3,4, 4,0, 6,4);
1391     path.lineTo(0,1);
1392     path.close();
1393     pathB.setFillType(SkPath::kWinding_FillType);
1394     pathB.moveTo(0,4);
1395     pathB.cubicTo(4,6, 1,0, 4,3);
1396     pathB.lineTo(0,4);
1397     pathB.close();
1398     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
1399 }
1400 
cubicOp74d(skiatest::Reporter * reporter,const char * filename)1401 static void cubicOp74d(skiatest::Reporter* reporter, const char* filename) {
1402     SkPath path, pathB;
1403     path.setFillType(SkPath::kWinding_FillType);
1404     path.moveTo(0,1);
1405     path.cubicTo(1,5, 5,1, 5,1);
1406     path.lineTo(0,1);
1407     path.close();
1408     pathB.setFillType(SkPath::kWinding_FillType);
1409     pathB.moveTo(1,5);
1410     pathB.cubicTo(1,5, 1,0, 5,1);
1411     pathB.lineTo(1,5);
1412     pathB.close();
1413     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
1414 }
1415 
cubicOp75d(skiatest::Reporter * reporter,const char * filename)1416 static void cubicOp75d(skiatest::Reporter* reporter, const char* filename) {
1417     SkPath path, pathB;
1418     path.setFillType(SkPath::kWinding_FillType);
1419     path.moveTo(0,1);
1420     path.cubicTo(0,4, 5,1, 6,4);
1421     path.lineTo(0,1);
1422     path.close();
1423     pathB.setFillType(SkPath::kWinding_FillType);
1424     pathB.moveTo(1,5);
1425     pathB.cubicTo(4,6, 1,0, 4,0);
1426     pathB.lineTo(1,5);
1427     pathB.close();
1428     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
1429 }
1430 
cubicOp76u(skiatest::Reporter * reporter,const char * filename)1431 static void cubicOp76u(skiatest::Reporter* reporter, const char* filename) {
1432     SkPath path, pathB;
1433     path.setFillType(SkPath::kWinding_FillType);
1434     path.moveTo(0,1);
1435     path.cubicTo(0,2, 2,0, 5,3);
1436     path.close();
1437     pathB.setFillType(SkPath::kWinding_FillType);
1438     pathB.moveTo(0,2);
1439     pathB.cubicTo(3,5, 1,0, 2,0);
1440     pathB.close();
1441     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
1442 }
1443 
cubicOp77i(skiatest::Reporter * reporter,const char * filename)1444 static void cubicOp77i(skiatest::Reporter* reporter, const char* filename) {
1445     SkPath path, pathB;
1446     path.setFillType(SkPath::kEvenOdd_FillType);
1447     path.moveTo(0,1);
1448     path.cubicTo(1,3, 2,0, 3,2);
1449     path.lineTo(0,1);
1450     path.close();
1451     pathB.setFillType(SkPath::kEvenOdd_FillType);
1452     pathB.moveTo(0,2);
1453     pathB.cubicTo(2,3, 1,0, 3,1);
1454     pathB.lineTo(0,2);
1455     pathB.close();
1456     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1457 }
1458 
cubicOp78u(skiatest::Reporter * reporter,const char * filename)1459 static void cubicOp78u(skiatest::Reporter* reporter, const char* filename) {
1460     SkPath path, pathB;
1461     path.setFillType(SkPath::kEvenOdd_FillType);
1462     path.moveTo(1,6);
1463     path.cubicTo(1,6, 5,0, 6,1);
1464     path.lineTo(1,6);
1465     path.close();
1466     pathB.setFillType(SkPath::kEvenOdd_FillType);
1467     pathB.moveTo(0,5);
1468     pathB.cubicTo(1,6, 6,1, 6,1);
1469     pathB.lineTo(0,5);
1470     pathB.close();
1471     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
1472 }
1473 
cubicOp79u(skiatest::Reporter * reporter,const char * filename)1474 static void cubicOp79u(skiatest::Reporter* reporter, const char* filename) {
1475     SkPath path, pathB;
1476     path.setFillType(SkPath::kWinding_FillType);
1477     path.moveTo(0,1);
1478     path.cubicTo(1,3, 1,0, 6,4);
1479     path.close();
1480     pathB.setFillType(SkPath::kWinding_FillType);
1481     pathB.moveTo(0,1);
1482     pathB.cubicTo(4,6, 1,0, 3,1);
1483     pathB.close();
1484     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1485 }
1486 
cubicOp80i(skiatest::Reporter * reporter,const char * filename)1487 static void cubicOp80i(skiatest::Reporter* reporter, const char* filename) {
1488     SkPath path, pathB;
1489     path.setFillType(SkPath::kWinding_FillType);
1490     path.moveTo(0,1);
1491     path.cubicTo(2,3, 2,1, 4,3);
1492     path.lineTo(0,1);
1493     path.close();
1494     pathB.setFillType(SkPath::kWinding_FillType);
1495     pathB.moveTo(1,2);
1496     pathB.cubicTo(3,4, 1,0, 3,2);
1497     pathB.lineTo(1,2);
1498     pathB.close();
1499     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1500 }
1501 
cubicOp81d(skiatest::Reporter * reporter,const char * filename)1502 static void cubicOp81d(skiatest::Reporter* reporter, const char* filename) {
1503     SkPath path, pathB;
1504     path.setFillType(SkPath::kWinding_FillType);
1505     path.moveTo(0,1);
1506     path.cubicTo(4,6, 4,3, 5,4);
1507     path.close();
1508     pathB.setFillType(SkPath::kWinding_FillType);
1509     pathB.moveTo(3,4);
1510     pathB.cubicTo(4,5, 1,0, 6,4);
1511     pathB.close();
1512     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
1513 }
1514 
cubicOp82i(skiatest::Reporter * reporter,const char * filename)1515 static void cubicOp82i(skiatest::Reporter* reporter, const char* filename) {
1516     SkPath path, pathB;
1517     path.setFillType(SkPath::kEvenOdd_FillType);
1518     path.moveTo(0,1);
1519     path.cubicTo(2,3, 5,2, 3,0);
1520     path.lineTo(0,1);
1521     path.close();
1522     pathB.setFillType(SkPath::kWinding_FillType);
1523     pathB.moveTo(2,5);
1524     pathB.cubicTo(0,3, 1,0, 3,2);
1525     pathB.lineTo(2,5);
1526     pathB.close();
1527     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1528 }
1529 
cubicOp83i(skiatest::Reporter * reporter,const char * filename)1530 static void cubicOp83i(skiatest::Reporter* reporter, const char* filename) {
1531     SkPath path, pathB;
1532     path.setFillType(SkPath::kWinding_FillType);
1533     path.moveTo(0,1);
1534     path.cubicTo(0,3, 2,1, 4,1);
1535     path.lineTo(0,1);
1536     path.close();
1537     pathB.setFillType(SkPath::kWinding_FillType);
1538     pathB.moveTo(1,2);
1539     pathB.cubicTo(1,4, 1,0, 3,0);
1540     pathB.lineTo(1,2);
1541     pathB.close();
1542     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1543 }
1544 
cubicOp84d(skiatest::Reporter * reporter,const char * filename)1545 static void cubicOp84d(skiatest::Reporter* reporter, const char* filename) {
1546     SkPath path, pathB;
1547     path.setFillType(SkPath::kWinding_FillType);
1548     path.moveTo(0,4);
1549     path.cubicTo(2,3, 6,3, 3,2);
1550     path.close();
1551     pathB.setFillType(SkPath::kWinding_FillType);
1552     pathB.moveTo(3,6);
1553     pathB.cubicTo(2,3, 4,0, 3,2);
1554     pathB.close();
1555     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
1556 }
1557 
skpClip1(skiatest::Reporter * reporter,const char * filename)1558 static void skpClip1(skiatest::Reporter* reporter, const char* filename) {
1559     SkPath path;
1560     path.setFillType(SkPath::kEvenOdd_FillType);
1561     path.moveTo(1126.17114f, 877.171204f);
1562     path.quadTo(1127.34314f, 876.000000f, 1129.00000f, 876.000000f);
1563     path.lineTo(1243.00000f, 876.000000f);
1564     path.quadTo(1244.65686f, 876.000000f, 1245.82886f, 877.171204f);
1565     path.quadTo(1247.00000f, 878.343140f, 1247.00000f, 880.000000f);
1566     path.lineTo(1247.00000f, 907.000000f);
1567     path.lineTo(1246.00000f, 907.000000f);
1568     path.lineTo(1246.00000f, 880.000000f);
1569     path.cubicTo(1246.00000f, 878.343140f, 1244.65686f, 877.000000f, 1243.00000f, 877.000000f);
1570     path.lineTo(1129.00000f, 877.000000f);
1571     path.cubicTo(1127.34314f, 877.000000f, 1126.00000f, 878.343140f, 1126.00000f, 880.000000f);
1572     path.lineTo(1126.00000f, 907.000000f);
1573     path.lineTo(1125.00000f, 907.000000f);
1574     path.lineTo(1125.00000f, 880.000000f);
1575     path.quadTo(1125.00000f, 878.343140f, 1126.17114f, 877.171204f);
1576     path.close();
1577     SkPath pathB;
1578     pathB.setFillType(SkPath::kWinding_FillType);
1579     pathB.moveTo(1247.00000f, 876.000000f);
1580     pathB.lineTo(1231.00000f, 892.000000f);
1581     pathB.lineTo(1246.00000f, 907.000000f);
1582     pathB.lineTo(1247.00000f, 907.000000f);
1583     pathB.lineTo(1247.00000f, 876.000000f);
1584     pathB.close();
1585     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1586 }
1587 
skpClip2(skiatest::Reporter * reporter,const char * filename)1588 static void skpClip2(skiatest::Reporter* reporter, const char* filename) {
1589     SkPath path;
1590     path.setFillType(SkPath::kEvenOdd_FillType);
1591     path.moveTo(134.000000f, 11414.0000f);
1592     path.cubicTo(131.990234f, 11414.0000f, 130.326660f, 11415.4824f, 130.042755f, 11417.4131f);
1593     path.cubicTo(130.233124f, 11418.3193f, 131.037079f, 11419.0000f, 132.000000f, 11419.0000f);
1594     path.lineTo(806.000000f, 11419.0000f);
1595     path.cubicTo(806.962891f, 11419.0000f, 807.766907f, 11418.3193f, 807.957275f, 11417.4131f);
1596     path.cubicTo(807.673401f, 11415.4824f, 806.009766f, 11414.0000f, 804.000000f, 11414.0000f);
1597     path.lineTo(134.000000f, 11414.0000f);
1598     path.close();
1599     SkPath pathB;
1600     pathB.setFillType(SkPath::kInverseWinding_FillType);
1601     pathB.moveTo(132.000000f, 11415.0000f);
1602     pathB.lineTo(806.000000f, 11415.0000f);
1603     pathB.cubicTo(807.104553f, 11415.0000f, 808.000000f, 11415.4473f, 808.000000f, 11416.0000f);
1604     pathB.lineTo(808.000000f, 11417.0000f);
1605     pathB.cubicTo(808.000000f, 11418.1045f, 807.104553f, 11419.0000f, 806.000000f, 11419.0000f);
1606     pathB.lineTo(132.000000f, 11419.0000f);
1607     pathB.cubicTo(130.895432f, 11419.0000f, 130.000000f, 11418.1045f, 130.000000f, 11417.0000f);
1608     pathB.lineTo(130.000000f, 11416.0000f);
1609     pathB.cubicTo(130.000000f, 11415.4473f, 130.895432f, 11415.0000f, 132.000000f, 11415.0000f);
1610     pathB.close();
1611     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1612 }
1613 
skp96prezzi1(skiatest::Reporter * reporter,const char * filename)1614 static void skp96prezzi1(skiatest::Reporter* reporter, const char* filename) {
1615     SkPath path;
1616     path.setFillType(SkPath::kEvenOdd_FillType);
1617     path.moveTo(157.464005f, 670.463989f);
1618     path.quadTo(158.928925f, 669.000000f, 161.000000f, 669.000000f);
1619     path.lineTo(248.000000f, 669.000000f);
1620     path.quadTo(250.071075f, 669.000000f, 251.535995f, 670.463989f);
1621     path.quadTo(253.000000f, 671.928955f, 253.000000f, 674.000000f);
1622     path.lineTo(253.000000f, 706.000000f);
1623     path.lineTo(251.000000f, 706.000000f);
1624     path.lineTo(251.000000f, 675.000000f);
1625     path.cubicTo(251.000000f, 672.790833f, 249.209137f, 671.000000f, 247.000000f, 671.000000f);
1626     path.lineTo(162.000000f, 671.000000f);
1627     path.cubicTo(159.790863f, 671.000000f, 158.000000f, 672.790833f, 158.000000f, 675.000000f);
1628     path.lineTo(158.000000f, 706.000000f);
1629     path.lineTo(156.000000f, 706.000000f);
1630     path.lineTo(156.000000f, 674.000000f);
1631     path.quadTo(156.000000f, 671.928955f, 157.464005f, 670.463989f);
1632     path.close();
1633     SkPath pathB;
1634     pathB.setFillType(SkPath::kWinding_FillType);
1635     pathB.moveTo(156.000000f, 669.000000f);
1636     pathB.lineTo(178.500000f, 691.500000f);
1637     pathB.lineTo(230.500000f, 691.500000f);
1638     pathB.lineTo(253.000000f, 669.000000f);
1639     pathB.lineTo(156.000000f, 669.000000f);
1640     pathB.close();
1641     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1642 }
1643 
skpancestry_com1(skiatest::Reporter * reporter,const char * filename)1644 static void skpancestry_com1(skiatest::Reporter* reporter, const char* filename) {
1645     SkPath path;
1646     path.setFillType(SkPath::kEvenOdd_FillType);
1647     path.moveTo(161.000000f, 925.000000f);
1648     path.cubicTo(159.874390f, 925.000000f, 158.835663f, 925.371948f, 158.000000f, 925.999634f);
1649     path.lineTo(158.000000f, 926.000000f);
1650     path.lineTo(1108.00000f, 926.000000f);
1651     path.lineTo(1108.00000f, 925.999634f);
1652     path.cubicTo(1107.16443f, 925.371948f, 1106.12561f, 925.000000f, 1105.00000f, 925.000000f);
1653     path.lineTo(161.000000f, 925.000000f);
1654     path.close();
1655     SkPath pathB;
1656     pathB.setFillType(SkPath::kEvenOdd_FillType);
1657     pathB.moveTo(161.000000f, 926.000000f);
1658     pathB.lineTo(1105.00000f, 926.000000f);
1659     pathB.cubicTo(1107.20911f, 926.000000f, 1109.00000f, 927.790833f, 1109.00000f, 930.000000f);
1660     pathB.lineTo(1109.00000f, 956.000000f);
1661     pathB.cubicTo(1109.00000f, 958.209167f, 1107.20911f, 960.000000f, 1105.00000f, 960.000000f);
1662     pathB.lineTo(161.000000f, 960.000000f);
1663     pathB.cubicTo(158.790863f, 960.000000f, 157.000000f, 958.209167f, 157.000000f, 956.000000f);
1664     pathB.lineTo(157.000000f, 930.000000f);
1665     pathB.cubicTo(157.000000f, 927.790833f, 158.790863f, 926.000000f, 161.000000f, 926.000000f);
1666     pathB.close();
1667     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1668 }
1669 
skpeldorado_com_ua1(skiatest::Reporter * reporter,const char * filename)1670 static void skpeldorado_com_ua1(skiatest::Reporter* reporter, const char* filename) {
1671     SkPath path;
1672     path.setFillType(SkPath::kEvenOdd_FillType);
1673     path.moveTo(286.695129f, 291.000000f);
1674     path.lineTo(229.304855f, 561.000000f);
1675     path.lineTo(979.304871f, 561.000000f);
1676     path.lineTo(1036.69507f, 291.000000f);
1677     path.lineTo(286.695129f, 291.000000f);
1678     path.close();
1679     SkPath pathB;
1680     pathB.setFillType(SkPath::kWinding_FillType);
1681     pathB.moveTo(1006.69513f, 291.000000f);
1682     pathB.cubicTo(1023.26367f, 291.000000f, 1033.84021f, 304.431458f, 1030.31836f, 321.000000f);
1683     pathB.lineTo(985.681519f, 531.000000f);
1684     pathB.cubicTo(982.159790f, 547.568542f, 965.873413f, 561.000000f, 949.304871f, 561.000000f);
1685     pathB.lineTo(259.304871f, 561.000000f);
1686     pathB.cubicTo(242.736313f, 561.000000f, 232.159805f, 547.568542f, 235.681549f, 531.000000f);
1687     pathB.lineTo(280.318420f, 321.000000f);
1688     pathB.cubicTo(283.840179f, 304.431458f, 300.126587f, 291.000000f, 316.695129f, 291.000000f);
1689     pathB.lineTo(1006.69513f, 291.000000f);
1690     pathB.close();
1691     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1692 }
1693 
skpbyte_com1(skiatest::Reporter * reporter,const char * filename)1694 static void skpbyte_com1(skiatest::Reporter* reporter, const char* filename) {
1695     SkPath path;
1696     path.setFillType(SkPath::kEvenOdd_FillType);
1697     path.moveTo(968.000000f, 14.0000000f);
1698     path.cubicTo(965.238586f, 14.0000000f, 963.000000f, 16.2385769f, 963.000000f, 19.0000000f);
1699     path.lineTo(963.000000f, 32.0000000f);
1700     path.cubicTo(963.000000f, 34.7614250f, 965.238586f, 37.0000000f, 968.000000f, 37.0000000f);
1701     path.lineTo(1034.00000f, 37.0000000f);
1702     path.cubicTo(1036.76147f, 37.0000000f, 1039.00000f, 34.7614250f, 1039.00000f, 32.0000000f);
1703     path.lineTo(1039.00000f, 19.0000000f);
1704     path.cubicTo(1039.00000f, 16.2385769f, 1036.76147f, 14.0000000f, 1034.00000f, 14.0000000f);
1705     path.lineTo(968.000000f, 14.0000000f);
1706     path.close();
1707     SkPath pathB;
1708     pathB.setFillType(SkPath::kInverseWinding_FillType);
1709     pathB.moveTo(968.000000f, 14.0000000f);
1710     pathB.lineTo(1034.00000f, 14.0000000f);
1711     pathB.cubicTo(1036.76147f, 14.0000000f, 1039.00000f, 16.2385750f, 1039.00000f, 19.0000000f);
1712     pathB.lineTo(1039.00000f, 32.0000000f);
1713     pathB.cubicTo(1039.00000f, 34.2091408f, 1036.76147f, 36.0000000f, 1034.00000f, 36.0000000f);
1714     pathB.lineTo(968.000000f, 36.0000000f);
1715     pathB.cubicTo(965.238586f, 36.0000000f, 963.000000f, 34.2091408f, 963.000000f, 32.0000000f);
1716     pathB.lineTo(963.000000f, 19.0000000f);
1717     pathB.cubicTo(963.000000f, 16.2385750f, 965.238586f, 14.0000000f, 968.000000f, 14.0000000f);
1718     pathB.close();
1719     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1720 }
1721 
skphealth_com76(skiatest::Reporter * reporter,const char * filename)1722 static void skphealth_com76(skiatest::Reporter* reporter, const char* filename) {
1723     SkPath path;
1724     path.setFillType(SkPath::kEvenOdd_FillType);
1725     path.moveTo(708.099182f, 7.09919119f);
1726     path.lineTo(708.099182f, 7.09920025f);
1727     path.quadTo(704.000000f, 11.2010098f, 704.000000f, 17.0000000f);
1728     path.lineTo(704.000000f, 33.0000000f);
1729     path.lineTo(705.000000f, 33.0000000f);
1730     path.lineTo(705.000000f, 17.0000000f);
1731     path.cubicTo(705.000000f, 13.4101496f, 706.455078f, 10.1601505f, 708.807617f, 7.80761385f);
1732     path.lineTo(708.099182f, 7.09919119f);
1733     path.close();
1734     SkPath pathB;
1735     pathB.setFillType(SkPath::kWinding_FillType);
1736     pathB.moveTo(704.000000f, 3.00000000f);
1737     pathB.lineTo(704.000000f, 33.0000000f);
1738     pathB.lineTo(705.000000f, 33.0000000f);
1739     pathB.lineTo(719.500000f, 3.00000000f);
1740     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1741 }
1742 
skpahrefs_com88(skiatest::Reporter * reporter,const char * filename)1743 static void skpahrefs_com88(skiatest::Reporter* reporter, const char* filename) {
1744     SkPath path;
1745     path.setFillType(SkPath::kEvenOdd_FillType);
1746     path.moveTo(1099.82886f, 7.17117119f);
1747     path.lineTo(1099.12134f, 7.87867832f);
1748     path.cubicTo(1099.66418f, 8.42157173f, 1100.00000f, 9.17157173f, 1100.00000f, 10.0000000f);
1749     path.lineTo(1100.00000f, 28.0000000f);
1750     path.cubicTo(1100.00000f, 29.6568546f, 1098.65686f, 31.0000000f, 1097.00000f, 31.0000000f);
1751     path.lineTo(1088.00000f, 31.0000000f);
1752     path.lineTo(1088.00000f, 32.0000000f);
1753     path.lineTo(1097.00000f, 32.0000000f);
1754     path.quadTo(1098.65686f, 32.0000000f, 1099.82886f, 30.8288002f);
1755     path.quadTo(1101.00000f, 29.6568546f, 1101.00000f, 28.0000000f);
1756     path.lineTo(1101.00000f, 10.0000000f);
1757     path.quadTo(1101.00000f, 8.34314537f, 1099.82886f, 7.17119980f);
1758     path.lineTo(1099.82886f, 7.17117119f);
1759     path.close();
1760     SkPath pathB;
1761     pathB.setFillType(SkPath::kWinding_FillType);
1762     pathB.moveTo(1101.00000f, 6.00000000f);
1763     pathB.lineTo(1088.00000f, 6.00000000f);
1764     pathB.lineTo(1088.00000f, 19.0000000f);
1765     pathB.lineTo(1101.00000f, 32.0000000f);
1766     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1767 }
1768 
skpahrefs_com29(skiatest::Reporter * reporter,const char * filename)1769 static void skpahrefs_com29(skiatest::Reporter* reporter, const char* filename) {
1770     SkPath path;
1771     path.setFillType(SkPath::kEvenOdd_FillType);
1772     path.moveTo(1037.17114f, 7.17119980f);
1773     path.quadTo(1038.34314f, 6.00000000f, 1040.00000f, 6.00000000f);
1774     path.lineTo(1074.00000f, 6.00000000f);
1775     path.lineTo(1074.00000f, 32.0000000f);
1776     path.lineTo(1040.00000f, 32.0000000f);
1777     path.quadTo(1038.34314f, 32.0000000f, 1037.17114f, 30.8288002f);
1778     path.quadTo(1036.00000f, 29.6568546f, 1036.00000f, 28.0000000f);
1779     path.lineTo(1036.00000f, 10.0000000f);
1780     path.quadTo(1036.00000f, 8.34314537f, 1037.17114f, 7.17119980f);
1781     path.close();
1782     path.moveTo(1037.00000f, 10.0000000f);
1783     path.cubicTo(1037.00000f, 8.34314537f, 1038.34314f, 7.00000000f, 1040.00000f, 7.00000000f);
1784     path.lineTo(1073.00000f, 7.00000000f);
1785     path.lineTo(1073.00000f, 31.0000000f);
1786     path.lineTo(1040.00000f, 31.0000000f);
1787     path.cubicTo(1038.34314f, 31.0000000f, 1037.00000f, 29.6568546f, 1037.00000f, 28.0000000f);
1788     path.lineTo(1037.00000f, 10.0000000f);
1789     path.close();
1790     SkPath pathB;
1791     pathB.setFillType(SkPath::kWinding_FillType);
1792     pathB.moveTo(1036.00000f, 32.0000000f);
1793     pathB.lineTo(1049.00000f, 19.0000000f);
1794     pathB.lineTo(1073.00000f, 31.0000000f);
1795     pathB.lineTo(1074.00000f, 32.0000000f);
1796     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1797 }
1798 
cubicOp85d(skiatest::Reporter * reporter,const char * filename)1799 static void cubicOp85d(skiatest::Reporter* reporter, const char* filename) {
1800     SkPath path;
1801     path.setFillType(SkPath::kWinding_FillType);
1802     path.moveTo(0,1);
1803     path.cubicTo(1,6, 1,0, 6,2);
1804     path.close();
1805     SkPath pathB;
1806     pathB.setFillType(SkPath::kWinding_FillType);
1807     pathB.moveTo(0,1);
1808     pathB.cubicTo(2,6, 1,0, 6,1);
1809     pathB.close();
1810     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
1811 }
1812 
skpkkiste_to98(skiatest::Reporter * reporter,const char * filename)1813 static void skpkkiste_to98(skiatest::Reporter* reporter, const char* filename) {
1814     SkPath path;
1815     path.setFillType(SkPath::kEvenOdd_FillType);
1816     path.moveTo(96, 122);
1817     path.cubicTo(94.6192932f, 122, 93.3692932f, 122.559647f, 92.4644699f, 123.46447f);
1818     path.lineTo(94.1715698f, 125.17157f);
1819     path.cubicTo(94.8954315f, 124.447708f, 95.8954315f, 124, 97, 124);
1820     path.lineTo(257, 124);
1821     path.cubicTo(258.104553f, 124, 259.104584f, 124.447708f, 259.82843f, 125.17157f);
1822     path.lineTo(261.535522f, 123.46447f);
1823     path.cubicTo(260.630707f, 122.559647f, 259.380707f, 122, 258, 122);
1824     path.lineTo(96, 122);
1825     path.close();
1826     SkPath pathB;
1827     pathB.setFillType(SkPath::kWinding_FillType);
1828     pathB.moveTo(258, 122);
1829     pathB.cubicTo(260.761414f, 122, 263, 124.238579f, 263, 127);
1830     pathB.lineTo(263, 284);
1831     pathB.cubicTo(263, 286.761414f, 260.761414f, 289, 258, 289);
1832     pathB.lineTo(96, 289);
1833     pathB.cubicTo(93.2385788f, 289, 91, 286.761414f, 91, 284);
1834     pathB.lineTo(91, 127);
1835     pathB.cubicTo(91, 124.238579f, 93.2385788f, 122, 96, 122);
1836     pathB.lineTo(258, 122);
1837     pathB.close();
1838     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1839 }
1840 
issue1417(skiatest::Reporter * reporter,const char * filename)1841 static void issue1417(skiatest::Reporter* reporter, const char* filename) {
1842     SkPath path1;
1843     path1.moveTo(122.58908843994140625f, 82.2836456298828125f);
1844     path1.quadTo(129.8215789794921875f, 80, 138, 80);
1845     path1.quadTo(147.15692138671875f, 80, 155.1280364990234375f, 82.86279296875f);
1846     path1.lineTo(161.1764678955078125f, 100);
1847     path1.lineTo(161.1764678955078125f, 100);
1848     path1.lineTo(115.29412078857421875f, 100);
1849     path1.lineTo(115.29412078857421875f, 100);
1850     path1.lineTo(122.58908843994140625f, 82.2836456298828125f);
1851     path1.lineTo(122.58908843994140625f, 82.2836456298828125f);
1852     path1.close();
1853     path1.moveTo(98.68194580078125f, 140.343841552734375f);
1854     path1.lineTo(115.29412078857421875f, 100);
1855     path1.lineTo(115.29412078857421875f, 100);
1856     path1.lineTo(97.9337615966796875f, 100);
1857     path1.lineTo(97.9337615966796875f, 100);
1858     path1.quadTo(88, 112.94264984130859375f, 88, 130);
1859     path1.quadTo(88, 131.544830322265625f, 88.08148956298828125f, 133.0560302734375f);
1860     path1.lineTo(98.68194580078125f, 140.343841552734375f);
1861     path1.lineTo(98.68194580078125f, 140.343841552734375f);
1862     path1.close();
1863     path1.moveTo(136.969696044921875f, 166.6666717529296875f);
1864     path1.lineTo(98.68194580078125f, 140.343841552734375f);
1865     path1.lineTo(98.68194580078125f, 140.343841552734375f);
1866     path1.lineTo(93.45894622802734375f, 153.02825927734375f);
1867     path1.lineTo(93.45894622802734375f, 153.02825927734375f);
1868     path1.quadTo(96.94116973876953125f, 159.65185546875f, 102.64466094970703125f, 165.3553466796875f);
1869     path1.quadTo(110.7924652099609375f, 173.503143310546875f, 120.8179779052734375f, 177.1177825927734375f);
1870     path1.lineTo(136.969696044921875f, 166.6666717529296875f);
1871     path1.lineTo(136.969696044921875f, 166.6666717529296875f);
1872     path1.close();
1873     path1.moveTo(175.8309783935546875f, 141.5211334228515625f);
1874     path1.lineTo(136.969696044921875f, 166.6666717529296875f);
1875     path1.lineTo(136.969696044921875f, 166.6666717529296875f);
1876     path1.lineTo(153.15728759765625f, 177.7956390380859375f);
1877     path1.lineTo(153.15728759765625f, 177.7956390380859375f);
1878     path1.quadTo(164.392425537109375f, 174.318267822265625f, 173.3553466796875f, 165.3553466796875f);
1879     path1.quadTo(177.805816650390625f, 160.9048614501953125f, 180.90380859375f, 155.8941650390625f);
1880     path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
1881     path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
1882     path1.close();
1883     path1.moveTo(175.8309783935546875f, 141.5211334228515625f);
1884     path1.lineTo(187.8782806396484375f, 133.7258148193359375f);
1885     path1.lineTo(187.8782806396484375f, 133.7258148193359375f);
1886     path1.quadTo(188, 131.8880615234375f, 188, 130);
1887     path1.quadTo(188, 112.942657470703125f, 178.0662384033203125f, 100);
1888     path1.lineTo(161.1764678955078125f, 100);
1889     path1.lineTo(161.1764678955078125f, 100);
1890     path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
1891     path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
1892     path1.close();
1893 
1894     SkPath path2;
1895     path2.moveTo(174.117645263671875f, 100);
1896     path2.lineTo(161.1764678955078125f, 100);
1897     path2.lineTo(161.1764678955078125f, 100);
1898     path2.lineTo(155.1280364990234375f, 82.86279296875f);
1899     path2.lineTo(155.1280364990234375f, 82.86279296875f);
1900     path2.quadTo(153.14971923828125f, 82.15229034423828125f, 151.098419189453125f, 81.618133544921875f);
1901     path2.lineTo(143.5294189453125f, 100);
1902     path2.lineTo(143.5294189453125f, 100);
1903     path2.lineTo(161.1764678955078125f, 100);
1904     path2.lineTo(161.1764678955078125f, 100);
1905     path2.lineTo(168.23529052734375f, 120);
1906     path2.lineTo(168.23529052734375f, 120);
1907     path2.lineTo(181.1764678955078125f, 120);
1908     path2.lineTo(181.1764678955078125f, 120);
1909     path2.lineTo(186.3661956787109375f, 134.7042236328125f);
1910     path2.lineTo(186.3661956787109375f, 134.7042236328125f);
1911     path2.lineTo(187.8782806396484375f, 133.7258148193359375f);
1912     path2.lineTo(187.8782806396484375f, 133.7258148193359375f);
1913     path2.quadTo(188, 131.8880615234375f, 188, 130);
1914     path2.quadTo(188, 124.80947113037109375f, 187.080169677734375f, 120);
1915     path2.lineTo(181.1764678955078125f, 120);
1916     path2.lineTo(181.1764678955078125f, 120);
1917     path2.lineTo(174.117645263671875f, 100);
1918     path2.lineTo(174.117645263671875f, 100);
1919     path2.close();
1920     path2.moveTo(88.91983795166015625f, 120);
1921     path2.lineTo(107.0588226318359375f, 120);
1922     path2.lineTo(107.0588226318359375f, 120);
1923     path2.lineTo(98.68194580078125f, 140.343841552734375f);
1924     path2.lineTo(98.68194580078125f, 140.343841552734375f);
1925     path2.lineTo(88.08148956298828125f, 133.0560302734375f);
1926     path2.lineTo(88.08148956298828125f, 133.0560302734375f);
1927     path2.quadTo(88, 131.544830322265625f, 88, 130);
1928     path2.quadTo(88, 124.80951690673828125f, 88.91983795166015625f, 120);
1929     path2.close();
1930     path2.moveTo(96.67621612548828125f, 145.21490478515625f);
1931     path2.lineTo(98.68194580078125f, 140.343841552734375f);
1932     path2.lineTo(98.68194580078125f, 140.343841552734375f);
1933     path2.lineTo(120.68767547607421875f, 155.4727783203125f);
1934     path2.lineTo(120.68767547607421875f, 155.4727783203125f);
1935     path2.lineTo(118.68194580078125f, 160.343841552734375f);
1936     path2.lineTo(118.68194580078125f, 160.343841552734375f);
1937     path2.lineTo(96.67621612548828125f, 145.21490478515625f);
1938     path2.lineTo(96.67621612548828125f, 145.21490478515625f);
1939     path2.close();
1940     path2.moveTo(113.232177734375f, 173.5789947509765625f);
1941     path2.quadTo(116.8802642822265625f, 175.69805908203125f, 120.8179779052734375f, 177.1177825927734375f);
1942     path2.lineTo(132.2864990234375f, 169.6969757080078125f);
1943     path2.lineTo(132.2864990234375f, 169.6969757080078125f);
1944     path2.lineTo(118.68194580078125f, 160.343841552734375f);
1945     path2.lineTo(118.68194580078125f, 160.343841552734375f);
1946     path2.lineTo(113.232177734375f, 173.5789947509765625f);
1947     path2.lineTo(113.232177734375f, 173.5789947509765625f);
1948     path2.close();
1949     // FIXME : difficult data, circle back later
1950     testPathOp(reporter, path1, path2, kUnion_SkPathOp, filename);
1951 }
1952 
issue1418(skiatest::Reporter * reporter,const char * filename)1953 static void issue1418(skiatest::Reporter* reporter, const char* filename) {
1954     SkPath path1;
1955     path1.moveTo(0, 0);
1956     path1.lineTo(1, 0);
1957     path1.lineTo(1, 0);
1958     path1.lineTo(1, 1);
1959     path1.lineTo(1, 1);
1960     path1.lineTo(0, 1);
1961     path1.lineTo(0, 1);
1962     path1.lineTo(0, 0);
1963     path1.lineTo(0, 0);
1964     path1.close();
1965 
1966     SkPath path2;
1967     path2.moveTo(0.64644664525985717773f, -0.35355341434478759766f);
1968     path2.quadTo(0.79289329051971435547f, -0.50000005960464477539f, 1.0000001192092895508f, -0.50000005960464477539f);
1969     path2.quadTo(1.2071068286895751953f, -0.50000005960464477539f, 1.3535535335540771484f, -0.35355341434478759766f);
1970     path2.quadTo(1.5000001192092895508f, -0.20710679888725280762f, 1.5000001192092895508f, 0);
1971     path2.quadTo(1.5000001192092895508f, 0.20710679888725280762f, 1.3535535335540771484f, 0.35355341434478759766f);
1972     path2.quadTo(1.2071068286895751953f, 0.50000005960464477539f, 1.0000001192092895508f, 0.50000005960464477539f);
1973     path2.quadTo(0.79289329051971435547f, 0.50000005960464477539f, 0.64644664525985717773f, 0.35355341434478759766f);
1974     path2.quadTo(0.50000005960464477539f, 0.20710679888725280762f, 0.50000005960464477539f, 0);
1975     path2.quadTo(0.50000005960464477539f, -0.20710679888725280762f, 0.64644664525985717773f, -0.35355341434478759766f);
1976     testPathOp(reporter, path1, path2, kIntersect_SkPathOp, filename);
1977 }
1978 
cubicOp85i(skiatest::Reporter * reporter,const char * filename)1979 static void cubicOp85i(skiatest::Reporter* reporter, const char* filename) {
1980     SkPath path, pathB;
1981     path.setFillType(SkPath::kWinding_FillType);
1982     path.moveTo(3, 4);
1983     path.cubicTo(1, 5, 4, 3, 6, 4);
1984     path.close();
1985     pathB.setFillType(SkPath::kWinding_FillType);
1986     pathB.moveTo(3, 4);
1987     pathB.cubicTo(4, 6, 4, 3, 5, 1);
1988     pathB.close();
1989     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
1990 }
1991 
issue1418b(skiatest::Reporter * reporter,const char * filename)1992 static void issue1418b(skiatest::Reporter* reporter, const char* filename) {
1993     SkPath path1;
1994     path1.moveTo(0, 0);
1995     path1.lineTo(1, 0);
1996     path1.lineTo(1, 1);
1997     path1.lineTo(0, 1);
1998     path1.lineTo(0, 0);
1999     path1.close();
2000     path1.setFillType(SkPath::kWinding_FillType);
2001     SkPath path2;
2002     path2.moveTo(0.646446645f, -0.353553414f);
2003     path2.quadTo(0.792893291f, -0.50000006f, 1.00000012f, -0.50000006f);
2004     path2.quadTo(1.20710683f, -0.50000006f, 1.35355353f, -0.353553414f);
2005     path2.quadTo(1.50000012f, -0.207106799f, 1.50000012f, 0);
2006     path2.quadTo(1.50000012f, 0.207106799f, 1.35355353f, 0.353553414f);
2007     path2.quadTo(1.20710683f, 0.50000006f, 1.00000012f, 0.50000006f);
2008     path2.quadTo(0.792893291f, 0.50000006f, 0.646446645f, 0.353553414f);
2009     path2.quadTo(0.50000006f, 0.207106799f, 0.50000006f, 0);
2010     path2.quadTo(0.50000006f, -0.207106799f, 0.646446645f, -0.353553414f);
2011     path2.close();
2012     path2.moveTo(1.00000012f, 0.50000006f);
2013     path2.lineTo(1.00000012f, 1.00000012f);
2014     path2.lineTo(0.50000006f, 1.00000012f);
2015     path2.quadTo(0.50000006f, 0.792893291f, 0.646446645f, 0.646446645f);
2016     path2.quadTo(0.792893291f, 0.50000006f, 1.00000012f, 0.50000006f);
2017     path2.close();
2018     path2.setFillType(SkPath::kEvenOdd_FillType);
2019     testPathOp(reporter, path1, path2, kIntersect_SkPathOp, filename);
2020 }
2021 
rectOp1i(skiatest::Reporter * reporter,const char * filename)2022 static void rectOp1i(skiatest::Reporter* reporter, const char* filename) {
2023     SkPath path, pathB;
2024     path.setFillType(SkPath::kWinding_FillType);
2025     path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
2026     path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
2027     pathB.setFillType(SkPath::kWinding_FillType);
2028     pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
2029     pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
2030     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2031 }
2032 
rectOp2i(skiatest::Reporter * reporter,const char * filename)2033 static void rectOp2i(skiatest::Reporter* reporter, const char* filename) {
2034     SkPath path, pathB;
2035     path.setFillType(SkPath::kEvenOdd_FillType);
2036     path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
2037     path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
2038     pathB.setFillType(SkPath::kWinding_FillType);
2039     pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
2040     pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
2041     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2042 }
2043 
rectOp3x(skiatest::Reporter * reporter,const char * filename)2044 static void rectOp3x(skiatest::Reporter* reporter, const char* filename) {
2045     SkPath path, pathB;
2046     path.setFillType(SkPath::kEvenOdd_FillType);
2047     path.moveTo(0, 0);
2048     path.lineTo(3, 0);
2049     path.lineTo(3, 3);
2050     path.lineTo(0, 3);
2051     path.close();
2052     path.moveTo(2, 2);
2053     path.lineTo(3, 2);
2054     path.lineTo(3, 3);
2055     path.lineTo(2, 3);
2056     path.close();
2057     pathB.setFillType(SkPath::kWinding_FillType);
2058     pathB.moveTo(1, 1);
2059     pathB.lineTo(3, 1);
2060     pathB.lineTo(3, 3);
2061     pathB.lineTo(1, 3);
2062     pathB.close();
2063     pathB.moveTo(2, 2);
2064     pathB.lineTo(3, 2);
2065     pathB.lineTo(3, 3);
2066     pathB.lineTo(2, 3);
2067     pathB.close();
2068     testPathOp(reporter, path, pathB, kXOR_SkPathOp, filename);
2069 }
2070 
issue1435(skiatest::Reporter * reporter,const char * filename)2071 static void issue1435(skiatest::Reporter* reporter, const char* filename) {
2072     SkPath path1;
2073     path1.moveTo(160, 60);
2074     path1.lineTo(220, 230);
2075     path1.lineTo(60, 120);
2076     path1.lineTo(260, 120);
2077     path1.lineTo(90, 230);
2078     path1.lineTo(160, 60);
2079     path1.close();
2080     path1.setFillType(SkPath::kEvenOdd_FillType);
2081 
2082     SkPath path2;
2083     path2.moveTo(142.589081f, 102.283646f);
2084     path2.quadTo(149.821579f, 100, 158, 100);
2085     path2.quadTo(167.156921f, 100, 175.128036f, 102.862793f);
2086     path2.lineTo(181.176468f, 120);
2087     path2.lineTo(135.294128f, 120);
2088     path2.lineTo(142.589081f, 102.283646f);
2089     path2.close();
2090     path2.moveTo(118.681946f, 160.343842f);
2091     path2.lineTo(135.294128f, 120);
2092     path2.lineTo(117.933762f, 120);
2093     path2.quadTo(108, 132.942657f, 108, 150);
2094     path2.quadTo(108, 151.54483f, 108.08149f, 153.05603f);
2095     path2.lineTo(118.681946f, 160.343842f);
2096     path2.close();
2097     path2.moveTo(156.969696f, 186.666672f);
2098     path2.lineTo(118.681946f, 160.343842f);
2099     path2.lineTo(113.458946f, 173.028259f);
2100     path2.quadTo(116.94117f, 179.651855f, 122.644661f, 185.355347f);
2101     path2.quadTo(130.792465f, 193.503143f, 140.817978f, 197.117783f);
2102     path2.lineTo(156.969696f, 186.666672f);
2103     path2.close();
2104     path2.moveTo(195.830978f, 161.521133f);
2105     path2.lineTo(156.969696f, 186.666672f);
2106     path2.lineTo(173.157288f, 197.795639f);
2107     path2.quadTo(184.392426f, 194.318268f, 193.355347f, 185.355347f);
2108     path2.quadTo(197.805817f, 180.904861f, 200.903809f, 175.894165f);
2109     path2.lineTo(195.830978f, 161.521133f);
2110     path2.close();
2111     path2.moveTo(195.830978f, 161.521133f);
2112     path2.lineTo(207.878281f, 153.725815f);
2113     path2.quadTo(208, 151.888062f, 208, 150);
2114     path2.quadTo(208, 132.942657f, 198.066238f, 120);
2115     path2.lineTo(181.176468f, 120);
2116     path2.lineTo(195.830978f, 161.521133f);
2117     path2.close();
2118     path2.setFillType(SkPath::kEvenOdd_FillType);
2119     testPathOp(reporter, path1, path2, kIntersect_SkPathOp, filename);
2120 }
2121 
skpkkiste_to716(skiatest::Reporter * reporter,const char * filename)2122 static void skpkkiste_to716(skiatest::Reporter* reporter, const char* filename) {
2123     SkPath path;
2124     path.setFillType(SkPath::kEvenOdd_FillType);
2125     path.moveTo(1173, 284);
2126     path.cubicTo(1173, 285.125824f, 1173.37207f, 286.164734f, 1174, 287.000488f);
2127     path.lineTo(1174, 123.999496f);
2128     path.cubicTo(1173.37207f, 124.835243f, 1173, 125.874168f, 1173, 127);
2129     path.lineTo(1173, 284);
2130     path.close();
2131     SkPath pathB;
2132     pathB.setFillType(SkPath::kWinding_FillType);
2133     pathB.moveTo(1340, 122);
2134     pathB.cubicTo(1342.76147f, 122, 1345, 124.238579f, 1345, 127);
2135     pathB.lineTo(1345, 284);
2136     pathB.cubicTo(1345, 286.761414f, 1342.76147f, 289, 1340, 289);
2137     pathB.lineTo(1178, 289);
2138     pathB.cubicTo(1175.23853f, 289, 1173, 286.761414f, 1173, 284);
2139     pathB.lineTo(1173, 127);
2140     pathB.cubicTo(1173, 124.238579f, 1175.23853f, 122, 1178, 122);
2141     pathB.lineTo(1340, 122);
2142     pathB.close();
2143     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2144 }
2145 
loopEdge1(skiatest::Reporter * reporter,const char * filename)2146 static void loopEdge1(skiatest::Reporter* reporter, const char* filename) {
2147     SkPath path;
2148     path.setFillType(SkPath::kEvenOdd_FillType);
2149     path.moveTo(0,0);
2150     path.lineTo(3,0);
2151     path.lineTo(3,2);
2152     path.lineTo(1,2);
2153     path.lineTo(1,1);
2154     path.lineTo(2,1);
2155     path.lineTo(2,3);
2156     path.lineTo(0,3);
2157     path.close();
2158     SkPath pathB;
2159     pathB.setFillType(SkPath::kEvenOdd_FillType);
2160     pathB.moveTo(1,2);
2161     pathB.lineTo(2,2);
2162     pathB.lineTo(2,4);
2163     pathB.lineTo(1,4);
2164     pathB.close();
2165     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2166 }
2167 
loopEdge2(skiatest::Reporter * reporter,const char * filename)2168 static void loopEdge2(skiatest::Reporter* reporter, const char* filename) {
2169     SkPath path;
2170     path.setFillType(SkPath::kEvenOdd_FillType);
2171     path.moveTo(0,0);
2172     path.lineTo(3,0);
2173     path.lineTo(3,2);
2174     path.lineTo(1,2);
2175     path.lineTo(1,1);
2176     path.lineTo(2,1);
2177     path.lineTo(2,3);
2178     path.lineTo(0,3);
2179     path.close();
2180     SkPath pathB;
2181     pathB.setFillType(SkPath::kEvenOdd_FillType);
2182     pathB.moveTo(1 - 1e-6f,2);
2183     pathB.lineTo(2 - 1e-6f,2);
2184     pathB.lineTo(2 - 1e-6f,4);
2185     pathB.lineTo(1 - 1e-6f,4);
2186     pathB.close();
2187     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2188 }
2189 
cubicOp86i(skiatest::Reporter * reporter,const char * filename)2190 static void cubicOp86i(skiatest::Reporter* reporter, const char* filename) {
2191     SkPath path, pathB;
2192     path.setFillType(SkPath::kWinding_FillType);
2193     path.moveTo(0, 4);
2194     path.cubicTo(3, 4, 6, 2, 5, 2);
2195     path.close();
2196     pathB.setFillType(SkPath::kEvenOdd_FillType);
2197     pathB.moveTo(2, 6);
2198     pathB.cubicTo(2, 5, 4, 0, 4, 3);
2199     pathB.close();
2200     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2201 }
2202 
cubicOp87u(skiatest::Reporter * reporter,const char * filename)2203 static void cubicOp87u(skiatest::Reporter* reporter, const char* filename) {
2204     SkPath path, pathB;
2205     path.setFillType(SkPath::kWinding_FillType);
2206     path.moveTo(0,1);
2207     path.cubicTo(0,2, 2,0, 6,4);
2208     path.close();
2209     pathB.setFillType(SkPath::kWinding_FillType);
2210     pathB.moveTo(0,2);
2211     pathB.cubicTo(4,6, 1,0, 2,0);
2212     pathB.close();
2213     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
2214 }
2215 
cubicOp88u(skiatest::Reporter * reporter,const char * filename)2216 static void cubicOp88u(skiatest::Reporter* reporter, const char* filename) {
2217     SkPath path, pathB;
2218     path.setFillType(SkPath::kWinding_FillType);
2219     path.moveTo(0,1);
2220     path.cubicTo(2,5, 5,0, 6,4);
2221     path.close();
2222     pathB.setFillType(SkPath::kWinding_FillType);
2223     pathB.moveTo(0,5);
2224     pathB.cubicTo(4,6, 1,0, 5,2);
2225     pathB.close();
2226     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
2227 }
2228 
cubicOp89u(skiatest::Reporter * reporter,const char * filename)2229 static void cubicOp89u(skiatest::Reporter* reporter, const char* filename) {
2230     SkPath path, pathB;
2231     path.setFillType(SkPath::kWinding_FillType);
2232     path.moveTo(0, 3);
2233     path.cubicTo(1, 6, 5, 0, 6, 3);
2234     path.close();
2235     pathB.setFillType(SkPath::kWinding_FillType);
2236     pathB.moveTo(0, 5);
2237     pathB.cubicTo(3, 6, 3, 0, 6, 1);
2238     pathB.close();
2239     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
2240 }
2241 
cubicOp90u(skiatest::Reporter * reporter,const char * filename)2242 static void cubicOp90u(skiatest::Reporter* reporter, const char* filename) {
2243     SkPath path, pathB;
2244     path.setFillType(SkPath::kEvenOdd_FillType);
2245     path.moveTo(0, 5);
2246     path.cubicTo(1, 2, 5, 2, 4, 1);
2247     path.close();
2248     pathB.setFillType(SkPath::kEvenOdd_FillType);
2249     pathB.moveTo(2, 5);
2250     pathB.cubicTo(1, 4, 5, 0, 2, 1);
2251     pathB.close();
2252     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
2253 }
2254 
cubicOp91u(skiatest::Reporter * reporter,const char * filename)2255 static void cubicOp91u(skiatest::Reporter* reporter, const char* filename) {
2256     SkPath path, pathB;
2257     path.setFillType(SkPath::kWinding_FillType);
2258     path.moveTo(1, 6);
2259     path.cubicTo(0, 3, 6, 3, 5, 0);
2260     path.close();
2261     pathB.setFillType(SkPath::kWinding_FillType);
2262     pathB.moveTo(3, 6);
2263     pathB.cubicTo(0, 5, 6, 1, 3, 0);
2264     pathB.close();
2265     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
2266 }
2267 
skpaaalgarve_org53(skiatest::Reporter * reporter,const char * filename)2268 static void skpaaalgarve_org53(skiatest::Reporter* reporter, const char* filename) {
2269     SkPath path;
2270     path.setFillType(SkPath::kEvenOdd_FillType);
2271    path.moveTo(-1.24344979e-014f, 348);
2272     path.lineTo(258, 348);
2273     path.lineTo(258, 322);
2274     path.quadTo(258, 317.857849f, 255.072006f, 314.928009f);
2275     path.quadTo(252.142136f, 312, 248, 312);
2276     path.lineTo(1.77635684e-015f, 312);
2277     path.lineTo(-1.24344979e-014f, 348);
2278     path.close();
2279     SkPath pathB;
2280     pathB.setFillType(SkPath::kWinding_FillType);
2281    pathB.moveTo(0, 312);
2282     pathB.lineTo(258, 312);
2283     pathB.lineTo(258, 348);
2284     pathB.lineTo(0, 348);
2285     pathB.close();
2286     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2287 }
2288 
skpabcspark_ca103(skiatest::Reporter * reporter,const char * filename)2289 static void skpabcspark_ca103(skiatest::Reporter* reporter, const char* filename) {
2290     SkPath path;
2291     path.setFillType(SkPath::kEvenOdd_FillType);
2292     path.moveTo(1.99840144e-015f, 494);
2293     path.lineTo(97, 494);
2294     path.quadTo(100.313705f, 494, 102.6576f, 491.657593f);
2295     path.quadTo(105, 489.313721f, 105, 486);
2296     path.lineTo(105, 425);
2297     path.quadTo(105, 421.686279f, 102.6576f, 419.342407f);
2298     path.quadTo(100.313705f, 417, 97, 417);
2299     path.lineTo(2.22044605e-016f, 417);
2300     path.lineTo(1.99840144e-015f, 494);
2301     path.close();
2302     SkPath pathB;
2303     pathB.setFillType(SkPath::kWinding_FillType);
2304     pathB.moveTo(0, 417);
2305     pathB.lineTo(105, 417);
2306     pathB.lineTo(105, 494);
2307     pathB.lineTo(0, 494);
2308     pathB.close();
2309     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2310 }
2311 
skpacesoftech_com47(skiatest::Reporter * reporter,const char * filename)2312 static void skpacesoftech_com47(skiatest::Reporter* reporter, const char* filename) {
2313     SkPath path;
2314     path.setFillType(SkPath::kEvenOdd_FillType);
2315     path.moveTo(670.537415f, 285);
2316     path.lineTo(670.387451f, 285);
2317     path.lineTo(596.315186f, 314.850708f);
2318     path.lineTo(626.19696f, 389);
2319     path.lineTo(626.346863f, 389);
2320     path.lineTo(700.419189f, 359.149261f);
2321     path.lineTo(670.537415f, 285);
2322     path.close();
2323     SkPath pathB;
2324     pathB.setFillType(SkPath::kWinding_FillType);
2325     pathB.moveTo(663.318542f, 374.100616f);
2326     pathB.quadTo(647.950989f, 380.293671f, 632.705322f, 373.806305f);
2327     pathB.quadTo(617.459595f, 367.318909f, 611.266541f, 351.951355f);
2328     pathB.quadTo(605.073486f, 336.58374f, 611.560913f, 321.338074f);
2329     pathB.quadTo(618.048279f, 306.092407f, 633.415833f, 299.899353f);
2330     pathB.quadTo(648.783447f, 293.706299f, 664.029114f, 300.193665f);
2331     pathB.quadTo(679.27478f, 306.68103f, 685.467834f, 322.048645f);
2332     pathB.quadTo(691.660889f, 337.416199f, 685.173523f, 352.661896f);
2333     pathB.quadTo(678.686157f, 367.907562f, 663.318542f, 374.100616f);
2334     pathB.close();
2335     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2336 }
2337 
skpact_com43(skiatest::Reporter * reporter,const char * filename)2338 static void skpact_com43(skiatest::Reporter* reporter, const char* filename) {
2339     SkPath path;
2340     path.setFillType(SkPath::kEvenOdd_FillType);
2341     path.moveTo(1.45716772e-016f, 924.336121f);
2342     path.lineTo(-1.11022302e-016f, 920);
2343     path.lineTo(6, 920);
2344     path.lineTo(6, 926);
2345     path.lineTo(1.66389287f, 926);
2346     path.quadTo(1.18842196f, 925.674561f, 0.756800175f, 925.243225f);
2347     path.quadTo(0.325406998f, 924.811523f, 1.45716772e-016f, 924.336121f);
2348     path.close();
2349     path.moveTo(1, 921);
2350     path.lineTo(5, 921);
2351     path.lineTo(5, 925);
2352     path.cubicTo(2.79086018f, 925, 1, 923.209167f, 1, 921);
2353     path.close();
2354     SkPath pathB;
2355     pathB.setFillType(SkPath::kWinding_FillType);
2356     pathB.moveTo(-1, 920);
2357     pathB.lineTo(0, 920);
2358     pathB.lineTo(3, 927);
2359     pathB.lineTo(-1, 927);
2360     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2361 }
2362 
skpadbox_lt8(skiatest::Reporter * reporter,const char * filename)2363 static void skpadbox_lt8(skiatest::Reporter* reporter, const char* filename) {
2364     SkPath path;
2365     path.setFillType(SkPath::kEvenOdd_FillType);
2366     path.moveTo(320.097229f, 628.573669f);
2367     path.lineTo(610.227173f, 85.7786865f);
2368     path.lineTo(946.652588f, 265.601807f);
2369     path.lineTo(656.522644f, 808.39679f);
2370     path.lineTo(320.097229f, 628.573669f);
2371     path.close();
2372     SkPath pathB;
2373     pathB.setFillType(SkPath::kInverseWinding_FillType);
2374     pathB.moveTo(333.866608f, 623.496155f);
2375     pathB.lineTo(613.368042f, 100.585754f);
2376     pathB.cubicTo(613.685303f, 99.9921265f, 614.423767f, 99.7681885f, 615.017395f, 100.085449f);
2377     pathB.lineTo(932.633057f, 269.854553f);
2378     pathB.cubicTo(933.226685f, 270.171875f, 933.450623f, 270.910278f, 933.133301f, 271.503906f);
2379     pathB.lineTo(653.631897f, 794.414307f);
2380     pathB.cubicTo(653.314636f, 795.007935f, 652.576172f, 795.231934f, 651.982544f, 794.914612f);
2381     pathB.lineTo(334.366943f, 625.145508f);
2382     pathB.cubicTo(333.773315f, 624.828247f, 333.549286f, 624.089783f, 333.866608f, 623.496155f);
2383     pathB.close();
2384     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2385 }
2386 
skpadindex_de4(skiatest::Reporter * reporter,const char * filename)2387 static void skpadindex_de4(skiatest::Reporter* reporter, const char* filename) {
2388     SkPath path;
2389     path.setFillType(SkPath::kEvenOdd_FillType);
2390     path.moveTo(0, 926);
2391     path.lineTo(0, 0);
2392     path.lineTo(1280, 0);
2393     path.lineTo(1280, 926);
2394     path.lineTo(0, 926);
2395     path.close();
2396     SkPath pathB;
2397     pathB.setFillType(SkPath::kWinding_FillType);
2398     pathB.moveTo(0, 312);
2399     pathB.lineTo(8.20486257e-015f, 178);
2400     pathB.lineTo(49, 178);
2401     pathB.lineTo(49, 312);
2402     pathB.close();
2403     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2404 }
2405 
skpadithya_putr4_blogspot_com551(skiatest::Reporter * reporter,const char * filename)2406 static void skpadithya_putr4_blogspot_com551(skiatest::Reporter* reporter, const char* filename) {
2407     SkPath path;
2408     path.setFillType(SkPath::kEvenOdd_FillType);
2409     path.moveTo(205.605804f, 142.334625f);
2410     path.lineTo(254.665359f, 85.6058044f);
2411     path.lineTo(311.394196f, 134.665359f);
2412     path.lineTo(262.334625f, 191.39418f);
2413     path.lineTo(205.605804f, 142.334625f);
2414     path.close();
2415     SkPath pathB;
2416     pathB.setFillType(SkPath::kWinding_FillType);
2417     pathB.moveTo(283.407959f, 110.462646f);
2418     pathB.cubicTo(298.864319f, 123.829437f, 300.558258f, 147.195221f, 287.191467f, 162.651581f);
2419     pathB.lineTo(286.537354f, 163.407959f);
2420     pathB.cubicTo(273.170563f, 178.864334f, 249.804779f, 180.558258f, 234.348419f, 167.191467f);
2421     pathB.lineTo(233.592026f, 166.537338f);
2422     pathB.cubicTo(218.135666f, 153.170547f, 216.441727f, 129.804779f, 229.808517f, 114.348412f);
2423     pathB.lineTo(230.462646f, 113.592026f);
2424     pathB.cubicTo(243.829437f, 98.1356659f, 267.195221f, 96.4417267f, 282.651581f, 109.808517f);
2425     pathB.lineTo(283.407959f, 110.462646f);
2426     pathB.close();
2427     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2428 }
2429 
skpadspert_de11(skiatest::Reporter * reporter,const char * filename)2430 static void skpadspert_de11(skiatest::Reporter* reporter, const char* filename) {
2431     SkPath path;
2432     path.setFillType(SkPath::kEvenOdd_FillType);
2433     path.moveTo(-4.4408921e-016f, 682.5f);
2434     path.lineTo(30.5f, 682.5f);
2435     path.cubicTo(32.709137f, 682.5f, 34.5f, 680.709167f, 34.5f, 678.5f);
2436     path.lineTo(34.5f, 486.5f);
2437     path.cubicTo(34.5f, 484.290863f, 32.709137f, 482.5f, 30.5f, 482.5f);
2438     path.lineTo(0, 482.5f);
2439     path.lineTo(-4.4408921e-016f, 682.5f);
2440     path.close();
2441     SkPath pathB;
2442     pathB.setFillType(SkPath::kWinding_FillType);
2443     pathB.moveTo(0, 482);
2444     pathB.lineTo(35, 482);
2445     pathB.lineTo(35, 683);
2446     pathB.lineTo(0, 683);
2447     pathB.close();
2448     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2449 }
2450 
skpaiaigames_com870(skiatest::Reporter * reporter,const char * filename)2451 static void skpaiaigames_com870(skiatest::Reporter* reporter, const char* filename) {
2452     SkPath path;
2453     path.setFillType(SkPath::kEvenOdd_FillType);
2454     path.moveTo(324.071075f, 845.071045f);
2455     path.cubicTo(324.405151f, 844.737f, 324.715668f, 844.379395f, 325, 844.000977f);
2456     path.lineTo(325, 842.127197f);
2457     path.cubicTo(324.571411f, 842.956238f, 324.017761f, 843.710144f, 323.363953f, 844.363953f);
2458     path.lineTo(324.071075f, 845.071045f);
2459     path.close();
2460     path.moveTo(323.363953f, 714.636047f);
2461     path.lineTo(324.071075f, 713.928955f);
2462     path.cubicTo(324.405151f, 714.263f, 324.715668f, 714.620605f, 325, 714.999023f);
2463     path.lineTo(325, 716.872803f);
2464     path.cubicTo(324.571411f, 716.043762f, 324.017761f, 715.289856f, 323.363953f, 714.636047f);
2465     path.close();
2466     SkPath pathB;
2467     pathB.setFillType(SkPath::kWinding_FillType);
2468     pathB.moveTo(317, 711);
2469     pathB.cubicTo(322.522858f, 711, 327, 715.477173f, 327, 721);
2470     pathB.lineTo(327, 838);
2471     pathB.cubicTo(327, 843.522827f, 322.522858f, 848, 317, 848);
2472     pathB.lineTo(155, 848);
2473     pathB.cubicTo(149.477158f, 848, 145, 843.522827f, 145, 838);
2474     pathB.lineTo(145, 721);
2475     pathB.cubicTo(145, 715.477173f, 149.477158f, 711, 155, 711);
2476     pathB.lineTo(317, 711);
2477     pathB.close();
2478     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2479 }
2480 
cubicOp92i(skiatest::Reporter * reporter,const char * filename)2481 static void cubicOp92i(skiatest::Reporter* reporter, const char* filename) {
2482     SkPath path, pathB;
2483     path.setFillType(SkPath::kWinding_FillType);
2484     path.moveTo(0, 1);
2485     path.cubicTo(2, 6, 4, 1, 5, 4);
2486     path.close();
2487     pathB.setFillType(SkPath::kWinding_FillType);
2488     pathB.moveTo(1, 4);
2489     pathB.cubicTo(4, 5, 1, 0, 6, 2);
2490     pathB.close();
2491     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2492 }
2493 
cubicOp93d(skiatest::Reporter * reporter,const char * filename)2494 static void cubicOp93d(skiatest::Reporter* reporter, const char* filename) {
2495     SkPath path, pathB;
2496     path.setFillType(SkPath::kWinding_FillType);
2497     path.moveTo(0, 1);
2498     path.cubicTo(1, 6, 4, 1, 4, 3);
2499     path.close();
2500     pathB.setFillType(SkPath::kWinding_FillType);
2501     pathB.moveTo(1, 4);
2502     pathB.cubicTo(3, 4, 1, 0, 6, 1);
2503     pathB.close();
2504     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
2505 }
2506 
cubicOp94u(skiatest::Reporter * reporter,const char * filename)2507 static void cubicOp94u(skiatest::Reporter* reporter, const char* filename) {
2508     SkPath path, pathB;
2509     path.setFillType(SkPath::kEvenOdd_FillType);
2510     path.moveTo(0, 3);
2511     path.cubicTo(2, 3, 5, 0, 5, 3);
2512     path.close();
2513     pathB.setFillType(SkPath::kEvenOdd_FillType);
2514     pathB.moveTo(0, 5);
2515     pathB.cubicTo(3, 5, 3, 0, 3, 2);
2516     pathB.close();
2517     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
2518 }
2519 
skpadbox_lt15(skiatest::Reporter * reporter,const char * filename)2520 static void skpadbox_lt15(skiatest::Reporter* reporter, const char* filename) {
2521     SkPath path;
2522     path.setFillType(SkPath::kEvenOdd_FillType);
2523     path.moveTo(333.292084f, 624.570984f);
2524     path.lineTo(614.229797f, 98.9735107f);
2525     path.lineTo(933.457764f, 269.604431f);
2526     path.lineTo(652.52002f, 795.201904f);
2527     path.lineTo(333.292084f, 624.570984f);
2528     path.close();
2529     SkPath pathB;
2530      pathB.setFillType(SkPath::kWinding_FillType);
2531     pathB.moveTo(613.368042f, 100.585754f);
2532     pathB.cubicTo(613.685303f, 99.9921265f, 614.423767f, 99.7681885f, 615.017395f, 100.085449f);
2533     pathB.lineTo(932.633057f, 269.854553f);
2534     pathB.cubicTo(933.226685f, 270.171875f, 933.450623f, 270.910278f, 933.133301f, 271.503906f);
2535     pathB.lineTo(653.631897f, 794.414307f);
2536     pathB.cubicTo(653.314636f, 795.007935f, 652.576172f, 795.231934f, 651.982544f, 794.914612f);
2537     pathB.lineTo(334.366943f, 625.145508f);
2538     pathB.cubicTo(333.773315f, 624.828247f, 333.549286f, 624.089783f, 333.866608f, 623.496155f);
2539     pathB.lineTo(613.368042f, 100.585754f);
2540      pathB.close();
2541     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2542 }
2543 
skpadoption_org196(skiatest::Reporter * reporter,const char * filename)2544 static void skpadoption_org196(skiatest::Reporter* reporter, const char* filename) {
2545     SkPath path;
2546     path.setFillType(SkPath::kEvenOdd_FillType);
2547     path.moveTo(802, 367);
2548     path.lineTo(802, 324);
2549     path.lineTo(956, 324);
2550     path.lineTo(956, 371);
2551     path.quadTo(956, 373.071075f, 954.536011f, 374.536011f);
2552     path.quadTo(953.071045f, 376, 951, 376);
2553     path.lineTo(811, 376);
2554     path.cubicTo(806.029419f, 376, 802, 371.970551f, 802, 367);
2555     path.close();
2556     SkPath pathB;
2557     pathB.setFillType(SkPath::kInverseWinding_FillType);
2558     pathB.moveTo(803, 326);
2559     pathB.lineTo(955, 326);
2560     pathB.lineTo(955, 370);
2561     pathB.cubicTo(955, 372.761414f, 952.761414f, 375, 950, 375);
2562     pathB.lineTo(808, 375);
2563     pathB.cubicTo(805.238586f, 375, 803, 372.761414f, 803, 370);
2564     pathB.lineTo(803, 326);
2565     pathB.close();
2566     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2567 }
2568 
skpadspert_net23(skiatest::Reporter * reporter,const char * filename)2569 static void skpadspert_net23(skiatest::Reporter* reporter, const char* filename) {
2570     SkPath path;
2571     path.setFillType(SkPath::kEvenOdd_FillType);
2572     path.moveTo(-2.220446e-018f, 483.5f);
2573     path.lineTo(0, 482.5f);
2574     path.lineTo(30.5f, 482.5f);
2575     path.cubicTo(32.709137f, 482.5f, 34.5f, 484.290863f, 34.5f, 486.5f);
2576     path.lineTo(34.5f, 678.5f);
2577     path.cubicTo(34.5f, 680.709167f, 32.709137f, 682.5f, 30.5f, 682.5f);
2578     path.lineTo(-4.4408921e-016f, 682.5f);
2579     path.lineTo(-4.41868766e-016f, 681.5f);
2580     path.lineTo(30.5f, 681.5f);
2581     path.cubicTo(32.1568565f, 681.5f, 33.5f, 680.15686f, 33.5f, 678.5f);
2582     path.lineTo(33.5f, 486.5f);
2583     path.cubicTo(33.5f, 484.84314f, 32.1568565f, 483.5f, 30.5f, 483.5f);
2584     path.lineTo(-2.220446e-018f, 483.5f);
2585     path.close();
2586     SkPath pathB;
2587     pathB.setFillType(SkPath::kWinding_FillType);
2588     pathB.moveTo(0, 482);
2589     pathB.lineTo(35, 482);
2590     pathB.lineTo(35, 683);
2591     pathB.lineTo(0, 683);
2592     pathB.close();
2593     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2594 }
2595 
skpadventistmission_org572(skiatest::Reporter * reporter,const char * filename)2596 static void skpadventistmission_org572(skiatest::Reporter* reporter, const char* filename) {
2597     SkPath path;
2598     path.setFillType(SkPath::kEvenOdd_FillType);
2599     path.moveTo(1182.00037f, 926);
2600     path.cubicTo(1181.08813f, 924.785583f, 1179.63586f, 924, 1178, 924);
2601     path.lineTo(938, 924);
2602     path.cubicTo(936.364197f, 924, 934.911865f, 924.785583f, 933.999634f, 926);
2603     path.lineTo(1182.00037f, 926);
2604     path.close();
2605     SkPath pathB;
2606     pathB.setFillType(SkPath::kWinding_FillType);
2607     pathB.moveTo(934, 924);
2608     pathB.lineTo(1182, 924);
2609     pathB.lineTo(1182, 926);
2610     pathB.lineTo(934, 926);
2611     pathB.close();
2612     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2613 }
2614 
skpagentxsites_com55(skiatest::Reporter * reporter,const char * filename)2615 static void skpagentxsites_com55(skiatest::Reporter* reporter, const char* filename) {
2616     SkPath path;
2617     path.setFillType(SkPath::kEvenOdd_FillType);
2618     path.moveTo(925, 27);
2619     path.cubicTo(924.447693f, 27, 924, 27.4477158f, 924, 28);
2620     path.lineTo(924, 55);
2621     path.cubicTo(924, 55.5522842f, 924.447693f, 56, 925, 56);
2622     path.lineTo(1103, 56);
2623     path.cubicTo(1103.55225f, 56, 1104, 55.5522842f, 1104, 55);
2624     path.lineTo(1104, 28);
2625     path.cubicTo(1104, 27.4477158f, 1103.55225f, 27, 1103, 27);
2626     path.lineTo(925, 27);
2627     path.close();
2628     SkPath pathB;
2629     pathB.setFillType(SkPath::kWinding_FillType);
2630     pathB.moveTo(1103, 27);
2631     pathB.cubicTo(1104.10461f, 27, 1105, 27.8954315f, 1105, 29);
2632     pathB.lineTo(1105, 54);
2633     pathB.cubicTo(1105, 55.1045685f, 1104.10461f, 56, 1103, 56);
2634     pathB.lineTo(926, 56);
2635     pathB.cubicTo(924.895447f, 56, 924, 55.1045685f, 924, 54);
2636     pathB.lineTo(924, 29);
2637     pathB.cubicTo(924, 27.8954315f, 924.895447f, 27, 926, 27);
2638     pathB.lineTo(1103, 27);
2639     pathB.close();
2640     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2641 }
2642 
skpbakosoft_com10(skiatest::Reporter * reporter,const char * filename)2643 static void skpbakosoft_com10(skiatest::Reporter* reporter, const char* filename) {
2644     SkPath path;
2645     path.setFillType(SkPath::kEvenOdd_FillType);
2646     path.moveTo(190, 170);
2647     path.cubicTo(178.9543f, 170, 170, 178.9543f, 170, 190);
2648     path.cubicTo(170, 201.0457f, 178.9543f, 210, 190, 210);
2649     path.lineTo(370, 210);
2650     path.cubicTo(381.045685f, 210, 390, 201.0457f, 390, 190);
2651     path.cubicTo(390, 178.9543f, 381.045685f, 170, 370, 170);
2652     path.lineTo(190, 170);
2653     path.close();
2654     SkPath pathB;
2655     pathB.setFillType(SkPath::kWinding_FillType);
2656     pathB.moveTo(210, 190);
2657     pathB.quadTo(210, 198.284271f, 204.142136f, 204.142136f);
2658     pathB.quadTo(198.284271f, 210, 190, 210);
2659     pathB.quadTo(181.715729f, 210, 175.857864f, 204.142136f);
2660     pathB.quadTo(170, 198.284271f, 170, 190);
2661     pathB.quadTo(170, 181.715729f, 175.857864f, 175.857864f);
2662     pathB.quadTo(181.715729f, 170, 190, 170);
2663     pathB.quadTo(198.284271f, 170, 204.142136f, 175.857864f);
2664     pathB.quadTo(210, 181.715729f, 210, 190);
2665     pathB.close();
2666     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2667 }
2668 
skpbambootheme_com12(skiatest::Reporter * reporter,const char * filename)2669 static void skpbambootheme_com12(skiatest::Reporter* reporter, const char* filename) {
2670     SkPath path;
2671     path.setFillType(SkPath::kEvenOdd_FillType);
2672     path.moveTo(47.8780937f, 58);
2673     path.lineTo(0, 58);
2674     path.lineTo(-8.65973959e-015f, 96.9914017f);
2675     path.quadTo(20.0654926f, 96.6451874f, 34.3553391f, 82.3553391f);
2676     path.quadTo(44.9466133f, 71.764061f, 47.8780937f, 58);
2677     path.close();
2678     SkPath pathB;
2679     pathB.setFillType(SkPath::kEvenOdd_FillType);
2680     pathB.moveTo(-1, -3);
2681     pathB.lineTo(-1, -3);
2682     pathB.cubicTo(26.6142502f, -3, 49, 19.3857498f, 49, 47);
2683     pathB.lineTo(49, 47);
2684     pathB.cubicTo(49, 74.6142502f, 26.6142502f, 97, -1, 97);
2685     pathB.lineTo(-1, 97);
2686     pathB.cubicTo(-28.6142502f, 97, -51, 74.6142502f, -51, 47);
2687     pathB.lineTo(-51, 47);
2688     pathB.cubicTo(-51, 19.3857498f, -28.6142502f, -3, -1, -3);
2689     pathB.close();
2690     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2691 }
2692 
skpakmmos_ru100(skiatest::Reporter * reporter,const char * filename)2693 static void skpakmmos_ru100(skiatest::Reporter* reporter, const char* filename) {
2694     SkPath path;
2695     path.setFillType(SkPath::kEvenOdd_FillType);
2696     path.moveTo(693.000488f, 926);
2697     path.cubicTo(692.164734f, 925.37207f, 691.125793f, 925, 690, 925);
2698     path.lineTo(578, 925);
2699     path.cubicTo(576.874207f, 925, 575.835266f, 925.37207f, 574.999512f, 926);
2700     path.lineTo(693.000488f, 926);
2701     path.close();
2702     SkPath pathB;
2703     pathB.setFillType(SkPath::kWinding_FillType);
2704     pathB.moveTo(575, 925);
2705     pathB.lineTo(693, 925);
2706     pathB.lineTo(693, 926);
2707     pathB.lineTo(575, 926);
2708     pathB.close();
2709     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2710 }
2711 
skpcarpetplanet_ru22(skiatest::Reporter * reporter,const char * filename)2712 static void skpcarpetplanet_ru22(skiatest::Reporter* reporter, const char* filename) {
2713     SkPath path;
2714     path.setFillType(SkPath::kEvenOdd_FillType);
2715     path.moveTo(195, 785);
2716     path.cubicTo(124.307556f, 785, 67, 841.859863f, 67, 912);
2717     path.lineTo(67, 913);
2718     path.cubicTo(67, 917.388916f, 67.2243805f, 921.725769f, 67.662384f, 926);
2719     path.lineTo(322, 926);
2720     path.lineTo(322, 896.048035f);
2721     path.cubicTo(314.09201f, 833.437622f, 260.247131f, 785, 195, 785);
2722     path.close();
2723     SkPath pathB;
2724     pathB.setFillType(SkPath::kWinding_FillType);
2725     pathB.moveTo(195, 785);
2726     pathB.cubicTo(265.140167f, 785, 322, 842.307556f, 322, 913);
2727     pathB.cubicTo(322, 983.692444f, 265.140167f, 1041, 195, 1041);
2728     pathB.lineTo(194, 1041);
2729     pathB.cubicTo(123.85984f, 1041, 67, 983.692444f, 67, 913);
2730     pathB.cubicTo(67, 842.307556f, 123.85984f, 785, 194, 785);
2731     pathB.lineTo(195, 785);
2732     pathB.close();
2733     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2734 }
2735 
skpcarrot_is24(skiatest::Reporter * reporter,const char * filename)2736 static void skpcarrot_is24(skiatest::Reporter* reporter, const char* filename) {
2737     SkPath path;
2738     path.setFillType(SkPath::kEvenOdd_FillType);
2739     path.moveTo(945, 597);
2740     path.quadTo(913.93396f, 597, 891.96698f, 618.96698f);
2741     path.quadTo(870, 640.93396f, 870, 672);
2742     path.quadTo(870, 703.06604f, 891.96698f, 725.03302f);
2743     path.quadTo(913.93396f, 747, 945, 747);
2744     path.quadTo(976.06604f, 747, 998.03302f, 725.03302f);
2745     path.quadTo(1020, 703.06604f, 1020, 672);
2746     path.quadTo(1020, 640.93396f, 998.03302f, 618.96698f);
2747     path.quadTo(976.06604f, 597, 945, 597);
2748     path.close();
2749     SkPath pathB;
2750     pathB.setFillType(SkPath::kWinding_FillType);
2751     pathB.moveTo(945.080994f, 597.161987f);
2752     pathB.cubicTo(903.659973f, 597.161987f, 870.080994f, 630.73999f, 870.080994f, 672.161987f);
2753     pathB.cubicTo(870.080994f, 676.096008f, 870.387024f, 679.957031f, 870.971008f, 683.726013f);
2754     pathB.cubicTo(876.53302f, 719.656006f, 907.593994f, 747.161987f, 945.080994f, 747.161987f);
2755     pathB.cubicTo(982.567993f, 747.161987f, 1013.62903f, 719.656006f, 1019.19104f, 683.726013f);
2756     pathB.cubicTo(1019.77502f, 679.955017f, 1020.08099f, 676.094971f, 1020.08099f, 672.161987f);
2757     pathB.cubicTo(1020.08002f, 630.73999f, 986.502014f, 597.161987f, 945.080994f, 597.161987f);
2758     pathB.close();
2759     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2760 }
2761 
skpbangalorenest_com4(skiatest::Reporter * reporter,const char * filename)2762 static void skpbangalorenest_com4(skiatest::Reporter* reporter, const char* filename) {
2763     SkPath path;
2764     path.setFillType(SkPath::kEvenOdd_FillType);
2765     path.moveTo(0, 926);
2766     path.lineTo(0, 0);
2767     path.lineTo(1265, 0);
2768     path.lineTo(1265, 926);
2769     path.lineTo(0, 926);
2770     path.close();
2771     SkPath pathB;
2772     pathB.setFillType(SkPath::kWinding_FillType);
2773     pathB.moveTo(0, 290);
2774     pathB.lineTo(-2.64514972e-014f, 146);
2775     pathB.lineTo(30, 146);
2776     pathB.lineTo(30, 290);
2777     pathB.close();
2778     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2779 }
2780 
skpbenzoteh_ru152(skiatest::Reporter * reporter,const char * filename)2781 static void skpbenzoteh_ru152(skiatest::Reporter* reporter, const char* filename) {
2782     SkPath path;
2783     path.setFillType(SkPath::kEvenOdd_FillType);
2784     path.moveTo(883, 23);
2785     path.lineTo(883, 0);
2786     path.lineTo(1122.5f, 0);
2787     path.lineTo(1122.5f, 25.2136822f);
2788     path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2789     path.quadTo(1120.07104f, 28, 1118, 28);
2790     path.lineTo(888, 28);
2791     path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2792     path.quadTo(883, 25.0710678f, 883, 23);
2793     path.close();
2794     SkPath pathB;
2795     pathB.setFillType(SkPath::kWinding_FillType);
2796     pathB.moveTo(883, 0);
2797     pathB.lineTo(1123, 0);
2798     pathB.lineTo(1123, 23);
2799     pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2800     pathB.quadTo(1120.07104f, 28, 1118, 28);
2801     pathB.lineTo(888, 28);
2802     pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2803     pathB.quadTo(883, 25.0710678f, 883, 23);
2804     pathB.close();
2805     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2806 }
2807 
skpbestred_ru37(skiatest::Reporter * reporter,const char * filename)2808 static void skpbestred_ru37(skiatest::Reporter* reporter, const char* filename) {
2809     SkPath path;
2810     path.setFillType(SkPath::kEvenOdd_FillType);
2811     path.moveTo(883, 23);
2812     path.lineTo(883, 0);
2813     path.lineTo(1122.5f, 0);
2814     path.lineTo(1122.5f, 25.2136822f);
2815     path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2816     path.quadTo(1120.07104f, 28, 1118, 28);
2817     path.lineTo(888, 28);
2818     path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2819     path.quadTo(883, 25.0710678f, 883, 23);
2820     path.close();
2821     SkPath pathB;
2822     pathB.setFillType(SkPath::kWinding_FillType);
2823     pathB.moveTo(883, 0);
2824     pathB.lineTo(1123, 0);
2825     pathB.lineTo(1123, 23);
2826     pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2827     pathB.quadTo(1120.07104f, 28, 1118, 28);
2828     pathB.lineTo(888, 28);
2829     pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2830     pathB.quadTo(883, 25.0710678f, 883, 23);
2831     pathB.close();
2832     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2833 }
2834 
skpbingoentertainment_net189(skiatest::Reporter * reporter,const char * filename)2835 static void skpbingoentertainment_net189(skiatest::Reporter* reporter, const char* filename) {
2836     SkPath path;
2837     path.setFillType(SkPath::kEvenOdd_FillType);
2838     path.moveTo(896, 745.38678f);
2839     path.lineTo(896, 873.38678f);
2840     path.lineTo(922.567993f, 876.683716f);
2841     path.lineTo(922.567993f, 748.683716f);
2842     path.lineTo(896, 745.38678f);
2843     path.close();
2844     SkPath pathB;
2845     pathB.setFillType(SkPath::kWinding_FillType);
2846     pathB.moveTo(899.200928f, 745.783997f);
2847     pathB.cubicTo(897.119385f, 745.525696f, 895.432007f, 752.031982f, 895.432007f, 760.316284f);
2848     pathB.lineTo(895.432007f, 858.316284f);
2849     pathB.cubicTo(895.432007f, 866.600586f, 897.119385f, 873.525696f, 899.200928f, 873.783997f);
2850     pathB.lineTo(918.799133f, 876.216003f);
2851     pathB.cubicTo(920.880615f, 876.474304f, 922.567993f, 869.968018f, 922.567993f, 861.683716f);
2852     pathB.lineTo(922.567993f, 763.683716f);
2853     pathB.cubicTo(922.567993f, 755.399414f, 920.880615f, 748.474304f, 918.799133f, 748.216003f);
2854     pathB.lineTo(899.200928f, 745.783997f);
2855     pathB.close();
2856     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2857 }
2858 
skpcarrefour_ro62(skiatest::Reporter * reporter,const char * filename)2859 static void skpcarrefour_ro62(skiatest::Reporter* reporter, const char* filename) {
2860     SkPath path;
2861     path.setFillType(SkPath::kEvenOdd_FillType);
2862     path.moveTo(1104, 453);
2863     path.lineTo(399, 453);
2864     path.lineTo(399, 657);
2865     path.cubicTo(399, 661.970581f, 403.029449f, 666, 408, 666);
2866     path.lineTo(1095, 666);
2867     path.cubicTo(1099.97058f, 666, 1104, 661.970581f, 1104, 657);
2868     path.lineTo(1104, 453);
2869     path.close();
2870     SkPath pathB;
2871     pathB.setFillType(SkPath::kInverseWinding_FillType);
2872     pathB.moveTo(400, 453);
2873     pathB.lineTo(1103, 453);
2874     pathB.lineTo(1103, 666);
2875     pathB.lineTo(406, 666);
2876     pathB.cubicTo(402.686279f, 666, 400, 663.313721f, 400, 660);
2877     pathB.lineTo(400, 453);
2878     pathB.close();
2879     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2880 }
2881 
skpcaffelavazzait_com_ua21(skiatest::Reporter * reporter,const char * filename)2882 static void skpcaffelavazzait_com_ua21(skiatest::Reporter* reporter, const char* filename) {
2883     SkPath path;
2884     path.setFillType(SkPath::kEvenOdd_FillType);
2885     path.moveTo(883, 23);
2886     path.lineTo(883, 0);
2887     path.lineTo(1122.5f, 0);
2888     path.lineTo(1122.5f, 25.2136822f);
2889     path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2890     path.quadTo(1120.07104f, 28, 1118, 28);
2891     path.lineTo(888, 28);
2892     path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2893     path.quadTo(883, 25.0710678f, 883, 23);
2894     path.close();
2895     SkPath pathB;
2896     pathB.setFillType(SkPath::kWinding_FillType);
2897     pathB.moveTo(883, 0);
2898     pathB.lineTo(1123, 0);
2899     pathB.lineTo(1123, 23);
2900     pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2901     pathB.quadTo(1120.07104f, 28, 1118, 28);
2902     pathB.lineTo(888, 28);
2903     pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2904     pathB.quadTo(883, 25.0710678f, 883, 23);
2905     pathB.close();
2906     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2907 }
2908 
skpcamcorder_kz21(skiatest::Reporter * reporter,const char * filename)2909 static void skpcamcorder_kz21(skiatest::Reporter* reporter, const char* filename) {
2910     SkPath path;
2911     path.setFillType(SkPath::kEvenOdd_FillType);
2912     path.moveTo(883, 23);
2913     path.lineTo(883, 0);
2914     path.lineTo(1122.5f, 0);
2915     path.lineTo(1122.5f, 25.2136822f);
2916     path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2917     path.quadTo(1120.07104f, 28, 1118, 28);
2918     path.lineTo(888, 28);
2919     path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2920     path.quadTo(883, 25.0710678f, 883, 23);
2921     path.close();
2922     SkPath pathB;
2923     pathB.setFillType(SkPath::kWinding_FillType);
2924     pathB.moveTo(883, 0);
2925     pathB.lineTo(1123, 0);
2926     pathB.lineTo(1123, 23);
2927     pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2928     pathB.quadTo(1120.07104f, 28, 1118, 28);
2929     pathB.lineTo(888, 28);
2930     pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2931     pathB.quadTo(883, 25.0710678f, 883, 23);
2932     pathB.close();
2933     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2934 }
2935 
skpcavablar_net563(skiatest::Reporter * reporter,const char * filename)2936 static void skpcavablar_net563(skiatest::Reporter* reporter, const char* filename) {
2937     SkPath path;
2938     path.setFillType(SkPath::kEvenOdd_FillType);
2939     path.moveTo(160.000488f, 918);
2940     path.cubicTo(159.164749f, 917.37207f, 158.125824f, 917, 157, 917);
2941     path.lineTo(94, 917);
2942     path.cubicTo(92.874176f, 917, 91.8352661f, 917.37207f, 90.9995193f, 918);
2943     path.lineTo(160.000488f, 918);
2944     path.close();
2945     SkPath pathB;
2946     pathB.setFillType(SkPath::kWinding_FillType);
2947     pathB.moveTo(91, 917);
2948     pathB.lineTo(160, 917);
2949     pathB.lineTo(160, 918);
2950     pathB.lineTo(91, 918);
2951     pathB.close();
2952     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2953 }
2954 
skpinsomnia_gr72(skiatest::Reporter * reporter,const char * filename)2955 static void skpinsomnia_gr72(skiatest::Reporter* reporter, const char* filename) {
2956     SkPath path;
2957     path.setFillType(SkPath::kEvenOdd_FillType);
2958     path.moveTo(1138, 231);
2959     path.lineTo(1137, 243.625748f);
2960     path.lineTo(1137, 926);
2961     path.lineTo(1139, 926);
2962     path.lineTo(1139, 231);
2963     path.lineTo(1138, 231);
2964     path.close();
2965     SkPath pathB;
2966     pathB.setFillType(SkPath::kWinding_FillType);
2967     pathB.moveTo(1139, 231);
2968     pathB.lineTo(1138, 231);
2969     pathB.lineTo(633, 6101);
2970     pathB.lineTo(1139, 6607);
2971     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
2972 }
2973 
cubicOp95u(skiatest::Reporter * reporter,const char * filename)2974 static void cubicOp95u(skiatest::Reporter* reporter, const char* filename) {
2975     SkPath path, pathB;
2976     path.setFillType(SkPath::kEvenOdd_FillType);
2977     path.moveTo(0, 2);
2978     path.cubicTo(2, 3, 5, 1, 3, 2);
2979     path.close();
2980     pathB.setFillType(SkPath::kEvenOdd_FillType);
2981     pathB.moveTo(1, 5);
2982     pathB.cubicTo(2, 3, 2, 0, 3, 2);
2983     pathB.close();
2984     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
2985 }
2986 
cubicOp96d(skiatest::Reporter * reporter,const char * filename)2987 static void cubicOp96d(skiatest::Reporter* reporter, const char* filename) {
2988     SkPath path, pathB;
2989     path.setFillType(SkPath::kEvenOdd_FillType);
2990     path.moveTo(1, 6);
2991     path.cubicTo(0, 3, 6, 3, 5, 0);
2992     path.close();
2993     pathB.setFillType(SkPath::kEvenOdd_FillType);
2994     pathB.moveTo(3, 6);
2995     pathB.cubicTo(0, 5, 6, 1, 3, 0);
2996     pathB.close();
2997     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
2998 }
2999 
cubicOp97x(skiatest::Reporter * reporter,const char * filename)3000 static void cubicOp97x(skiatest::Reporter* reporter, const char* filename) {
3001     SkPath path, pathB;
3002     path.setFillType(SkPath::kEvenOdd_FillType);
3003     path.moveTo(0, 2);
3004     path.cubicTo(0, 6, 2, 1, 2, 1);
3005     path.close();
3006     pathB.setFillType(SkPath::kEvenOdd_FillType);
3007     pathB.moveTo(1, 2);
3008     pathB.cubicTo(1, 2, 2, 0, 6, 0);
3009     pathB.close();
3010     testPathOp(reporter, path, pathB, kXOR_SkPathOp, filename);
3011 }
3012 
cubicOp98x(skiatest::Reporter * reporter,const char * filename)3013 static void cubicOp98x(skiatest::Reporter* reporter, const char* filename) {
3014     SkPath path, pathB;
3015     path.setFillType(SkPath::kEvenOdd_FillType);
3016     path.moveTo(0, 3);
3017     path.cubicTo(3, 6, 4, 1, 6, 3);
3018     path.close();
3019     pathB.setFillType(SkPath::kEvenOdd_FillType);
3020     pathB.moveTo(1, 4);
3021     pathB.cubicTo(3, 6, 3, 0, 6, 3);
3022     pathB.close();
3023     testPathOp(reporter, path, pathB, kXOR_SkPathOp, filename);
3024 }
3025 
cubicOp99(skiatest::Reporter * reporter,const char * filename)3026 static void cubicOp99(skiatest::Reporter* reporter, const char* filename) {
3027     SkPath path, pathB;
3028     path.setFillType(SkPath::kWinding_FillType);
3029     path.moveTo(3,6);
3030     path.cubicTo(0,3, 6,5, 5,4);
3031     path.close();
3032     pathB.setFillType(SkPath::kWinding_FillType);
3033     pathB.moveTo(5,6);
3034     pathB.cubicTo(4,5, 6,3, 3,0);
3035     pathB.close();
3036     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3037 }
3038 
cubicOp100(skiatest::Reporter * reporter,const char * filename)3039 static void cubicOp100(skiatest::Reporter* reporter, const char* filename) {
3040     SkPath path, pathB;
3041     path.setFillType(SkPath::kWinding_FillType);
3042     path.moveTo(0,1);
3043     path.cubicTo(0,2, 2,1, 4,2);
3044     path.close();
3045     pathB.setFillType(SkPath::kWinding_FillType);
3046     pathB.moveTo(1,2);
3047     pathB.cubicTo(2,4, 1,0, 2,0);
3048     pathB.close();
3049     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3050 }
3051 
cubicOp101(skiatest::Reporter * reporter,const char * filename)3052 static void cubicOp101(skiatest::Reporter* reporter, const char* filename) {
3053     SkPath path, pathB;
3054     path.setFillType(SkPath::kWinding_FillType);
3055     path.moveTo(0, 1);
3056     path.cubicTo(2, 3, 2, 1, 5, 3);
3057     path.close();
3058     pathB.setFillType(SkPath::kWinding_FillType);
3059     pathB.moveTo(1, 2);
3060     pathB.cubicTo(3, 5, 1, 0, 3, 2);
3061     pathB.close();
3062     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3063 }
3064 
cubicOp102(skiatest::Reporter * reporter,const char * filename)3065 static void cubicOp102(skiatest::Reporter* reporter, const char* filename) {
3066     SkPath path, pathB;
3067     path.setFillType(SkPath::kWinding_FillType);
3068     path.moveTo(0,1);
3069     path.cubicTo(1,2, 1,0, 3,0);
3070     path.close();
3071     pathB.setFillType(SkPath::kWinding_FillType);
3072     pathB.moveTo(0,1);
3073     pathB.cubicTo(0,3, 1,0, 2,1);
3074     pathB.close();
3075     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3076 }
3077 
cubicOp103(skiatest::Reporter * reporter,const char * filename)3078 static void cubicOp103(skiatest::Reporter* reporter, const char* filename) {
3079     SkPath path, pathB;
3080     path.setFillType(SkPath::kWinding_FillType);
3081     path.moveTo(0,1);
3082     path.cubicTo(1,5, 2,0, 2,1);
3083     path.close();
3084     pathB.setFillType(SkPath::kWinding_FillType);
3085     pathB.moveTo(0,2);
3086     pathB.cubicTo(1,2, 1,0, 5,1);
3087     pathB.close();
3088     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3089 }
3090 
cubicOp104(skiatest::Reporter * reporter,const char * filename)3091 static void cubicOp104(skiatest::Reporter* reporter, const char* filename) {
3092     SkPath path, pathB;
3093     path.setFillType(SkPath::kWinding_FillType);
3094     path.moveTo(0,1);
3095     path.cubicTo(0,6, 4,0, 6,1);
3096     path.close();
3097     pathB.setFillType(SkPath::kWinding_FillType);
3098     pathB.moveTo(0,4);
3099     pathB.cubicTo(1,6, 1,0, 6,0);
3100     pathB.close();
3101     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3102 }
3103 
cubicOp105(skiatest::Reporter * reporter,const char * filename)3104 static void cubicOp105(skiatest::Reporter* reporter, const char* filename) {
3105     SkPath path, pathB;
3106     path.setFillType(SkPath::kWinding_FillType);
3107     path.moveTo(0,1);
3108     path.cubicTo(0,4, 6,5, 2,0);
3109     path.close();
3110     pathB.setFillType(SkPath::kWinding_FillType);
3111     pathB.moveTo(5,6);
3112     pathB.cubicTo(0,2, 1,0, 4,0);
3113     pathB.close();
3114     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3115 }
3116 
cubicOp106(skiatest::Reporter * reporter,const char * filename)3117 static void cubicOp106(skiatest::Reporter* reporter, const char* filename) {
3118     SkPath path, pathB;
3119     path.setFillType(SkPath::kWinding_FillType);
3120     path.moveTo(0, 1);
3121     path.cubicTo(4, 6, 2, 1, 2, 0);
3122     path.close();
3123     pathB.setFillType(SkPath::kWinding_FillType);
3124     pathB.moveTo(1, 2);
3125     pathB.cubicTo(0, 2, 1, 0, 6, 4);
3126     pathB.close();
3127     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3128 }
3129 
cubicOp107(skiatest::Reporter * reporter,const char * filename)3130 static void cubicOp107(skiatest::Reporter* reporter, const char* filename) {
3131     SkPath path, pathB;
3132     path.setFillType(SkPath::kWinding_FillType);
3133     path.moveTo(0, 1);
3134     path.cubicTo(4, 6, 2, 1, 2, 0);
3135     path.close();
3136     pathB.setFillType(SkPath::kWinding_FillType);
3137     pathB.moveTo(1, 2);
3138     pathB.cubicTo(0, 2, 1, 0, 6, 4);
3139     pathB.close();
3140     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3141 }
3142 
cubicOp108(skiatest::Reporter * reporter,const char * filename)3143 static void cubicOp108(skiatest::Reporter* reporter, const char* filename) {
3144     SkPath path, pathB;
3145     path.setFillType(SkPath::kWinding_FillType);
3146     path.moveTo(0, 1);
3147     path.cubicTo(4, 6, 2, 1, 2, 0);
3148     path.close();
3149     pathB.setFillType(SkPath::kWinding_FillType);
3150     pathB.moveTo(1, 2);
3151     pathB.cubicTo(0, 2, 1, 0, 6, 4);
3152     pathB.close();
3153     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
3154 }
3155 
cubicOp109(skiatest::Reporter * reporter,const char * filename)3156 static void cubicOp109(skiatest::Reporter* reporter, const char* filename) {
3157     SkPath path, pathB;
3158     path.setFillType(SkPath::kWinding_FillType);
3159     path.moveTo(0,1);
3160     path.cubicTo(4,5, 6,3, 5,4);
3161     path.close();
3162     pathB.setFillType(SkPath::kWinding_FillType);
3163     pathB.moveTo(3,6);
3164     pathB.cubicTo(4,5, 1,0, 5,4);
3165     pathB.close();
3166     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3167 }
3168 
cubicOp110(skiatest::Reporter * reporter,const char * filename)3169 static void cubicOp110(skiatest::Reporter* reporter, const char* filename) {
3170     SkPath path, pathB;
3171     path.setFillType(SkPath::kEvenOdd_FillType);
3172     path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
3173     path.addRect(0, 0, 4, 4, SkPath::kCW_Direction);
3174     pathB.setFillType(SkPath::kEvenOdd_FillType);
3175     pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3176     pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3177     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3178 }
3179 
cubicOp111(skiatest::Reporter * reporter,const char * filename)3180 static void cubicOp111(skiatest::Reporter* reporter, const char* filename) {
3181     SkPath path, pathB;
3182     path.setFillType(SkPath::kWinding_FillType);
3183     path.moveTo(1,4);
3184     path.cubicTo(0,5, 4,1, 3,1);
3185     path.close();
3186     pathB.setFillType(SkPath::kWinding_FillType);
3187     pathB.moveTo(1,4);
3188     pathB.cubicTo(1,3, 4,1, 5,0);
3189     pathB.close();
3190     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3191 }
3192 
xOp1u(skiatest::Reporter * reporter,const char * filename)3193 static void xOp1u(skiatest::Reporter* reporter, const char* filename) {
3194     SkPath path, pathB;
3195     path.setFillType(SkPath::kEvenOdd_FillType);
3196     path.moveTo(1, 4);
3197     path.cubicTo(4, 5, 3, 2, 6, 3);
3198     path.close();
3199     pathB.setFillType(SkPath::kEvenOdd_FillType);
3200     pathB.moveTo(2, 3);
3201     pathB.cubicTo(3, 6, 4, 1, 5, 4);
3202     pathB.close();
3203     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
3204 }
3205 
xOp1i(skiatest::Reporter * reporter,const char * filename)3206 static void xOp1i(skiatest::Reporter* reporter, const char* filename) {
3207     SkPath path, pathB;
3208     path.setFillType(SkPath::kEvenOdd_FillType);
3209     path.moveTo(1, 4);
3210     path.cubicTo(1, 5, 6, 0, 5, 1);
3211     path.close();
3212     pathB.setFillType(SkPath::kEvenOdd_FillType);
3213     pathB.moveTo(0, 6);
3214     pathB.cubicTo(1, 5, 4, 1, 5, 1);
3215     pathB.close();
3216     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3217 }
3218 
xOp2i(skiatest::Reporter * reporter,const char * filename)3219 static void xOp2i(skiatest::Reporter* reporter, const char* filename) {
3220     SkPath path, pathB;
3221     path.setFillType(SkPath::kEvenOdd_FillType);
3222     path.moveTo(1, 5);
3223     path.cubicTo(0, 4, 3, 2, 6, 1);
3224     path.close();
3225     pathB.setFillType(SkPath::kEvenOdd_FillType);
3226     pathB.moveTo(2, 3);
3227     pathB.cubicTo(1, 6, 5, 1, 4, 0);
3228     pathB.close();
3229     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3230 }
3231 
xOp3i(skiatest::Reporter * reporter,const char * filename)3232 static void xOp3i(skiatest::Reporter* reporter, const char* filename) {
3233     SkPath path, pathB;
3234     path.setFillType(SkPath::kWinding_FillType);
3235     path.moveTo(1,4);
3236     path.cubicTo(0,5, 4,1, 3,1);
3237     path.close();
3238     pathB.setFillType(SkPath::kWinding_FillType);
3239     pathB.moveTo(1,4);
3240     pathB.cubicTo(1,3, 4,1, 5,0);
3241     pathB.close();
3242     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3243 }
3244 
findFirst1(skiatest::Reporter * reporter,const char * filename)3245 static void findFirst1(skiatest::Reporter* reporter, const char* filename) {
3246     SkPath path, pathB;
3247     path.setFillType(SkPath::kWinding_FillType);
3248     path.moveTo(0,1);
3249     path.cubicTo(1,6, 5,0, 2,1);
3250     path.close();
3251     pathB.setFillType(SkPath::kWinding_FillType);
3252     pathB.moveTo(0,5);
3253     pathB.cubicTo(1,2, 1,0, 6,1);
3254     pathB.close();
3255     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3256 }
3257 
cubicOp112(skiatest::Reporter * reporter,const char * filename)3258 static void cubicOp112(skiatest::Reporter* reporter, const char* filename) {
3259     SkPath path, pathB;
3260     path.setFillType(SkPath::kWinding_FillType);
3261     path.moveTo(2,4);
3262     path.cubicTo(2,3, 6,4, 1,0);
3263     path.close();
3264     pathB.setFillType(SkPath::kWinding_FillType);
3265     pathB.moveTo(4,6);
3266     pathB.cubicTo(0,1, 4,2, 3,2);
3267     pathB.close();
3268     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3269 }
3270 
cubicOp113(skiatest::Reporter * reporter,const char * filename)3271 static void cubicOp113(skiatest::Reporter* reporter, const char* filename) {
3272     SkPath path, pathB;
3273     path.moveTo(2,4);
3274     path.cubicTo(3,5, 2.33333325f,4.33333349f, 3.83333325f,3.83333349f);
3275     path.close();
3276     pathB.moveTo(3,5);
3277     pathB.cubicTo(2.33333325f,4.33333349f, 3.83333325f,3.83333349f, 2,4);
3278     pathB.close();
3279     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3280 }
3281 
cubicOp114(skiatest::Reporter * reporter,const char * filename)3282 static void cubicOp114(skiatest::Reporter* reporter, const char* filename) {
3283     SkPath path, pathB;
3284     path.setFillType(SkPath::kWinding_FillType);
3285     path.moveTo(0, 1);
3286     path.cubicTo(1, 3, -1, 2, 3.5f, 1.33333337f);
3287     path.close();
3288     pathB.setFillType(SkPath::kWinding_FillType);
3289     pathB.moveTo(1, 3);
3290     pathB.cubicTo(-1, 2, 3.5f, 1.33333337f, 0, 1);
3291     pathB.close();
3292     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3293 }
3294 
cubicOp114asQuad(skiatest::Reporter * reporter,const char * filename)3295 static void cubicOp114asQuad(skiatest::Reporter* reporter, const char* filename) {
3296     SkPath path, pathB;
3297     path.setFillType(SkPath::kWinding_FillType);
3298     path.moveTo(0, 1);
3299     path.cubicTo(1, 3, -1, 2, 3.5f, 1.33333337f);
3300     path.close();
3301     pathB.setFillType(SkPath::kWinding_FillType);
3302     pathB.moveTo(1, 3);
3303     pathB.cubicTo(-1, 2, 3.5f, 1.33333337f, 0, 1);
3304     pathB.close();
3305     SkPath qPath, qPathB;
3306     CubicPathToQuads(path, &qPath);
3307     CubicPathToQuads(pathB, &qPathB);
3308     testPathOp(reporter, qPath, qPathB, kIntersect_SkPathOp, filename);
3309 }
3310 
quadOp10i(skiatest::Reporter * reporter,const char * filename)3311 static void quadOp10i(skiatest::Reporter* reporter, const char* filename) {
3312     SkPath path, pathB;
3313     path.moveTo(0, 0);
3314     path.quadTo(1, 8, 3, 5);
3315     path.lineTo(8, 1);
3316     path.close();
3317     pathB.moveTo(0, 0);
3318     pathB.quadTo(8, 1, 4, 8);
3319     pathB.close();
3320     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3321 }
3322 
kari1(skiatest::Reporter * reporter,const char * filename)3323 static void kari1(skiatest::Reporter* reporter, const char* filename) {
3324     SkPath path1;
3325     path1.moveTo(39.9375, -5.8359375);
3326     path1.lineTo(40.625, -5.7890625);
3327     path1.lineTo(37.7109375, 1.3515625);
3328     path1.lineTo(37.203125, 0.9609375);
3329     path1.close();
3330 
3331     SkPath path2;
3332     path2.moveTo(37.52734375f, -1.44140625f);
3333     path2.cubicTo(37.8736991882324f, -1.69921875f, 38.1640625f, -2.140625f, 38.3984375f, -2.765625f);
3334     path2.lineTo(38.640625f, -2.609375f);
3335     path2.cubicTo(38.53125f, -1.89583337306976f, 38.0664443969727f, -0.154893040657043f, 38.0664443969727f, -0.154893040657043f);
3336     path2.cubicTo(38.0664443969727f, -0.154893040657043f, 37.1809883117676f, -1.18359375f, 37.52734375, -1.44140625f);
3337     path2.close();
3338 
3339     testPathOp(reporter, path1, path2, kDifference_SkPathOp, filename);
3340 }
3341 
issue2504(skiatest::Reporter * reporter,const char * filename)3342 static void issue2504(skiatest::Reporter* reporter, const char* filename) {
3343     SkPath path1;
3344     path1.moveTo(34.2421875, -5.976562976837158203125);
3345     path1.lineTo(35.453121185302734375, 0);
3346     path1.lineTo(31.9375, 0);
3347     path1.close();
3348 
3349     SkPath path2;
3350     path2.moveTo(36.71843719482421875, 0.8886508941650390625);
3351     path2.cubicTo(36.71843719482421875, 0.8886508941650390625,
3352                   35.123386383056640625, 0.554015457630157470703125,
3353                   34.511409759521484375, -0.1152553558349609375);
3354     path2.cubicTo(33.899425506591796875, -0.7845261096954345703125,
3355                   34.53484344482421875, -5.6777553558349609375,
3356                   34.53484344482421875, -5.6777553558349609375);
3357     path2.close();
3358     testPathOp(reporter, path1, path2, kUnion_SkPathOp, filename);
3359 }
3360 
issue2540(skiatest::Reporter * reporter,const char * filename)3361 static void issue2540(skiatest::Reporter* reporter, const char* filename) {
3362     SkPath path1;
3363     path1.moveTo(26.5054988861083984375, 85.73960113525390625);
3364     path1.cubicTo(84.19739532470703125, 17.77140045166015625, 16.93920135498046875, 101.86199951171875, 12.631000518798828125, 105.24700164794921875);
3365     path1.cubicTo(11.0819997787475585937500000, 106.46399688720703125, 11.5260000228881835937500000, 104.464996337890625, 11.5260000228881835937500000, 104.464996337890625);
3366     path1.lineTo(23.1654987335205078125, 89.72879791259765625);
3367     path1.cubicTo(23.1654987335205078125, 89.72879791259765625, -10.1713008880615234375, 119.9160003662109375, -17.1620006561279296875, 120.8249969482421875);
3368     path1.cubicTo(-19.1149997711181640625, 121.07900238037109375, -18.0380001068115234375, 119.79299163818359375, -18.0380001068115234375, 119.79299163818359375);
3369     path1.cubicTo(-18.0380001068115234375, 119.79299163818359375, 14.22100067138671875, 90.60700225830078125, 26.5054988861083984375, 85.73960113525390625);
3370     path1.close();
3371 
3372     SkPath path2;
3373     path2.moveTo(-25.077999114990234375, 124.9120025634765625);
3374     path2.cubicTo(-25.077999114990234375, 124.9120025634765625, -25.9509983062744140625, 125.95400238037109375, -24.368999481201171875, 125.7480010986328125);
3375     path2.cubicTo(-16.06999969482421875, 124.66899871826171875, 1.2680000066757202148437500, 91.23999786376953125, 37.264003753662109375, 95.35400390625);
3376     path2.cubicTo(37.264003753662109375, 95.35400390625, 11.3710002899169921875, 83.7339935302734375, -25.077999114990234375, 124.9120025634765625);
3377     path2.close();
3378     testPathOp(reporter, path1, path2, kUnion_SkPathOp, filename);
3379 }
3380 
rects1(skiatest::Reporter * reporter,const char * filename)3381 static void rects1(skiatest::Reporter* reporter, const char* filename) {
3382     SkPath path, pathB;
3383     path.setFillType(SkPath::kEvenOdd_FillType);
3384     path.moveTo(0, 0);
3385     path.lineTo(1, 0);
3386     path.lineTo(1, 1);
3387     path.lineTo(0, 1);
3388     path.close();
3389     path.moveTo(0, 0);
3390     path.lineTo(6, 0);
3391     path.lineTo(6, 6);
3392     path.lineTo(0, 6);
3393     path.close();
3394     pathB.setFillType(SkPath::kEvenOdd_FillType);
3395     pathB.moveTo(0, 0);
3396     pathB.lineTo(1, 0);
3397     pathB.lineTo(1, 1);
3398     pathB.lineTo(0, 1);
3399     pathB.close();
3400     pathB.moveTo(0, 0);
3401     pathB.lineTo(2, 0);
3402     pathB.lineTo(2, 2);
3403     pathB.lineTo(0, 2);
3404     pathB.close();
3405     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
3406 }
3407 
rects2(skiatest::Reporter * reporter,const char * filename)3408 static void rects2(skiatest::Reporter* reporter, const char* filename) {
3409     SkPath path, pathB;
3410     path.setFillType(SkPath::kEvenOdd_FillType);
3411     path.moveTo(0, 0);
3412     path.lineTo(4, 0);
3413     path.lineTo(4, 4);
3414     path.lineTo(0, 4);
3415     path.close();
3416     path.moveTo(3, 3);
3417     path.lineTo(4, 3);
3418     path.lineTo(4, 4);
3419     path.lineTo(3, 4);
3420     path.close();
3421     pathB.setFillType(SkPath::kWinding_FillType);
3422     pathB.moveTo(3, 3);
3423     pathB.lineTo(6, 3);
3424     pathB.lineTo(6, 6);
3425     pathB.lineTo(3, 6);
3426     pathB.close();
3427     pathB.moveTo(3, 3);
3428     pathB.lineTo(4, 3);
3429     pathB.lineTo(4, 4);
3430     pathB.lineTo(3, 4);
3431     pathB.close();
3432     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3433 }
3434 
rects3(skiatest::Reporter * reporter,const char * filename)3435 static void rects3(skiatest::Reporter* reporter, const char* filename) {
3436     SkPath path, pathB;
3437     path.setFillType(SkPath::kEvenOdd_FillType);
3438     path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
3439     path.addRect(0, 0, 4, 4, SkPath::kCW_Direction);
3440     pathB.setFillType(SkPath::kWinding_FillType);
3441     pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3442     pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3443     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3444 }
3445 
rects4(skiatest::Reporter * reporter,const char * filename)3446 static void rects4(skiatest::Reporter* reporter, const char* filename) {
3447     SkPath path, pathB;
3448     path.setFillType(SkPath::kEvenOdd_FillType);
3449     path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
3450     path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3451     pathB.setFillType(SkPath::kWinding_FillType);
3452     pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3453     pathB.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
3454     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3455 }
3456 
issue2753(skiatest::Reporter * reporter,const char * filename)3457 static void issue2753(skiatest::Reporter* reporter, const char* filename) {
3458     SkPath path1;
3459     path1.moveTo(142.701f, 110.568f);
3460     path1.lineTo(142.957f, 100);
3461     path1.lineTo(153.835f, 100);
3462     path1.lineTo(154.592f, 108.188f);
3463     path1.cubicTo(154.592f, 108.188f, 153.173f, 108.483f, 152.83f, 109.412f);
3464     path1.cubicTo(152.83f, 109.412f, 142.701f, 110.568f, 142.701f, 110.568f);
3465     path1.close();
3466 
3467     SkPath path2;
3468     path2.moveTo(39, 124.001f);
3469     path2.cubicTo(39, 124.001f, 50.6f, 117.001f, 50.6f, 117.001f);
3470     path2.cubicTo(50.6f, 117.001f, 164.601f, 85.2f, 188.201f, 117.601f);
3471     path2.cubicTo(188.201f, 117.601f, 174.801f, 93, 39, 124.001f);
3472     path2.close();
3473 
3474     testPathOp(reporter, path1, path2, kUnion_SkPathOp, filename);
3475 }
3476 
issue2808(skiatest::Reporter * reporter,const char * filename)3477 static void issue2808(skiatest::Reporter* reporter, const char* filename) {
3478     SkPath path1, path2;
3479 
3480 	path1.moveTo(509.20300293f, 385.601989746f);
3481 	path1.quadTo(509.20300293f, 415.68838501f, 487.928710938f, 436.96270752f);
3482 	path1.quadTo(466.654388428f, 458.236999512f, 436.567993164f, 458.236999512f);
3483 	path1.quadTo(406.4815979f, 458.236999512f, 385.207275391f, 436.96270752f);
3484 	path1.quadTo(363.932983398f, 415.68838501f, 363.932983398f, 385.601989746f);
3485 	path1.quadTo(363.932983398f, 355.515594482f, 385.207275391f, 334.241271973f);
3486 	path1.quadTo(406.4815979f, 312.96697998f, 436.567993164f, 312.96697998f);
3487 	path1.quadTo(466.654388428f, 312.96697998f, 487.928710938f, 334.241271973f);
3488 	path1.quadTo(509.20300293f, 355.515594482f, 509.20300293f, 385.601989746f);
3489 	path1.close();
3490 
3491 	path2.moveTo(449.033996582f, 290.87298584f);
3492 	path2.quadTo(449.033996582f, 301.028259277f, 441.853149414f, 308.209106445f);
3493 	path2.quadTo(434.672271729f, 315.389984131f, 424.516998291f, 315.389984131f);
3494 	path2.quadTo(414.361724854f, 315.389984131f, 407.180847168f, 308.209106445f);
3495 	path2.quadTo(400, 301.028259277f, 400, 290.87298584f);
3496 	path2.quadTo(400, 280.717712402f, 407.180847168f, 273.536865234f);
3497 	path2.quadTo(414.361724854f, 266.355987549f, 424.516998291f, 266.355987549f);
3498 	path2.quadTo(434.672271729f, 266.355987549f, 441.853149414f, 273.536865234f);
3499 	path2.quadTo(449.033996582f, 280.717712402f, 449.033996582f, 290.87298584f);
3500 	path2.close();
3501 
3502     testPathOp(reporter, path1, path2, kUnion_SkPathOp, filename);
3503 }
3504 
cubicOp115(skiatest::Reporter * reporter,const char * filename)3505 static void cubicOp115(skiatest::Reporter* reporter, const char* filename) {
3506     SkPath path, pathB;
3507     path.setFillType(SkPath::kWinding_FillType);
3508     path.moveTo(0,1);
3509     path.cubicTo(3,4, 2,1, 5,3);
3510     path.close();
3511     pathB.setFillType(SkPath::kWinding_FillType);
3512     pathB.moveTo(1,2);
3513     pathB.cubicTo(3,5, 1,0, 4,3);
3514     pathB.close();
3515     SkPath path2(path);
3516     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3517 }
3518 
testRect1(skiatest::Reporter * reporter,const char * filename)3519 static void testRect1(skiatest::Reporter* reporter, const char* filename) {
3520     SkPath path, path2;
3521     path.addRect(0, 0, 60, 60, SkPath::kCCW_Direction);
3522     path.addRect(30, 20, 50, 50, SkPath::kCCW_Direction);
3523     path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction);
3524 //    path.addRect(32, 24, 36, 41, SkPath::kCCW_Direction);
3525     testPathOp(reporter, path, path2, kUnion_SkPathOp, filename);
3526 }
3527 
testRect2(skiatest::Reporter * reporter,const char * filename)3528 static void testRect2(skiatest::Reporter* reporter, const char* filename) {
3529     SkPath path, pathB;
3530     path.setFillType(SkPath::kWinding_FillType);
3531     path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
3532     path.addRect(4, 4, 5, 5, SkPath::kCW_Direction);
3533     pathB.setFillType(SkPath::kEvenOdd_FillType);
3534     pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3535     pathB.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
3536     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3537 }
3538 
cubicOp116(skiatest::Reporter * reporter,const char * filename)3539 static void cubicOp116(skiatest::Reporter* reporter, const char* filename) {
3540     SkPath path, pathB;
3541     path.setFillType(SkPath::kWinding_FillType);
3542     path.moveTo(0,1);
3543     path.cubicTo(4,6, 2,0, 2,0);
3544     path.close();
3545     pathB.setFillType(SkPath::kWinding_FillType);
3546     pathB.moveTo(0,2);
3547     pathB.cubicTo(0,2, 1,0, 6,4);
3548     pathB.close();
3549     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3550 }
3551 
cubicOp117(skiatest::Reporter * reporter,const char * filename)3552 static void cubicOp117(skiatest::Reporter* reporter, const char* filename) {
3553     SkPath path, pathB;
3554     path.setFillType(SkPath::kWinding_FillType);
3555     path.moveTo(0,1);
3556     path.cubicTo(4,5, 6,0, 1,0);
3557     path.close();
3558     pathB.setFillType(SkPath::kWinding_FillType);
3559     pathB.moveTo(0,6);
3560     pathB.cubicTo(0,1, 1,0, 5,4);
3561     pathB.close();
3562     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3563 }
3564 
cubicOp118(skiatest::Reporter * reporter,const char * filename)3565 static void cubicOp118(skiatest::Reporter* reporter, const char* filename) {
3566     SkPath path, pathB;
3567     path.setFillType(SkPath::kWinding_FillType);
3568     path.moveTo(0,1);
3569     path.cubicTo(4,6, 5,1, 6,2);
3570     path.close();
3571     pathB.setFillType(SkPath::kWinding_FillType);
3572     pathB.moveTo(1,5);
3573     pathB.cubicTo(2,6, 1,0, 6,4);
3574     pathB.close();
3575     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3576 }
3577 
loop1(skiatest::Reporter * reporter,const char * filename)3578 static void loop1(skiatest::Reporter* reporter, const char* filename) {
3579     SkPath path, pathB;
3580     path.moveTo(0,1);
3581     path.cubicTo(1,5, -5.66666651f,3.33333349f, 8.83333302f,2.33333349f);
3582     path.close();
3583     pathB.moveTo(1,5);
3584     pathB.cubicTo(-5.66666651f,3.33333349f, 8.83333302f,2.33333349f, 0,1);
3585     pathB.close();
3586     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3587 }
3588 
3589 #include "SkPathOpsCubic.h"
3590 
loop1asQuad(skiatest::Reporter * reporter,const char * filename)3591 static void loop1asQuad(skiatest::Reporter* reporter, const char* filename) {
3592     SkDCubic c1 = {{{0,1}, {1,5}, {-5.66666651f,3.33333349f}, {8.83333302f,2.33333349f}}};
3593     SkDCubic c2 = {{{1,5}, {-5.66666651f,3.33333349f}, {8.83333302f,2.33333349f}, {0,1}}};
3594     double c1InflectionTs[2], c2InflectionTs[2];
3595     SkDEBUGCODE(int c1InfTCount =) c1.findInflections(c1InflectionTs);
3596     SkASSERT(c1InfTCount == 2);
3597     SkDEBUGCODE(int c2InfTCount =) c2.findInflections(c2InflectionTs);
3598     SkASSERT(c2InfTCount == 1);
3599     SkASSERT(c1InflectionTs[0] > c1InflectionTs[1]);
3600     SkDCubicPair c1pair = c1.chopAt(c1InflectionTs[0]);
3601     SkDCubicPair c1apair = c1pair.first().chopAt(c1InflectionTs[1]);
3602     SkDCubicPair c2pair = c2.chopAt(c2InflectionTs[0]);
3603     SkDQuad q1[2] = { c1pair.first().toQuad(), c1pair.second().toQuad() };
3604     SkDQuad q1a[2] = { c1apair.first().toQuad(), c1apair.second().toQuad() };
3605     SkDQuad q2[2] = { c2pair.first().toQuad(), c2pair.second().toQuad() };
3606     SkPath path, pathB;
3607     path.moveTo(q1a[0].fPts[0].asSkPoint());
3608     path.quadTo(q1a[0].fPts[1].asSkPoint(), q1a[0].fPts[2].asSkPoint());
3609     path.quadTo(q1a[1].fPts[1].asSkPoint(), q1a[1].fPts[2].asSkPoint());
3610     path.quadTo(q1[1].fPts[1].asSkPoint(), q1[1].fPts[2].asSkPoint());
3611     path.close();
3612     pathB.moveTo(q2[0].fPts[0].asSkPoint());
3613     pathB.quadTo(q2[0].fPts[1].asSkPoint(), q2[0].fPts[2].asSkPoint());
3614     pathB.quadTo(q2[1].fPts[1].asSkPoint(), q2[1].fPts[2].asSkPoint());
3615     pathB.close();
3616     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3617 }
3618 
loop2(skiatest::Reporter * reporter,const char * filename)3619 static void loop2(skiatest::Reporter* reporter, const char* filename) {
3620     SkPath path, pathB;
3621     path.moveTo(0,1);
3622     path.cubicTo(3,4, 3.f,4.f, 4.5f,1.5f);
3623     path.close();
3624     pathB.moveTo(3,4);
3625     pathB.cubicTo(3.f,4.f, 4.5f,1.5f, 0,1);
3626     pathB.close();
3627     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3628 }
3629 
loop3(skiatest::Reporter * reporter,const char * filename)3630 static void loop3(skiatest::Reporter* reporter, const char* filename) {
3631     SkPath path, pathB;
3632     path.moveTo(0,1);
3633     path.cubicTo(3,5, -3.66666651f,0, 10.5f,-1.66666651f);
3634     path.close();
3635     pathB.moveTo(3,5);
3636     pathB.cubicTo(-3.66666651f,0, 10.5f,-1.66666651f, 0,1);
3637     pathB.close();
3638     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3639 }
3640 
loop4(skiatest::Reporter * reporter,const char * filename)3641 static void loop4(skiatest::Reporter* reporter, const char* filename) {
3642     SkPath path, pathB;
3643     path.moveTo(0,5);
3644     path.cubicTo(1,5, 1,4, 0.833333313f,3);
3645     path.close();
3646     pathB.moveTo(1,5);
3647     pathB.cubicTo(1,4, 0.833333313f,3, 0,5);
3648     pathB.close();
3649     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3650 }
3651 
3652 #include "SkParsePath.h"
3653 
issue3517(skiatest::Reporter * reporter,const char * filename)3654 static void issue3517(skiatest::Reporter* reporter, const char* filename) {
3655     SkPath path, pathB;
3656 
3657     const char str[] = "M31.35 57.75L31.35 57.75C31.9 57.7486 32.45 57.7948 33 57.7413C33.55 57.6878 34.1 57.5014 34.65 57.4291C35.2 57.3569 35.75 57.3223 36.3 57.3079C36.85 57.2935 37.4 57.3143 37.95 57.3428C38.5 57.3712 39.05 57.4112 39.6 57.4786C40.15 57.546 40.7 57.7029 41.25 57.7472C41.8 57.7916 42.35 57.7962 42.9 57.7445C43.45 57.6928 44 57.5345 44.55 57.4373C45.1 57.34 45.65 57.2115 46.2 57.1611C46.75 57.1107 47.3 57.1371 47.85 57.1349C48.4 57.1327 48.95 57.144 49.5 57.1478C50.05 57.1516 50.6 57.1553 51.15 57.1579C51.7 57.1605 52.25 57.1601 52.8 57.1634C53.35 57.1667 53.9 57.1731 54.45 57.1776C55 57.182 55.55 57.1916 56.1 57.19C56.65 57.1884 57.2 57.178 57.75 57.168C58.3 57.158 58.85 57.1355 59.4 57.1299C59.95 57.1243 60.5 57.1338 61.05 57.1345C61.6 57.1352 62.15 57.124 62.7 57.134C63.25 57.1441 63.8 57.1731 64.35 57.195C64.9 57.2169 65.45 57.2532 66 57.2655C66.55 57.2778 67.1 57.2647 67.65 57.2687C68.2 57.2728 68.75 57.267 69.3 57.2896C69.85 57.3122 70.4 57.371 70.95 57.4044C71.5 57.4377 72.05 57.4668 72.6 57.4896C73.15 57.5123 73.7 57.545 74.25 57.5408C74.8 57.5365 75.35 57.5068 75.9 57.4641C76.45 57.4213 77 57.3244 77.55 57.2842C78.1 57.244 78.65 57.2163 79.2 57.2228C79.75 57.2293 80.3 57.29 80.85 57.3232C81.4 57.3563 81.95 57.396 82.5 57.4219C83.05 57.4478 83.6 57.4637 84.15 57.4787C84.7 57.4937 85.25 57.5011 85.8 57.5121C86.35 57.523 86.9 57.5411 87.45 57.5444C88 57.5477 88.55 57.5663 89.1 57.5318C89.65 57.4972 90.2 57.3126 90.75 57.337C91.3 57.3613 91.85 57.6088 92.4 57.6776C92.95 57.7465 93.5 57.7379 94.05 57.75C94.6 57.7621 95.15 57.75 95.7 57.75L95.7 57.75L31.35 57.75Z";
3658     SkParsePath::FromSVGString(str, &path);
3659 
3660     const char strB[] = "M31.35 57.75L31.35 57.75C31.9 57.7514 32.45 57.7052 33 57.7587C33.55 57.8122 34.1 57.9986 34.65 58.0709C35.2 58.1431 35.75 58.1777 36.3 58.1921C36.85 58.2065 37.4 58.1857 37.95 58.1572C38.5 58.1288 39.05 58.0888 39.6 58.0214C40.15 57.954 40.7 57.7971 41.25 57.7528C41.8 57.7084 42.35 57.7038 42.9 57.7555C43.45 57.8072 44 57.9655 44.55 58.0627C45.1 58.16 45.65 58.2885 46.2 58.3389C46.75 58.3893 47.3 58.3629 47.85 58.3651C48.4 58.3673 48.95 58.356 49.5 58.3522C50.05 58.3484 50.6 58.3447 51.15 58.3421C51.7 58.3395 52.25 58.3399 52.8 58.3366C53.35 58.3333 53.9 58.3269 54.45 58.3224C55 58.318 55.55 58.3084 56.1 58.31C56.65 58.3116 57.2 58.322 57.75 58.332C58.3 58.342 58.85 58.3645 59.4 58.3701C59.95 58.3757 60.5 58.3662 61.05 58.3655C61.6 58.3648 62.15 58.376 62.7 58.366C63.25 58.3559 63.8 58.3269 64.35 58.305C64.9 58.2831 65.45 58.2468 66 58.2345C66.55 58.2222 67.1 58.2353 67.65 58.2313C68.2 58.2272 68.75 58.233 69.3 58.2104C69.85 58.1878 70.4 58.129 70.95 58.0956C71.5 58.0623 72.05 58.0332 72.6 58.0104C73.15 57.9877 73.7 57.955 74.25 57.9592C74.8 57.9635 75.35 57.9932 75.9 58.0359C76.45 58.0787 77 58.1756 77.55 58.2158C78.1 58.256 78.65 58.2837 79.2 58.2772C79.75 58.2707 80.3 58.21 80.85 58.1768C81.4 58.1437 81.95 58.104 82.5 58.0781C83.05 58.0522 83.6 58.0363 84.15 58.0213C84.7 58.0063 85.25 57.9989 85.8 57.9879C86.35 57.977 86.9 57.9589 87.45 57.9556C88 57.9523 88.55 57.9337 89.1 57.9682C89.65 58.0028 90.2 58.1874 90.75 58.163C91.3 58.1387 91.85 57.8912 92.4 57.8224C92.95 57.7535 93.5 57.7621 94.05 57.75C94.6 57.7379 95.15 57.75 95.7 57.75L95.7 57.75L31.35 57.75Z";
3661     SkParsePath::FromSVGString(strB, &pathB);
3662     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
3663 }
3664 
cubicOp119(skiatest::Reporter * reporter,const char * filename)3665 static void cubicOp119(skiatest::Reporter* reporter, const char* filename) {
3666     SkPath path, pathB;
3667     path.setFillType(SkPath::kWinding_FillType);
3668     path.moveTo(0,1);
3669     path.cubicTo(3,5, 2,1, 3,1);
3670     path.close();
3671     pathB.setFillType(SkPath::kWinding_FillType);
3672     pathB.moveTo(1,2);
3673     pathB.cubicTo(1,3, 1,0, 5,3);
3674     pathB.close();
3675     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3676 }
3677 
cubicOp120(skiatest::Reporter * reporter,const char * filename)3678 static void cubicOp120(skiatest::Reporter* reporter, const char* filename) {
3679     SkPath path, pathB;
3680     path.setFillType(SkPath::kWinding_FillType);
3681     path.moveTo(0,1);
3682     path.cubicTo(2,4, 2,1, 4,0);
3683     path.close();
3684     pathB.setFillType(SkPath::kWinding_FillType);
3685     pathB.moveTo(1,2);
3686     pathB.cubicTo(0,4, 1,0, 4,2);
3687     pathB.close();
3688     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3689 }
3690 
cubicOp121(skiatest::Reporter * reporter,const char * filename)3691 static void cubicOp121(skiatest::Reporter* reporter, const char* filename) {
3692     SkPath path, pathB;
3693     path.setFillType(SkPath::kWinding_FillType);
3694     path.moveTo(0,1);
3695     path.cubicTo(3,4, 3,2, 4,3);
3696     path.close();
3697     pathB.setFillType(SkPath::kWinding_FillType);
3698     pathB.moveTo(2,3);
3699     pathB.cubicTo(3,4, 1,0, 4,3);
3700     pathB.close();
3701     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3702 }
3703 
3704 // FIXME : haven't debugged this failure yet
cubicOp122(skiatest::Reporter * reporter,const char * filename)3705 static void cubicOp122(skiatest::Reporter* reporter, const char* filename) {
3706     SkPath path, pathB;
3707     path.setFillType(SkPath::kWinding_FillType);
3708     path.moveTo(0,1);
3709     path.cubicTo(3,5, 4,1, 4,0);
3710     path.close();
3711     pathB.setFillType(SkPath::kWinding_FillType);
3712     pathB.moveTo(1,4);
3713     pathB.cubicTo(0,4, 1,0, 5,3);
3714     pathB.close();
3715     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3716 }
3717 
cubicOp123(skiatest::Reporter * reporter,const char * filename)3718 static void cubicOp123(skiatest::Reporter* reporter, const char* filename) {
3719     SkPath path, pathB;
3720     path.setFillType(SkPath::kWinding_FillType);
3721     path.moveTo(0,1);
3722     path.cubicTo(1,5, 2,0, 6,0);
3723     path.close();
3724     pathB.setFillType(SkPath::kWinding_FillType);
3725     pathB.moveTo(0,2);
3726     pathB.cubicTo(0,6, 1,0, 5,1);
3727     pathB.close();
3728     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3729 }
3730 
loop5(skiatest::Reporter * reporter,const char * filename)3731 static void loop5(skiatest::Reporter* reporter, const char* filename) {
3732     SkPath path, pathB;
3733     path.moveTo(0,2);
3734     path.cubicTo(1,2, 1,1.66666663f, 0.833333313f,1.33333325f);
3735     path.close();
3736     pathB.moveTo(1,2);
3737     pathB.cubicTo(1,1.66666663f, 0.833333313f,1.33333325f, 0,2);
3738     pathB.close();
3739     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3740 }
3741 
loop6(skiatest::Reporter * reporter,const char * filename)3742 static void loop6(skiatest::Reporter* reporter, const char* filename) {
3743     SkPath path, pathB;
3744     path.moveTo(0,1);
3745     path.cubicTo(1,3, -1.66666675f,1.66666663f, 4.16666651f,1.00000012f);
3746     path.close();
3747     pathB.moveTo(1,3);
3748     pathB.cubicTo(-1.66666675f,1.66666663f, 4.16666651f,1.00000012f, 0,1);
3749     pathB.close();
3750     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3751 }
3752 
cubicOp124(skiatest::Reporter * reporter,const char * filename)3753 static void cubicOp124(skiatest::Reporter* reporter, const char* filename) {
3754     SkPath path, pathB;
3755     path.setFillType(SkPath::kWinding_FillType);
3756     path.moveTo(0,1);
3757     path.cubicTo(1,5, 6,0, 3,0);
3758     path.close();
3759     pathB.setFillType(SkPath::kWinding_FillType);
3760     pathB.moveTo(0,6);
3761     pathB.cubicTo(0,3, 1,0, 5,1);
3762     pathB.close();
3763     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3764 }
3765 
cubicOp125(skiatest::Reporter * reporter,const char * filename)3766 static void cubicOp125(skiatest::Reporter* reporter, const char* filename) {
3767     SkPath path, pathB;
3768     path.setFillType(SkPath::kWinding_FillType);
3769     path.moveTo(0,1);
3770     path.cubicTo(3,6, 3,1, 6,2);
3771     path.close();
3772     pathB.setFillType(SkPath::kWinding_FillType);
3773     pathB.moveTo(1,3);
3774     pathB.cubicTo(2,6, 1,0, 6,3);
3775     pathB.close();
3776     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3777 }
3778 
cubicOp126(skiatest::Reporter * reporter,const char * filename)3779 static void cubicOp126(skiatest::Reporter* reporter, const char* filename) {
3780     SkPath path, pathB;
3781     path.setFillType(SkPath::kWinding_FillType);
3782     path.moveTo(0,1);
3783     path.cubicTo(0,3, 6,0, 2,1);
3784     path.close();
3785     pathB.setFillType(SkPath::kWinding_FillType);
3786     pathB.moveTo(0,6);
3787     pathB.cubicTo(1,2, 1,0, 3,0);
3788     pathB.close();
3789     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3790 }
3791 
cubicOp127(skiatest::Reporter * reporter,const char * filename)3792 static void cubicOp127(skiatest::Reporter* reporter, const char* filename) {
3793     SkPath path, pathB;
3794     path.setFillType(SkPath::kWinding_FillType);
3795     path.moveTo(0,1);
3796     path.cubicTo(1,5, 6,0, 3,0);
3797     path.close();
3798     pathB.setFillType(SkPath::kWinding_FillType);
3799     pathB.moveTo(0,6);
3800     pathB.cubicTo(0,3, 1,0, 5,1);
3801     pathB.close();
3802     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3803 }
3804 
cubicOp128(skiatest::Reporter * reporter,const char * filename)3805 static void cubicOp128(skiatest::Reporter* reporter, const char* filename) {
3806     SkPath path, pathB;
3807     path.setFillType(SkPath::kWinding_FillType);
3808     path.moveTo(0,1);
3809     path.cubicTo(0,3, 3,2, 5,2);
3810     path.close();
3811     pathB.setFillType(SkPath::kWinding_FillType);
3812     pathB.moveTo(2,3);
3813     pathB.cubicTo(2,5, 1,0, 3,0);
3814     pathB.close();
3815     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3816 }
3817 
cubicOp129(skiatest::Reporter * reporter,const char * filename)3818 static void cubicOp129(skiatest::Reporter* reporter, const char* filename) {
3819     SkPath path, pathB;
3820     path.setFillType(SkPath::kWinding_FillType);
3821     path.moveTo(5,6);
3822     path.cubicTo(3,4, 2,0, 2,1);
3823     path.close();
3824     pathB.setFillType(SkPath::kWinding_FillType);
3825     pathB.moveTo(0,2);
3826     pathB.cubicTo(1,2, 6,5, 4,3);
3827     pathB.close();
3828     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3829 }
3830 
cubicOp130(skiatest::Reporter * reporter,const char * filename)3831 static void cubicOp130(skiatest::Reporter* reporter, const char* filename) {
3832     SkPath path, pathB;
3833     path.setFillType(SkPath::kWinding_FillType);
3834     path.moveTo(5,6);
3835     path.cubicTo(4,6, 3,0, 2,1);
3836     path.close();
3837     pathB.setFillType(SkPath::kWinding_FillType);
3838     pathB.moveTo(0,3);
3839     pathB.cubicTo(1,2, 6,5, 6,4);
3840     pathB.close();
3841     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3842 }
3843 
3844 #include "SkGeometry.h"
3845 
complex_to_quads(const SkPoint pts[],SkPath * path)3846 static void complex_to_quads(const SkPoint pts[], SkPath* path) {
3847     SkScalar loopT;
3848     if (SkDCubic::ComplexBreak(pts, &loopT)) {
3849         SkPoint cubicPair[7];
3850         SkChopCubicAt(pts, cubicPair, loopT);
3851         SkDCubic c1, c2;
3852         c1.set(cubicPair);
3853         c2.set(&cubicPair[3]);
3854         SkDQuad q1 = c1.toQuad();
3855         SkDQuad q2 = c2.toQuad();
3856         path->quadTo(q1[1].asSkPoint(), q1[2].asSkPoint());
3857         path->quadTo(q2[1].asSkPoint(), q2[2].asSkPoint());
3858     } else {
3859         path->cubicTo(pts[1], pts[2], pts[3]);
3860     }
3861 }
3862 
cubicOp130a(skiatest::Reporter * reporter,const char * filename)3863 static void cubicOp130a(skiatest::Reporter* reporter, const char* filename) {
3864     SkPath path, pathB;
3865     path.setFillType(SkPath::kWinding_FillType);
3866     path.moveTo(5,6);
3867     SkPoint pts[] = { {5,6}, {4,6}, {3,0}, {2,1} };
3868     complex_to_quads(pts, &path);
3869     path.close();
3870     pathB.setFillType(SkPath::kWinding_FillType);
3871     pathB.moveTo(0,3);
3872     SkPoint pts2[] = { {0,3}, {1,2}, {6,5}, {6,4} };
3873     complex_to_quads(pts2, &path);
3874     pathB.close();
3875     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3876 }
3877 
cubicOp131(skiatest::Reporter * reporter,const char * filename)3878 static void cubicOp131(skiatest::Reporter* reporter, const char* filename) {
3879     SkPath path, pathB;
3880     path.setFillType(SkPath::kWinding_FillType);
3881     path.moveTo(0,1);
3882     path.cubicTo(3,4, 3,0, 6,2);
3883     path.close();
3884     pathB.setFillType(SkPath::kWinding_FillType);
3885     pathB.moveTo(0,3);
3886     pathB.cubicTo(2,6, 1,0, 4,3);
3887     pathB.close();
3888     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3889 }
3890 
circlesOp1(skiatest::Reporter * reporter,const char * filename)3891 static void circlesOp1(skiatest::Reporter* reporter, const char* filename) {
3892     SkPath path, pathB;
3893     path.setFillType(SkPath::kWinding_FillType);
3894     path.addCircle(0, 1, 2, SkPath::kCCW_Direction);
3895     pathB.setFillType(SkPath::kWinding_FillType);
3896     pathB.addCircle(0, 1, 1, SkPath::kCW_Direction);
3897     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3898 }
3899 
circlesOp2(skiatest::Reporter * reporter,const char * filename)3900 static void circlesOp2(skiatest::Reporter* reporter, const char* filename) {
3901     SkPath path, pathB;
3902     path.setFillType(SkPath::kWinding_FillType);
3903     path.addCircle(0, 1, 4, SkPath::kCCW_Direction);
3904     pathB.setFillType(SkPath::kWinding_FillType);
3905     pathB.addCircle(0, 4, 3, SkPath::kCW_Direction);
3906     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3907 }
3908 
rRect1x(skiatest::Reporter * reporter,const char * filename)3909 static void rRect1x(skiatest::Reporter* reporter, const char* filename) {
3910     SkPath path, pathB;
3911     path.setFillType(SkPath::kEvenOdd_FillType);
3912     path.moveTo(20.65f, 5.65f);
3913     path.conicTo(20.65f, 1.13612f, 25.1404f, 0.65f, 0.888488f);
3914     path.lineTo(25.65f, 0.65f);
3915     path.lineTo(26.1596f, 0.67604f);
3916     path.conicTo(30.65f, 1.13612f, 30.65f, 5.65f, 0.888488f);
3917     path.lineTo(30.65f, 25.65f);
3918     path.conicTo(30.65f, 20.65f, 25.65f, 20.65f, 0.707107f);
3919     path.lineTo(20.65f, 20.65f);
3920     path.lineTo(20.65f, 5.65f);
3921     path.close();
3922     path.moveTo(20.65f, 20.65f);
3923     path.lineTo(5.65f, 20.65f);
3924     path.conicTo(0.65f, 20.65f, 0.65f, 25.65f, 0.707107f);
3925     path.lineTo(0.65f, 45.65f);
3926     path.conicTo(0.65f, 50.65f, 5.65f, 50.65f, 0.707107f);
3927     path.lineTo(25.65f, 50.65f);
3928     path.conicTo(30.65f, 50.65f, 30.65f, 45.65f, 0.707107f);
3929     path.lineTo(30.65f, 25.65f);
3930     path.conicTo(30.65f, 30.65f, 25.65f, 30.65f, 0.707107f);
3931     path.conicTo(20.65f, 30.65f, 20.65f, 25.65f, 0.707107f);
3932     path.lineTo(20.65f, 20.65f);
3933     path.close();
3934     SkPath path1(path);
3935 
3936     path.reset();
3937     path.setFillType(SkPath::kWinding_FillType);
3938     path.moveTo(20.65f, 45.65f);
3939     path.lineTo(20.65f, 25.65f);
3940     path.conicTo(20.65f, 20.65f, 25.65f, 20.65f, 0.707107f);
3941     path.lineTo(45.65f, 20.65f);
3942     path.conicTo(50.65f, 20.65f, 50.65f, 25.65f, 0.707107f);
3943     path.lineTo(50.65f, 45.65f);
3944     path.conicTo(50.65f, 50.65f, 45.65f, 50.65f, 0.707107f);
3945     path.lineTo(25.65f, 50.65f);
3946     path.conicTo(20.65f, 50.65f, 20.65f, 45.65f, 0.707107f);
3947     path.close();
3948     SkPath path2(path);
3949 
3950     testPathOp(reporter, path1, path2, kDifference_SkPathOp, filename);
3951 }
3952 
loop7(skiatest::Reporter * reporter,const char * filename)3953 static void loop7(skiatest::Reporter* reporter, const char* filename) {
3954     SkPath path, pathB;
3955     path.moveTo(0,1);
3956     path.cubicTo(3,4, -1,0, 8.5f,-2.5f);
3957     path.close();
3958     pathB.moveTo(3,4);
3959     pathB.cubicTo(-1,0, 8.5f,-2.5f, 0,1);
3960     pathB.close();
3961     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3962 }
3963 
rects5(skiatest::Reporter * reporter,const char * filename)3964 static void rects5(skiatest::Reporter* reporter, const char* filename) {
3965     SkPath path, pathB;
3966     path.setFillType(SkPath::kWinding_FillType);
3967     path.addRect(5, 5, 6, 6, SkPath::kCW_Direction);
3968     path.addRect(5, 5, 6, 6, SkPath::kCW_Direction);
3969     pathB.setFillType(SkPath::kEvenOdd_FillType);
3970     pathB.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
3971     pathB.addRect(5, 5, 6, 6, SkPath::kCW_Direction);
3972     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3973 }
3974 
loop8(skiatest::Reporter * reporter,const char * filename)3975 static void loop8(skiatest::Reporter* reporter, const char* filename) {
3976     SkPath path, pathB;
3977     path.moveTo(0,1);
3978     path.cubicTo(1,4, -3.83333325f,0.166666627f, 6,-1);
3979     path.close();
3980     pathB.moveTo(1,4);
3981     pathB.cubicTo(-3.83333325f,0.166666627f, 6,-1, 0,1);
3982     pathB.close();
3983     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3984 }
3985 
loop9(skiatest::Reporter * reporter,const char * filename)3986 static void loop9(skiatest::Reporter* reporter, const char* filename) {
3987     SkPath path, pathB;
3988     path.moveTo(0,1);
3989     path.cubicTo(1,3, -2.5f,0, 3.33333325f,-0.666666627f);
3990     path.close();
3991     pathB.moveTo(1,3);
3992     pathB.cubicTo(-2.5f,0, 3.33333325f,-0.666666627f, 0,1);
3993     pathB.close();
3994     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3995 }
3996 
circlesOp3(skiatest::Reporter * reporter,const char * filename)3997 static void circlesOp3(skiatest::Reporter* reporter, const char* filename) {
3998     SkPath path, pathB;
3999     path.setFillType(SkPath::kWinding_FillType);
4000     path.addCircle(0, 1, 2, SkPath::kCCW_Direction);
4001     pathB.setFillType(SkPath::kWinding_FillType);
4002     pathB.addCircle(3, 5, 3, SkPath::kCW_Direction);
4003     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4004 }
4005 
loop10(skiatest::Reporter * reporter,const char * filename)4006 static void loop10(skiatest::Reporter* reporter, const char* filename) {
4007     SkPath path, pathB;
4008     path.moveTo(5,6);
4009     path.cubicTo(1,2, 1,2, -3.66666651f,13.333334f);
4010     path.close();
4011     pathB.moveTo(1,2);
4012     pathB.cubicTo(1,2, -3.66666651f,13.333334f, 5,6);
4013     pathB.close();
4014     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4015 }
4016 
loop11(skiatest::Reporter * reporter,const char * filename)4017 static void loop11(skiatest::Reporter* reporter, const char* filename) {
4018     SkPath path, pathB;
4019     path.moveTo(0,1);
4020     path.cubicTo(1,3, -1.83333349f,1.33333337f, 4,-1);
4021     path.close();
4022     pathB.moveTo(1,3);
4023     pathB.cubicTo(-1.83333349f,1.33333337f, 4,-1, 0,1);
4024     pathB.close();
4025     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4026 }
4027 
cubicOp132(skiatest::Reporter * reporter,const char * filename)4028 static void cubicOp132(skiatest::Reporter* reporter, const char* filename) {
4029     SkPath path, pathB;
4030     path.setFillType(SkPath::kWinding_FillType);
4031     path.moveTo(5,6);
4032     path.cubicTo(3,4, 3,0, 3,2);
4033     path.close();
4034     pathB.setFillType(SkPath::kWinding_FillType);
4035     pathB.moveTo(0,3);
4036     pathB.cubicTo(2,3, 6,5, 4,3);
4037     pathB.close();
4038     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4039 }
4040 
loop12(skiatest::Reporter * reporter,const char * filename)4041 static void loop12(skiatest::Reporter* reporter, const char* filename) {
4042     SkPath path, pathB;
4043     path.moveTo(1,2);
4044     path.cubicTo(0,6, -3.16666675f,3.66666675f, 6.33333349f,3.33333349f);
4045     path.close();
4046     pathB.moveTo(0,6);
4047     pathB.cubicTo(-3.16666675f,3.66666675f, 6.33333349f,3.33333349f, 1,2);
4048     pathB.close();
4049     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4050 }
4051 
cubicOp133(skiatest::Reporter * reporter,const char * filename)4052 static void cubicOp133(skiatest::Reporter* reporter, const char* filename) {
4053     SkPath path, pathB;
4054     path.setFillType(SkPath::kWinding_FillType);
4055     path.moveTo(5,6);
4056     path.cubicTo(5,6, 5,0, 4,1);
4057     path.close();
4058     pathB.setFillType(SkPath::kWinding_FillType);
4059     pathB.moveTo(0,5);
4060     pathB.cubicTo(1,4, 6,5, 6,5);
4061     pathB.close();
4062     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4063 }
4064 
cubicOp134(skiatest::Reporter * reporter,const char * filename)4065 static void cubicOp134(skiatest::Reporter* reporter, const char* filename) {
4066     SkPath path, pathB;
4067     path.setFillType(SkPath::kWinding_FillType);
4068     path.moveTo(5,6);
4069     path.cubicTo(5,6, 6,0, 3,1);
4070     path.close();
4071     pathB.setFillType(SkPath::kWinding_FillType);
4072     pathB.moveTo(0,6);
4073     pathB.cubicTo(1,3, 6,5, 6,5);
4074     pathB.close();
4075     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4076 }
4077 
cubicOp135(skiatest::Reporter * reporter,const char * filename)4078 static void cubicOp135(skiatest::Reporter* reporter, const char* filename) {
4079     SkPath path, pathB;
4080     path.setFillType(SkPath::kWinding_FillType);
4081     path.moveTo(5,6);
4082     path.cubicTo(5,6, 6,0, 4,1);
4083     path.close();
4084     pathB.setFillType(SkPath::kWinding_FillType);
4085     pathB.moveTo(0,6);
4086     pathB.cubicTo(1,4, 6,5, 6,5);
4087     pathB.close();
4088     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4089 }
4090 
cubicOp136(skiatest::Reporter * reporter,const char * filename)4091 static void cubicOp136(skiatest::Reporter* reporter, const char* filename) {
4092     SkPath path, pathB;
4093     path.setFillType(SkPath::kWinding_FillType);
4094     path.moveTo(5,6);
4095     path.cubicTo(5,6, 5,0, 3,1);
4096     path.close();
4097     pathB.setFillType(SkPath::kWinding_FillType);
4098     pathB.moveTo(0,5);
4099     pathB.cubicTo(1,3, 6,5, 6,5);
4100     pathB.close();
4101     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4102 }
4103 
cubicOp136a(skiatest::Reporter * reporter,const char * filename)4104 static void cubicOp136a(skiatest::Reporter* reporter, const char* filename) {
4105     SkPath path, pathB;
4106     path.setFillType(SkPath::kWinding_FillType);
4107     path.moveTo(5,6);
4108     path.quadTo(5,0, 3,1);
4109     path.close();
4110     pathB.setFillType(SkPath::kWinding_FillType);
4111     pathB.moveTo(0,5);
4112     pathB.cubicTo(1,3, 6,5, 6,5);
4113     pathB.close();
4114     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4115 }
4116 
cubics137(skiatest::Reporter * reporter,const char * filename)4117 static void cubics137(skiatest::Reporter* reporter, const char* filename) {
4118     SkPath path, pathB;
4119     path.setFillType(SkPath::kWinding_FillType);
4120     path.moveTo(0, 5);
4121     path.cubicTo(3, 6, 1, 0, 3, 2);
4122     path.close();
4123     pathB.setFillType(SkPath::kWinding_FillType);
4124     pathB.moveTo(0, 1);
4125     pathB.cubicTo(2, 3, 5, 0, 6, 3);
4126     pathB.close();
4127     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4128 }
4129 
cubics138(skiatest::Reporter * reporter,const char * filename)4130 static void cubics138(skiatest::Reporter* reporter, const char* filename) {
4131     SkPath path, pathB;
4132     path.setFillType(SkPath::kWinding_FillType);
4133     path.moveTo(0, 5);
4134     path.cubicTo(3, 6, 1, 0, 4, 2);
4135     path.close();
4136     pathB.setFillType(SkPath::kWinding_FillType);
4137     pathB.moveTo(0, 1);
4138     pathB.cubicTo(2, 4, 5, 0, 6, 3);
4139     pathB.close();
4140     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4141 }
4142 
4143 // three curves intersect successfully nearby -- the angle only gets 2 of the 3 pts
cubicOp139(skiatest::Reporter * reporter,const char * filename)4144 static void cubicOp139(skiatest::Reporter* reporter, const char* filename) {
4145     SkPath path, pathB;
4146     path.setFillType(SkPath::kWinding_FillType);
4147     path.moveTo(0,2);
4148     path.cubicTo(0,4, 3,1, 5,1);
4149     path.close();
4150     pathB.setFillType(SkPath::kWinding_FillType);
4151     pathB.moveTo(1,3);
4152     pathB.cubicTo(1,5, 2,0, 4,0);
4153     pathB.close();
4154     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4155 }
4156 
cubicOp140(skiatest::Reporter * reporter,const char * filename)4157 static void cubicOp140(skiatest::Reporter* reporter, const char* filename) {
4158     SkPath path, pathB;
4159     path.setFillType(SkPath::kWinding_FillType);
4160     path.moveTo(0,2);
4161     path.cubicTo(1,2, 5,4, 3,2);
4162     path.close();
4163     pathB.setFillType(SkPath::kWinding_FillType);
4164     pathB.moveTo(4,5);
4165     pathB.cubicTo(2,3, 2,0, 2,1);
4166     pathB.close();
4167     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4168 }
4169 
cubicOp141(skiatest::Reporter * reporter,const char * filename)4170 static void cubicOp141(skiatest::Reporter* reporter, const char* filename) {
4171     SkPath path, pathB;
4172     path.setFillType(SkPath::kWinding_FillType);
4173     path.moveTo(0,2);
4174     path.cubicTo(1,2, 6,4, 3,2);
4175     path.close();
4176     pathB.setFillType(SkPath::kWinding_FillType);
4177     pathB.moveTo(4,6);
4178     pathB.cubicTo(2,3, 2,0, 2,1);
4179     pathB.close();
4180     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4181 }
4182 
quadRect1(skiatest::Reporter * reporter,const char * filename)4183 static void quadRect1(skiatest::Reporter* reporter, const char* filename) {
4184     SkPath path, pathB;
4185     path.moveTo(6,15);
4186     path.quadTo(16,0, 8,4);
4187     path.quadTo(2,7, 12,12);
4188     path.close();
4189     pathB.addRect(4,11, 13,16);
4190     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4191 }
4192 
quadRect2(skiatest::Reporter * reporter,const char * filename)4193 static void quadRect2(skiatest::Reporter* reporter, const char* filename) {
4194     SkPath path, pathB;
4195     path.moveTo(5,12);
4196     path.quadTo(15,7, 9,4);
4197     path.quadTo(1,0, 11,15);
4198     path.close();
4199     pathB.addRect(4,11, 13,16);
4200     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4201 }
4202 
quadRect3(skiatest::Reporter * reporter,const char * filename)4203 static void quadRect3(skiatest::Reporter* reporter, const char* filename) {
4204     SkPath path, pathB;
4205     path.moveTo(12,12);
4206     path.quadTo(2,7, 8,4);
4207     path.quadTo(16,0, 6,15);
4208     path.close();
4209     pathB.addRect(4,11, 13,16);
4210     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4211 }
4212 
quadRect4(skiatest::Reporter * reporter,const char * filename)4213 static void quadRect4(skiatest::Reporter* reporter, const char* filename) {
4214     SkPath path, pathB;
4215     path.moveTo(11,15);
4216     path.quadTo(1,0, 9,4);
4217     path.quadTo(15,7, 5,12);
4218     path.close();
4219     pathB.addRect(4,11, 13,16);
4220     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4221 }
4222 
quadRect5(skiatest::Reporter * reporter,const char * filename)4223 static void quadRect5(skiatest::Reporter* reporter, const char* filename) {
4224     SkPath path, pathB;
4225     path.moveTo(11,13);
4226     path.quadTo(4,4, 8,4);
4227     path.quadTo(12,4, 5,13);
4228     path.close();
4229     pathB.addRect(4,11, 13,16);
4230     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4231 }
4232 
quadRect6(skiatest::Reporter * reporter,const char * filename)4233 static void quadRect6(skiatest::Reporter* reporter, const char* filename) {
4234     SkPath path, pathB;
4235     path.moveTo(5,13);
4236     path.quadTo(12,4, 8,4);
4237     path.quadTo(4,4, 11,13);
4238     path.close();
4239     pathB.addRect(4,11, 13,16);
4240     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4241 }
4242 
loops4i(skiatest::Reporter * reporter,const char * filename)4243 static void loops4i(skiatest::Reporter* reporter, const char* filename) {
4244     SkPath path, pathB;
4245     path.setFillType(SkPath::kWinding_FillType);
4246     path.moveTo(0, 3);
4247     path.cubicTo(0, 2, 0, 2, -1.66666663f, 2.16666675f);
4248     path.close();
4249     pathB.setFillType(SkPath::kWinding_FillType);
4250     pathB.moveTo(0, 2);
4251     pathB.cubicTo(0, 2, -1.66666663f, 2.16666675f, 0, 3);
4252     pathB.close();
4253     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4254 }
4255 
loops5i(skiatest::Reporter * reporter,const char * filename)4256 static void loops5i(skiatest::Reporter* reporter, const char* filename) {
4257     SkPath path, pathB;
4258     path.setFillType(SkPath::kWinding_FillType);
4259     path.moveTo(1, 2);
4260     path.cubicTo(0, 2, 0, 2, 0.166666672f, 2.66666675f);
4261     path.close();
4262     pathB.setFillType(SkPath::kWinding_FillType);
4263     pathB.moveTo(0, 2);
4264     pathB.cubicTo(0, 2, 0.166666672f, 2.66666675f, 1, 2);
4265     pathB.close();
4266     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4267 }
4268 
cubicOp142(skiatest::Reporter * reporter,const char * filename)4269 static void cubicOp142(skiatest::Reporter* reporter, const char* filename) {
4270     SkPath path, pathB;
4271     path.setFillType(SkPath::kWinding_FillType);
4272     path.moveTo(5,6);
4273     path.cubicTo(2,5, 2,1, 1,0);
4274     path.close();
4275     pathB.setFillType(SkPath::kWinding_FillType);
4276     pathB.moveTo(1,2);
4277     pathB.cubicTo(0,1, 6,5, 5,2);
4278     pathB.close();
4279     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4280 }
4281 
cubics6d(skiatest::Reporter * reporter,const char * filename)4282 static void cubics6d(skiatest::Reporter* reporter, const char* filename) {
4283     SkPath path, pathB;
4284     path.setFillType(SkPath::kWinding_FillType);
4285     path.moveTo(3, 5);
4286     path.cubicTo(1, 5, 4, 2, 4, 0);
4287     path.close();
4288     pathB.setFillType(SkPath::kWinding_FillType);
4289     pathB.moveTo(2, 4);
4290     pathB.cubicTo(0, 4, 5, 3, 5, 1);
4291     pathB.close();
4292     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4293 }
4294 
cubics7d(skiatest::Reporter * reporter,const char * filename)4295 static void cubics7d(skiatest::Reporter* reporter, const char* filename) {
4296     SkPath path, pathB;
4297     path.setFillType(SkPath::kWinding_FillType);
4298     path.moveTo(2, 6);
4299     path.cubicTo(2, 4, 5, 1, 3, 1);
4300     path.close();
4301     pathB.setFillType(SkPath::kWinding_FillType);
4302     pathB.moveTo(1, 5);
4303     pathB.cubicTo(1, 3, 6, 2, 4, 2);
4304     pathB.close();
4305     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4306 }
4307 
cubics8d(skiatest::Reporter * reporter,const char * filename)4308 static void cubics8d(skiatest::Reporter* reporter, const char* filename) {
4309     SkPath path, pathB;
4310     path.setFillType(SkPath::kWinding_FillType);
4311     path.moveTo(2, 5);
4312     path.cubicTo(2, 4, 5, 1, 3, 2);
4313     path.close();
4314     pathB.setFillType(SkPath::kWinding_FillType);
4315     pathB.moveTo(1, 5);
4316     pathB.cubicTo(2, 3, 5, 2, 4, 2);
4317     pathB.close();
4318     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4319 }
4320 
cubics9d(skiatest::Reporter * reporter,const char * filename)4321 static void cubics9d(skiatest::Reporter* reporter, const char* filename) {
4322     SkPath path, pathB;
4323     path.setFillType(SkPath::kWinding_FillType);
4324     path.moveTo(2, 4);
4325     path.cubicTo(2, 6, 3, 1, 5, 1);
4326     path.close();
4327     pathB.setFillType(SkPath::kWinding_FillType);
4328     pathB.moveTo(1, 3);
4329     pathB.cubicTo(1, 5, 4, 2, 6, 2);
4330     pathB.close();
4331     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4332 }
4333 
cubics10u(skiatest::Reporter * reporter,const char * filename)4334 static void cubics10u(skiatest::Reporter* reporter, const char* filename) {
4335     SkPath path, pathB;
4336     path.setFillType(SkPath::kWinding_FillType);
4337     path.moveTo(2, 4);
4338     path.cubicTo(1, 6, 4, 1, 5, 1);
4339     path.close();
4340     pathB.setFillType(SkPath::kWinding_FillType);
4341     pathB.moveTo(1, 4);
4342     pathB.cubicTo(1, 5, 4, 2, 6, 1);
4343     pathB.close();
4344     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
4345 }
4346 
cubics11i(skiatest::Reporter * reporter,const char * filename)4347 static void cubics11i(skiatest::Reporter* reporter, const char* filename) {
4348     SkPath path, pathB;
4349     path.setFillType(SkPath::kWinding_FillType);
4350     path.moveTo(2, 4);
4351     path.cubicTo(2, 5, 3, 2, 5, 1);
4352     path.close();
4353     pathB.setFillType(SkPath::kWinding_FillType);
4354     pathB.moveTo(2, 3);
4355     pathB.cubicTo(1, 5, 4, 2, 5, 2);
4356     pathB.close();
4357     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4358 }
4359 
cubics12d(skiatest::Reporter * reporter,const char * filename)4360 static void cubics12d(skiatest::Reporter* reporter, const char* filename) {
4361     SkPath path, pathB;
4362     path.setFillType(SkPath::kWinding_FillType);
4363     path.moveTo(2, 4);
4364     path.cubicTo(0, 4, 5, 3, 5, 1);
4365     path.close();
4366     pathB.setFillType(SkPath::kWinding_FillType);
4367     pathB.moveTo(3, 5);
4368     pathB.cubicTo(1, 5, 4, 2, 4, 0);
4369     pathB.close();
4370     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4371 }
4372 
cubics13d(skiatest::Reporter * reporter,const char * filename)4373 static void cubics13d(skiatest::Reporter* reporter, const char* filename) {
4374     SkPath path, pathB;
4375     path.setFillType(SkPath::kWinding_FillType);
4376     path.moveTo(2, 3);
4377     path.cubicTo(1, 5, 4, 2, 5, 2);
4378     path.close();
4379     pathB.setFillType(SkPath::kWinding_FillType);
4380     pathB.moveTo(2, 4);
4381     pathB.cubicTo(2, 5, 3, 2, 5, 1);
4382     pathB.close();
4383     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4384 }
4385 
cubics14d(skiatest::Reporter * reporter,const char * filename)4386 static void cubics14d(skiatest::Reporter* reporter, const char* filename) {
4387     SkPath path, pathB;
4388     path.setFillType(SkPath::kWinding_FillType);
4389     path.moveTo(2, 3);
4390     path.cubicTo(0, 4, 3, 1, 3, 0);
4391     path.close();
4392     pathB.setFillType(SkPath::kWinding_FillType);
4393     pathB.moveTo(1, 3);
4394     pathB.cubicTo(0, 3, 3, 2, 4, 0);
4395     pathB.close();
4396     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4397 }
4398 
cubics15d(skiatest::Reporter * reporter,const char * filename)4399 static void cubics15d(skiatest::Reporter* reporter, const char* filename) {
4400     SkPath path, pathB;
4401     path.setFillType(SkPath::kWinding_FillType);
4402     path.moveTo(1, 5);
4403     path.cubicTo(3, 5, 4, 0, 4, 2);
4404     path.close();
4405     pathB.setFillType(SkPath::kWinding_FillType);
4406     pathB.moveTo(0, 4);
4407     pathB.cubicTo(2, 4, 5, 1, 5, 3);
4408     pathB.close();
4409     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4410 }
4411 
cubics16i(skiatest::Reporter * reporter,const char * filename)4412 static void cubics16i(skiatest::Reporter* reporter, const char* filename) {
4413     SkPath path, pathB;
4414     path.setFillType(SkPath::kWinding_FillType);
4415     path.moveTo(1, 5);
4416     path.cubicTo(2, 5, 5, 0, 4, 2);
4417     path.close();
4418     pathB.setFillType(SkPath::kWinding_FillType);
4419     pathB.moveTo(0, 5);
4420     pathB.cubicTo(2, 4, 5, 1, 5, 2);
4421     pathB.close();
4422     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4423 }
4424 
cubics17d(skiatest::Reporter * reporter,const char * filename)4425 static void cubics17d(skiatest::Reporter* reporter, const char* filename) {
4426     SkPath path, pathB;
4427     path.setFillType(SkPath::kWinding_FillType);
4428     path.moveTo(1, 5);
4429     path.cubicTo(3, 4, 4, 1, 4, 2);
4430     path.close();
4431     pathB.setFillType(SkPath::kWinding_FillType);
4432     pathB.moveTo(1, 4);
4433     pathB.cubicTo(2, 4, 5, 1, 4, 3);
4434     pathB.close();
4435     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4436 }
4437 
cubics18d(skiatest::Reporter * reporter,const char * filename)4438 static void cubics18d(skiatest::Reporter* reporter, const char* filename) {
4439     SkPath path, pathB;
4440     path.setFillType(SkPath::kWinding_FillType);
4441     path.moveTo(1, 5);
4442     path.cubicTo(1, 3, 4, 0, 2, 0);
4443     path.close();
4444     pathB.setFillType(SkPath::kWinding_FillType);
4445     pathB.moveTo(0, 4);
4446     pathB.cubicTo(0, 2, 5, 1, 3, 1);
4447     pathB.close();
4448     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4449 }
4450 
cubics19d(skiatest::Reporter * reporter,const char * filename)4451 static void cubics19d(skiatest::Reporter* reporter, const char* filename) {
4452     SkPath path, pathB;
4453     path.setFillType(SkPath::kWinding_FillType);
4454     path.moveTo(1, 5);
4455     path.cubicTo(2, 3, 5, 2, 4, 2);
4456     path.close();
4457     pathB.setFillType(SkPath::kWinding_FillType);
4458     pathB.moveTo(2, 5);
4459     pathB.cubicTo(2, 4, 5, 1, 3, 2);
4460     pathB.close();
4461     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4462 }
4463 
cubicOp157(skiatest::Reporter * reporter,const char * filename)4464 static void cubicOp157(skiatest::Reporter* reporter, const char* filename) {
4465     SkPath path, pathB;
4466     path.setFillType(SkPath::kWinding_FillType);
4467     path.moveTo(1,5);
4468     path.cubicTo(1,3, 6,2, 4,2);
4469     path.close();
4470     pathB.setFillType(SkPath::kWinding_FillType);
4471     pathB.moveTo(2,6);
4472     pathB.cubicTo(2,4, 5,1, 3,1);
4473     pathB.close();
4474     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4475 }
4476 
cubics20d(skiatest::Reporter * reporter,const char * filename)4477 static void cubics20d(skiatest::Reporter* reporter, const char* filename) {
4478     SkPath path, pathB;
4479     path.setFillType(SkPath::kWinding_FillType);
4480     path.moveTo(1, 2);
4481     path.cubicTo(0, 3, 6, 0, 3, 2);
4482     path.close();
4483     pathB.setFillType(SkPath::kWinding_FillType);
4484     pathB.moveTo(0, 6);
4485     pathB.cubicTo(2, 3, 2, 1, 3, 0);
4486     pathB.close();
4487     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4488 }
4489 
loops20i(skiatest::Reporter * reporter,const char * filename)4490 static void loops20i(skiatest::Reporter* reporter, const char* filename) {
4491     SkPath path, pathB;
4492     path.setFillType(SkPath::kWinding_FillType);
4493     path.moveTo(1, 2);
4494     path.cubicTo(0, 2, 0.833333313f, 2, 1, 3.66666651f);
4495     path.close();
4496     pathB.setFillType(SkPath::kWinding_FillType);
4497     pathB.moveTo(0, 2);
4498     pathB.cubicTo(0.833333313f, 2, 1, 3.66666651f, 1, 2);
4499     pathB.close();
4500     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4501 }
4502 
loops21i(skiatest::Reporter * reporter,const char * filename)4503 static void loops21i(skiatest::Reporter* reporter, const char* filename) {
4504     SkPath path, pathB;
4505     path.setFillType(SkPath::kWinding_FillType);
4506     path.moveTo(1, 2);
4507     path.cubicTo(0, 2, 0.833333313f, 2, 1, 4);
4508     path.close();
4509     pathB.setFillType(SkPath::kWinding_FillType);
4510     pathB.moveTo(0, 2);
4511     pathB.cubicTo(0.833333313f, 2, 1, 4, 1, 2);
4512     pathB.close();
4513     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4514 }
4515 
loops22i(skiatest::Reporter * reporter,const char * filename)4516 static void loops22i(skiatest::Reporter* reporter, const char* filename) {
4517     SkPath path, pathB;
4518     path.setFillType(SkPath::kWinding_FillType);
4519     path.moveTo(1, 3);
4520     path.cubicTo(0, 3, 0.833333313f, 3, 1, 4.66666651f);
4521     path.close();
4522     pathB.setFillType(SkPath::kWinding_FillType);
4523     pathB.moveTo(0, 3);
4524     pathB.cubicTo(0.833333313f, 3, 1, 4.66666651f, 1, 3);
4525     pathB.close();
4526     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4527 }
4528 
loops23i(skiatest::Reporter * reporter,const char * filename)4529 static void loops23i(skiatest::Reporter* reporter, const char* filename) {
4530     SkPath path, pathB;
4531     path.setFillType(SkPath::kWinding_FillType);
4532     path.moveTo(1, 5);
4533     path.cubicTo(0, 1, 6.16666698f, 5.66666698f, -5.66666651f, 6.66666651f);
4534     path.close();
4535     pathB.setFillType(SkPath::kWinding_FillType);
4536     pathB.moveTo(0, 1);
4537     pathB.cubicTo(6.16666698f, 5.66666698f, -5.66666651f, 6.66666651f, 1, 5);
4538     pathB.close();
4539     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4540 }
4541 
loops24i(skiatest::Reporter * reporter,const char * filename)4542 static void loops24i(skiatest::Reporter* reporter, const char* filename) {
4543     SkPath path, pathB;
4544     path.setFillType(SkPath::kWinding_FillType);
4545     path.moveTo(1, 2);
4546     path.cubicTo(0, 2, 0.833333313f, 2, 1, 3);
4547     path.close();
4548     pathB.setFillType(SkPath::kWinding_FillType);
4549     pathB.moveTo(0, 2);
4550     pathB.cubicTo(0.833333313f, 2, 1, 3, 1, 2);
4551     pathB.close();
4552     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4553 }
4554 
loops25i(skiatest::Reporter * reporter,const char * filename)4555 static void loops25i(skiatest::Reporter* reporter, const char* filename) {
4556     SkPath path, pathB;
4557     path.setFillType(SkPath::kWinding_FillType);
4558     path.moveTo(1, 5);
4559     path.cubicTo(0, 5, 0.833333313f, 5, 1, 7);
4560     path.close();
4561     pathB.setFillType(SkPath::kWinding_FillType);
4562     pathB.moveTo(0, 5);
4563     pathB.cubicTo(0.833333313f, 5, 1, 7, 1, 5);
4564     pathB.close();
4565     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4566 }
4567 
loops26i(skiatest::Reporter * reporter,const char * filename)4568 static void loops26i(skiatest::Reporter* reporter, const char* filename) {
4569     SkPath path, pathB;
4570     path.setFillType(SkPath::kWinding_FillType);
4571     path.moveTo(1, 6);
4572     path.cubicTo(0, 2, 6.16666698f, 6.66666698f, -5.66666651f, 7.66666651f);
4573     path.close();
4574     pathB.setFillType(SkPath::kWinding_FillType);
4575     pathB.moveTo(0, 2);
4576     pathB.cubicTo(6.16666698f, 6.66666698f, -5.66666651f, 7.66666651f, 1, 6);
4577     pathB.close();
4578     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4579 }
4580 
loops27i(skiatest::Reporter * reporter,const char * filename)4581 static void loops27i(skiatest::Reporter* reporter, const char* filename) {
4582     SkPath path, pathB;
4583     path.setFillType(SkPath::kWinding_FillType);
4584     path.moveTo(1, 3);
4585     path.cubicTo(0, 3, 0.833333313f, 3, 1, 4.33333349f);
4586     path.close();
4587     pathB.setFillType(SkPath::kWinding_FillType);
4588     pathB.moveTo(0, 3);
4589     pathB.cubicTo(0.833333313f, 3, 1, 4.33333349f, 1, 3);
4590     pathB.close();
4591     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4592 }
4593 
loops28i(skiatest::Reporter * reporter,const char * filename)4594 static void loops28i(skiatest::Reporter* reporter, const char* filename) {
4595     SkPath path, pathB;
4596     path.setFillType(SkPath::kWinding_FillType);
4597     path.moveTo(2, 3);
4598     path.cubicTo(1, 3, 1.83333337f, 3, 2, 4.66666651f);
4599     path.close();
4600     pathB.setFillType(SkPath::kWinding_FillType);
4601     pathB.moveTo(1, 3);
4602     pathB.cubicTo(1.83333337f, 3, 2, 4.66666651f, 2, 3);
4603     pathB.close();
4604     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4605 }
4606 
loops29i(skiatest::Reporter * reporter,const char * filename)4607 static void loops29i(skiatest::Reporter* reporter, const char* filename) {
4608     SkPath path, pathB;
4609     path.setFillType(SkPath::kWinding_FillType);
4610     path.moveTo(2, 4);
4611     path.cubicTo(0, 4, 1.66666663f, 4, 2, 7.33333302f);
4612     path.close();
4613     pathB.setFillType(SkPath::kWinding_FillType);
4614     pathB.moveTo(0, 4);
4615     pathB.cubicTo(1.66666663f, 4, 2, 7.33333302f, 2, 4);
4616     pathB.close();
4617     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4618 }
4619 
loops30i(skiatest::Reporter * reporter,const char * filename)4620 static void loops30i(skiatest::Reporter* reporter, const char* filename) {
4621     SkPath path, pathB;
4622     path.setFillType(SkPath::kWinding_FillType);
4623     path.moveTo(2, 4);
4624     path.cubicTo(0, 4, 1.66666663f, 4, 2, 8);
4625     path.close();
4626     pathB.setFillType(SkPath::kWinding_FillType);
4627     pathB.moveTo(0, 4);
4628     pathB.cubicTo(1.66666663f, 4, 2, 8, 2, 4);
4629     pathB.close();
4630     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4631 }
4632 
loops31i(skiatest::Reporter * reporter,const char * filename)4633 static void loops31i(skiatest::Reporter* reporter, const char* filename) {
4634     SkPath path, pathB;
4635     path.setFillType(SkPath::kWinding_FillType);
4636     path.moveTo(2, 5);
4637     path.cubicTo(1, 5, 1.83333337f, 5, 2, 6.66666651f);
4638     path.close();
4639     pathB.setFillType(SkPath::kWinding_FillType);
4640     pathB.moveTo(1, 5);
4641     pathB.cubicTo(1.83333337f, 5, 2, 6.66666651f, 2, 5);
4642     pathB.close();
4643     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4644 }
4645 
loops32i(skiatest::Reporter * reporter,const char * filename)4646 static void loops32i(skiatest::Reporter* reporter, const char* filename) {
4647     SkPath path, pathB;
4648     path.setFillType(SkPath::kWinding_FillType);
4649     path.moveTo(2, 6);
4650     path.cubicTo(1, 6, 1.83333337f, 6, 2, 8);
4651     path.close();
4652     pathB.setFillType(SkPath::kWinding_FillType);
4653     pathB.moveTo(1, 6);
4654     pathB.cubicTo(1.83333337f, 6, 2, 8, 2, 6);
4655     pathB.close();
4656     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4657 }
4658 
loops33i(skiatest::Reporter * reporter,const char * filename)4659 static void loops33i(skiatest::Reporter* reporter, const char* filename) {
4660     SkPath path, pathB;
4661     path.setFillType(SkPath::kWinding_FillType);
4662     path.moveTo(2, 6);
4663     path.cubicTo(1, 2, 7.16666698f, 6.66666698f, -4.66666651f, 7.66666651f);
4664     path.close();
4665     pathB.setFillType(SkPath::kWinding_FillType);
4666     pathB.moveTo(1, 2);
4667     pathB.cubicTo(7.16666698f, 6.66666698f, -4.66666651f, 7.66666651f, 2, 6);
4668     pathB.close();
4669     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4670 }
4671 
loops33iMod(skiatest::Reporter * reporter,const char * filename)4672 static void loops33iMod(skiatest::Reporter* reporter, const char* filename) {
4673     SkPoint pts[] = {{2, 6}, {1, 2}, {7.16666698f, 6.66666698f}, {-4.66666651f, 7.66666651f},
4674                      {1, 2}, {7.16666698f, 6.66666698f}, {-4.66666651f, 7.66666651f}, {2, 6}};
4675     bool up = false;
4676     float offset = 0.0380172729f;
4677     float step = 7.62939453e-006f;
4678     bool lastResult = true;
4679  //   for (int i = 0; i < 30; ++i) {
4680         SkString name(filename);
4681  //       name.appendS32(i);
4682  //       if (i > 0) {
4683  //           SkDebugf("\n\n<div id=\"%s\">\n", name.c_str());
4684  //       }
4685         pts[5].fY = 6.66666698f + offset;
4686         SkPath path, pathB;
4687         path.setFillType(SkPath::kWinding_FillType);
4688         path.moveTo(pts[0]);
4689         path.cubicTo(pts[1], pts[2], pts[3]);
4690         path.close();
4691         pathB.setFillType(SkPath::kWinding_FillType);
4692         pathB.moveTo(pts[4]);
4693         pathB.cubicTo(pts[5], pts[6], pts[7]);
4694         pathB.close();
4695         bool result = testPathOp(reporter, path, pathB, kIntersect_SkPathOp, name.c_str());
4696         if (lastResult != result) {
4697             up = !up;
4698         }
4699         step /= 2;
4700         offset += up ? step : -step;
4701         lastResult = result;
4702  //   }
4703 }
4704 
4705 
loops33iAsQuads(skiatest::Reporter * reporter,const char * filename)4706 static void loops33iAsQuads(skiatest::Reporter* reporter, const char* filename) {
4707     SkPath path, pathB;
4708     path.setFillType(SkPath::kWinding_FillType);
4709     path.moveTo(2, 6);
4710     path.cubicTo(1, 2, 7.16666698f, 6.66666698f, -4.66666651f, 7.66666651f);
4711     path.close();
4712     pathB.setFillType(SkPath::kWinding_FillType);
4713     pathB.moveTo(1, 2);
4714     pathB.cubicTo(7.16666698f, 6.66666698f, -4.66666651f, 7.66666651f, 2, 6);
4715     pathB.close();
4716     SkPath qPath, qPathB;
4717     CubicPathToQuads(path, &qPath);
4718     CubicPathToQuads(pathB, &qPathB);
4719     testPathOp(reporter, qPath, qPathB, kIntersect_SkPathOp, filename);
4720 }
4721 
loops34i(skiatest::Reporter * reporter,const char * filename)4722 static void loops34i(skiatest::Reporter* reporter, const char* filename) {
4723     SkPath path, pathB;
4724     path.setFillType(SkPath::kWinding_FillType);
4725     path.moveTo(3, 4);
4726     path.cubicTo(0, 4, 2.5f, 4, 3, 9);
4727     path.close();
4728     pathB.setFillType(SkPath::kWinding_FillType);
4729     pathB.moveTo(0, 4);
4730     pathB.cubicTo(2.5f, 4, 3, 9, 3, 4);
4731     pathB.close();
4732     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4733 }
4734 
loops35i(skiatest::Reporter * reporter,const char * filename)4735 static void loops35i(skiatest::Reporter* reporter, const char* filename) {
4736     SkPath path, pathB;
4737     path.setFillType(SkPath::kWinding_FillType);
4738     path.moveTo(3, 4);
4739     path.cubicTo(0, 4, 2.5f, 4, 3, 10);
4740     path.close();
4741     pathB.setFillType(SkPath::kWinding_FillType);
4742     pathB.moveTo(0, 4);
4743     pathB.cubicTo(2.5f, 4, 3, 10, 3, 4);
4744     pathB.close();
4745     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4746 }
4747 
loops36i(skiatest::Reporter * reporter,const char * filename)4748 static void loops36i(skiatest::Reporter* reporter, const char* filename) {
4749     SkPath path, pathB;
4750     path.setFillType(SkPath::kWinding_FillType);
4751     path.moveTo(3, 4);
4752     path.cubicTo(1, 4, 2.66666675f, 4, 3, 8);
4753     path.close();
4754     pathB.setFillType(SkPath::kWinding_FillType);
4755     pathB.moveTo(1, 4);
4756     pathB.cubicTo(2.66666675f, 4, 3, 8, 3, 4);
4757     pathB.close();
4758     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4759 }
4760 
loops37i(skiatest::Reporter * reporter,const char * filename)4761 static void loops37i(skiatest::Reporter* reporter, const char* filename) {
4762     SkPath path, pathB;
4763     path.setFillType(SkPath::kWinding_FillType);
4764     path.moveTo(2, 4);
4765     path.cubicTo(1, 4, 1.83333337f, 4, 2, 5.33333349f);
4766     path.close();
4767     pathB.setFillType(SkPath::kWinding_FillType);
4768     pathB.moveTo(1, 4);
4769     pathB.cubicTo(1.83333337f, 4, 2, 5.33333349f, 2, 4);
4770     pathB.close();
4771     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4772 }
4773 
loops38i(skiatest::Reporter * reporter,const char * filename)4774 static void loops38i(skiatest::Reporter* reporter, const char* filename) {
4775     SkPath path, pathB;
4776     path.setFillType(SkPath::kWinding_FillType);
4777     path.moveTo(3, 4);
4778     path.cubicTo(2, 4, 2.83333325f, 4, 3, 6);
4779     path.close();
4780     pathB.setFillType(SkPath::kWinding_FillType);
4781     pathB.moveTo(2, 4);
4782     pathB.cubicTo(2.83333325f, 4, 3, 6, 3, 4);
4783     pathB.close();
4784     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4785 }
4786 
loops39i(skiatest::Reporter * reporter,const char * filename)4787 static void loops39i(skiatest::Reporter* reporter, const char* filename) {
4788     SkPath path, pathB;
4789     path.setFillType(SkPath::kWinding_FillType);
4790     path.moveTo(3, 5);
4791     path.cubicTo(0, 5, 2.5f, 5, 3, 10);
4792     path.close();
4793     pathB.setFillType(SkPath::kWinding_FillType);
4794     pathB.moveTo(0, 5);
4795     pathB.cubicTo(2.5f, 5, 3, 10, 3, 5);
4796     pathB.close();
4797     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4798 }
4799 
loops40i(skiatest::Reporter * reporter,const char * filename)4800 static void loops40i(skiatest::Reporter* reporter, const char* filename) {
4801     SkPath path, pathB;
4802     path.setFillType(SkPath::kWinding_FillType);
4803     path.moveTo(3, 5);
4804     path.cubicTo(0, 5, 2.5f, 5, 3, 11);
4805     path.close();
4806     pathB.setFillType(SkPath::kWinding_FillType);
4807     pathB.moveTo(0, 5);
4808     pathB.cubicTo(2.5f, 5, 3, 11, 3, 5);
4809     pathB.close();
4810     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4811 }
4812 
loops40iAsQuads(skiatest::Reporter * reporter,const char * filename)4813 static void loops40iAsQuads(skiatest::Reporter* reporter, const char* filename) {
4814     SkPath path, pathB;
4815     path.setFillType(SkPath::kWinding_FillType);
4816     path.moveTo(3, 5);
4817     path.cubicTo(0, 5, 2.5f, 5, 3, 11);
4818     path.close();
4819     pathB.setFillType(SkPath::kWinding_FillType);
4820     pathB.moveTo(0, 5);
4821     pathB.cubicTo(2.5f, 5, 3, 11, 3, 5);
4822     pathB.close();
4823     SkPath qPath, qPathB;
4824     CubicPathToQuads(path, &qPath);
4825     CubicPathToQuads(pathB, &qPathB);
4826     testPathOp(reporter, qPath, qPathB, kIntersect_SkPathOp, filename);
4827 }
4828 
loops44i(skiatest::Reporter * reporter,const char * filename)4829 static void loops44i(skiatest::Reporter* reporter, const char* filename) {
4830     SkPath path, pathB;
4831     path.setFillType(SkPath::kWinding_FillType);
4832     path.moveTo(1, 5);
4833     path.cubicTo(0, 1, 7.33333302f, 5.33333349f, -7, 7);
4834     path.close();
4835     pathB.setFillType(SkPath::kWinding_FillType);
4836     pathB.moveTo(0, 1);
4837     pathB.cubicTo(7.33333302f, 5.33333349f, -7, 7, 1, 5);
4838     pathB.close();
4839     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4840 }
4841 
loops45i(skiatest::Reporter * reporter,const char * filename)4842 static void loops45i(skiatest::Reporter* reporter, const char* filename) {
4843     SkPath path, pathB;
4844     path.setFillType(SkPath::kWinding_FillType);
4845     path.moveTo(1, 6);
4846     path.cubicTo(0, 2, 7.33333302f, 6.33333302f, -7, 8);
4847     path.close();
4848     pathB.setFillType(SkPath::kWinding_FillType);
4849     pathB.moveTo(0, 2);
4850     pathB.cubicTo(7.33333302f, 6.33333302f, -7, 8, 1, 6);
4851     pathB.close();
4852     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4853 }
4854 
loops46i(skiatest::Reporter * reporter,const char * filename)4855 static void loops46i(skiatest::Reporter* reporter, const char* filename) {
4856     SkPath path, pathB;
4857     path.setFillType(SkPath::kWinding_FillType);
4858     path.moveTo(2, 6);
4859     path.cubicTo(1, 2, 8.33333302f, 6.33333302f, -6, 8);
4860     path.close();
4861     pathB.setFillType(SkPath::kWinding_FillType);
4862     pathB.moveTo(1, 2);
4863     pathB.cubicTo(8.33333302f, 6.33333302f, -6, 8, 2, 6);
4864     pathB.close();
4865     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4866 }
4867 
4868 /*
4869 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346	0 */
loops47i(skiatest::Reporter * reporter,const char * filename)4870 static void loops47i(skiatest::Reporter* reporter, const char* filename) {
4871     SkPath path, pathB;
4872     path.setFillType(SkPath::kWinding_FillType);
4873     path.moveTo(2, 4);
4874     path.cubicTo(0, 1, 6, 5.83333302f, -4, 8);
4875     path.close();
4876     pathB.setFillType(SkPath::kWinding_FillType);
4877     pathB.moveTo(0, 1);
4878     pathB.cubicTo(6, 5.83333302f, -4, 8, 2, 4);
4879     pathB.close();
4880     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4881 }
4882 
loops48i(skiatest::Reporter * reporter,const char * filename)4883 static void loops48i(skiatest::Reporter* reporter, const char* filename) {
4884     SkPath path, pathB;
4885     path.setFillType(SkPath::kWinding_FillType);
4886     path.moveTo(2, 6);
4887     path.cubicTo(0, 1, 9.33333302f, 6.83333302f, -8.33333302f, 9.16666603f);
4888     path.close();
4889     pathB.setFillType(SkPath::kWinding_FillType);
4890     pathB.moveTo(0, 1);
4891     pathB.cubicTo(9.33333302f, 6.83333302f, -8.33333302f, 9.16666603f, 2, 6);
4892     pathB.close();
4893     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4894 }
4895 
loops49i(skiatest::Reporter * reporter,const char * filename)4896 static void loops49i(skiatest::Reporter* reporter, const char* filename) {
4897     SkPath path, pathB;
4898     path.setFillType(SkPath::kWinding_FillType);
4899     path.moveTo(0, 2);
4900     path.cubicTo(1, 4, -0.166666687f, 2.66666675f, 1.66666675f, 2);
4901     path.close();
4902     pathB.setFillType(SkPath::kWinding_FillType);
4903     pathB.moveTo(1, 4);
4904     pathB.cubicTo(-0.166666687f, 2.66666675f, 1.66666675f, 2, 0, 2);
4905     pathB.close();
4906     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4907 }
4908 
loops50i(skiatest::Reporter * reporter,const char * filename)4909 static void loops50i(skiatest::Reporter* reporter, const char* filename) {
4910     SkPath path, pathB;
4911     path.setFillType(SkPath::kWinding_FillType);
4912     path.moveTo(0, 3);
4913     path.cubicTo(1, 5, -0.166666687f, 3.66666675f, 1.66666675f, 3);
4914     path.close();
4915     pathB.setFillType(SkPath::kWinding_FillType);
4916     pathB.moveTo(1, 5);
4917     pathB.cubicTo(-0.166666687f, 3.66666675f, 1.66666675f, 3, 0, 3);
4918     pathB.close();
4919     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4920 }
4921 
loops51i(skiatest::Reporter * reporter,const char * filename)4922 static void loops51i(skiatest::Reporter* reporter, const char* filename) {
4923     SkPath path, pathB;
4924     path.setFillType(SkPath::kWinding_FillType);
4925     path.moveTo(1, 2);
4926     path.cubicTo(2, 4, 0.833333313f, 2.66666675f, 2.66666675f, 2);
4927     path.close();
4928     pathB.setFillType(SkPath::kWinding_FillType);
4929     pathB.moveTo(2, 4);
4930     pathB.cubicTo(0.833333313f, 2.66666675f, 2.66666675f, 2, 1, 2);
4931     pathB.close();
4932     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4933 }
4934 
loops52i(skiatest::Reporter * reporter,const char * filename)4935 static void loops52i(skiatest::Reporter* reporter, const char* filename) {
4936     SkPath path, pathB;
4937     path.setFillType(SkPath::kWinding_FillType);
4938     path.moveTo(1, 3);
4939     path.cubicTo(2, 5, 0.833333313f, 3.66666675f, 2.66666675f, 3);
4940     path.close();
4941     pathB.setFillType(SkPath::kWinding_FillType);
4942     pathB.moveTo(2, 5);
4943     pathB.cubicTo(0.833333313f, 3.66666675f, 2.66666675f, 3, 1, 3);
4944     pathB.close();
4945     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4946 }
4947 
loops53i(skiatest::Reporter * reporter,const char * filename)4948 static void loops53i(skiatest::Reporter* reporter, const char* filename) {
4949     SkPath path, pathB;
4950     path.setFillType(SkPath::kWinding_FillType);
4951     path.moveTo(2, 3);
4952     path.cubicTo(3, 5, 1.83333325f, 3.66666675f, 3.66666651f, 3);
4953     path.close();
4954     pathB.setFillType(SkPath::kWinding_FillType);
4955     pathB.moveTo(3, 5);
4956     pathB.cubicTo(1.83333325f, 3.66666675f, 3.66666651f, 3, 2, 3);
4957     pathB.close();
4958     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4959 }
4960 
loops54i(skiatest::Reporter * reporter,const char * filename)4961 static void loops54i(skiatest::Reporter* reporter, const char* filename) {
4962     SkPath path, pathB;
4963     path.setFillType(SkPath::kWinding_FillType);
4964     path.moveTo(0, 2);
4965     path.cubicTo(1, 4, 0, 3, 1.66666675f, 2);
4966     path.close();
4967     pathB.setFillType(SkPath::kWinding_FillType);
4968     pathB.moveTo(1, 4);
4969     pathB.cubicTo(0, 3, 1.66666675f, 2, 0, 2);
4970     pathB.close();
4971     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4972 }
4973 
loops55i(skiatest::Reporter * reporter,const char * filename)4974 static void loops55i(skiatest::Reporter* reporter, const char* filename) {
4975     SkPath path, pathB;
4976     path.setFillType(SkPath::kWinding_FillType);
4977     path.moveTo(0, 3);
4978     path.cubicTo(1, 5, 0, 4, 1.66666675f, 3);
4979     path.close();
4980     pathB.setFillType(SkPath::kWinding_FillType);
4981     pathB.moveTo(1, 5);
4982     pathB.cubicTo(0, 4, 1.66666675f, 3, 0, 3);
4983     pathB.close();
4984     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4985 }
4986 
loops56i(skiatest::Reporter * reporter,const char * filename)4987 static void loops56i(skiatest::Reporter* reporter, const char* filename) {
4988     SkPath path, pathB;
4989     path.setFillType(SkPath::kWinding_FillType);
4990     path.moveTo(1, 2);
4991     path.cubicTo(2, 4, 0.99999994f, 3, 2.66666675f, 2);
4992     path.close();
4993     pathB.setFillType(SkPath::kWinding_FillType);
4994     pathB.moveTo(2, 4);
4995     pathB.cubicTo(0.99999994f, 3, 2.66666675f, 2, 1, 2);
4996     pathB.close();
4997     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4998 }
4999 
loops57i(skiatest::Reporter * reporter,const char * filename)5000 static void loops57i(skiatest::Reporter* reporter, const char* filename) {
5001     SkPath path, pathB;
5002     path.setFillType(SkPath::kWinding_FillType);
5003     path.moveTo(1, 3);
5004     path.cubicTo(2, 5, 0.99999994f, 4, 2.66666675f, 3);
5005     path.close();
5006     pathB.setFillType(SkPath::kWinding_FillType);
5007     pathB.moveTo(2, 5);
5008     pathB.cubicTo(0.99999994f, 4, 2.66666675f, 3, 1, 3);
5009     pathB.close();
5010     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
5011 }
5012 
loops58i(skiatest::Reporter * reporter,const char * filename)5013 static void loops58i(skiatest::Reporter* reporter, const char* filename) {
5014     SkPath path, pathB;
5015     path.setFillType(SkPath::kWinding_FillType);
5016     path.moveTo(2, 3);
5017     path.cubicTo(3, 5, 2, 4, 3.66666651f, 3);
5018     path.close();
5019     pathB.setFillType(SkPath::kWinding_FillType);
5020     pathB.moveTo(3, 5);
5021     pathB.cubicTo(2, 4, 3.66666651f, 3, 2, 3);
5022     pathB.close();
5023     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
5024 }
5025 
loops58iAsQuads(skiatest::Reporter * reporter,const char * filename)5026 static void loops58iAsQuads(skiatest::Reporter* reporter, const char* filename) {
5027     SkPath path, pathB;
5028     path.setFillType(SkPath::kWinding_FillType);
5029     path.moveTo(2, 3);
5030     path.cubicTo(3, 5, 2, 4, 3.66666651f, 3);
5031     path.close();
5032     pathB.setFillType(SkPath::kWinding_FillType);
5033     pathB.moveTo(3, 5);
5034     pathB.cubicTo(2, 4, 3.66666651f, 3, 2, 3);
5035     pathB.close();
5036     SkPath qPath, qPathB;
5037     CubicPathToQuads(path, &qPath);
5038     CubicPathToQuads(pathB, &qPathB);
5039 //    SkPoint from = {2.61714339f,1.90228665f};
5040 //    SkPoint to = {2.617045833359139f,1.9013528935803314f};
5041 //    path_edit(from, to, &qPathB);
5042     testPathOp(reporter, qPath, qPathB, kIntersect_SkPathOp, filename);
5043 }
5044 
loops59i(skiatest::Reporter * reporter,const char * filename)5045 static void loops59i(skiatest::Reporter* reporter, const char* filename) {
5046     SkPath path, pathB;
5047     path.setFillType(SkPath::kWinding_FillType);
5048     path.moveTo(0, 6);
5049     path.cubicTo(1, 2, 7.33333302f, 1.66666663f, -7.5f, 2);
5050     path.close();
5051     pathB.setFillType(SkPath::kWinding_FillType);
5052     pathB.moveTo(1, 2);
5053     pathB.cubicTo(7.33333302f, 1.66666663f, -7.5f, 2, 0, 6);
5054     pathB.close();
5055     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
5056 }
5057 
loops59iasQuads(skiatest::Reporter * reporter,const char * filename)5058 static void loops59iasQuads(skiatest::Reporter* reporter, const char* filename) {
5059     SkPath path, pathB;
5060     path.setFillType(SkPath::kWinding_FillType);
5061     path.moveTo(0, 6);
5062     path.cubicTo(1, 2, 7.33333302f, 1.66666663f, -7.5f, 2);
5063     path.close();
5064     pathB.setFillType(SkPath::kWinding_FillType);
5065     pathB.moveTo(1, 2);
5066     pathB.cubicTo(7.33333302f, 1.66666663f, -7.5f, 2, 0, 6);
5067     pathB.close();
5068     SkPath qPath, qPathB;
5069     CubicPathToQuads(path, &qPath);
5070     CubicPathToQuads(pathB, &qPathB);
5071     SkPoint from = {2.61714339f,1.90228665f};
5072     SkPoint to = {2.617045833359139f,1.9013528935803314f};
5073     path_edit(from, to, &qPathB);
5074     testPathOp(reporter, qPath, qPathB, kIntersect_SkPathOp, filename);
5075 }
5076 
cubics41d(skiatest::Reporter * reporter,const char * filename)5077 static void cubics41d(skiatest::Reporter* reporter, const char* filename) {
5078     SkPath path, pathB;
5079     path.setFillType(SkPath::kWinding_FillType);
5080     path.moveTo(0, 1);
5081     path.cubicTo(1, 4, 3, 0, 3, 1);
5082     path.close();
5083     pathB.setFillType(SkPath::kWinding_FillType);
5084     pathB.moveTo(0, 3);
5085     pathB.cubicTo(1, 3, 1, 0, 4, 1);
5086     pathB.close();
5087     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
5088 }
5089 
loops61i(skiatest::Reporter * reporter,const char * filename)5090 void loops61i(skiatest::Reporter* reporter, const char* filename) {
5091     SkPath path, pathB;
5092     path.setFillType(SkPath::kWinding_FillType);
5093     path.moveTo(0, 1);
5094     path.cubicTo(1, 5, -6.33333302f, 0.666666627f, 8, -1);
5095     path.close();
5096     pathB.setFillType(SkPath::kWinding_FillType);
5097     pathB.moveTo(1, 5);
5098     pathB.cubicTo(-6.33333302f, 0.666666627f, 8, -1, 0, 1);
5099     pathB.close();
5100     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
5101 }
5102 
loops62i(skiatest::Reporter * reporter,const char * filename)5103 static void loops62i(skiatest::Reporter* reporter, const char* filename) {
5104     SkPath path, pathB;
5105     path.setFillType(SkPath::kWinding_FillType);
5106     path.moveTo(0, 2);
5107     path.cubicTo(1, 6, -6.33333302f, 1.66666663f, 8, 0);
5108     path.close();
5109     pathB.setFillType(SkPath::kWinding_FillType);
5110     pathB.moveTo(1, 6);
5111     pathB.cubicTo(-6.33333302f, 1.66666663f, 8, 0, 0, 2);
5112     pathB.close();
5113     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
5114 }
5115 
loops63i(skiatest::Reporter * reporter,const char * filename)5116 static void loops63i(skiatest::Reporter* reporter, const char* filename) {
5117     SkPath path, pathB;
5118     path.setFillType(SkPath::kWinding_FillType);
5119     path.moveTo(0, 1);
5120     path.cubicTo(2, 4, -4, -0.833333254f, 6, -3);
5121     path.close();
5122     pathB.setFillType(SkPath::kWinding_FillType);
5123     pathB.moveTo(2, 4);
5124     pathB.cubicTo(-4, -0.833333254f, 6, -3, 0, 1);
5125     pathB.close();
5126     testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
5127 }
5128 
cubics44d(skiatest::Reporter * reporter,const char * filename)5129 static void cubics44d(skiatest::Reporter* reporter, const char* filename) {
5130     SkPath path, pathB;
5131     path.setFillType(SkPath::kWinding_FillType);
5132     path.moveTo(3, 4);
5133     path.cubicTo(2, 5, 3, 1, 6, 2);
5134     path.close();
5135     pathB.setFillType(SkPath::kWinding_FillType);
5136     pathB.moveTo(1, 3);
5137     pathB.cubicTo(2, 6, 4, 3, 5, 2);
5138     pathB.close();
5139     testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
5140 }
5141 
cubics45u(skiatest::Reporter * reporter,const char * filename)5142 static void cubics45u(skiatest::Reporter* reporter, const char* filename) {
5143     SkPath path, pathB;
5144     path.setFillType(SkPath::kWinding_FillType);
5145     path.moveTo(1, 3);
5146     path.cubicTo(2, 6, 4, 3, 5, 2);
5147     path.close();
5148     pathB.setFillType(SkPath::kWinding_FillType);
5149     pathB.moveTo(3, 4);
5150     pathB.cubicTo(2, 5, 3, 1, 6, 2);
5151     pathB.close();
5152     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
5153 }
5154 
fuzz38(skiatest::Reporter * reporter,const char * filename)5155 static void fuzz38(skiatest::Reporter* reporter, const char* filename) {
5156     SkPath path, pathB;
5157     path.moveTo(100.34f, 303.312f);
5158     path.lineTo(-1e+08, 303.312f);
5159     path.lineTo(102, 310.156f);
5160     path.lineTo(100.34f, 310.156f);
5161     path.lineTo(100.34f, 303.312f);
5162     path.close();
5163     testPathOpCheck(reporter, path, pathB, kUnion_SkPathOp, filename, FLAGS_runFail);
5164 }
5165 
crbug_526025(skiatest::Reporter * reporter,const char * filename)5166 static void crbug_526025(skiatest::Reporter* reporter, const char* filename) {
5167     SkPath path;
5168     path.setFillType((SkPath::FillType) 1);
5169 path.moveTo(SkBits2Float(0x43b40000), SkBits2Float(0xcf000000));  // 360, -2.14748e+09f
5170 path.cubicTo(SkBits2Float(0x4e0d628f), SkBits2Float(0xceffffff), SkBits2Float(0x4e800003), SkBits2Float(0xcec6b143), SkBits2Float(0x4e800002), SkBits2Float(0xce7ffffc));  // 5.93012e+08f, -2.14748e+09f, 1.07374e+09f, -1.66675e+09f, 1.07374e+09f, -1.07374e+09f
5171 path.cubicTo(SkBits2Float(0x4e800002), SkBits2Float(0xcde53aee), SkBits2Float(0x4e0d6292), SkBits2Float(0xc307820e), SkBits2Float(0x44627d00), SkBits2Float(0x437ffff2));  // 1.07374e+09f, -4.80731e+08f, 5.93012e+08f, -135.508f, 905.953f, 256
5172 path.lineTo(SkBits2Float(0x444bf3bc), SkBits2Float(0x4460537e));  // 815.808f, 897.305f
5173 path.lineTo(SkBits2Float(0x43553abd), SkBits2Float(0x440f3cbd));  // 213.229f, 572.949f
5174 path.lineTo(SkBits2Float(0x42000000), SkBits2Float(0x41800000));  // 32, 16
5175 path.lineTo(SkBits2Float(0x42c80000), SkBits2Float(0x44000000));  // 100, 512
5176 path.lineTo(SkBits2Float(0x43553abd), SkBits2Float(0x440f3cbd));  // 213.229f, 572.949f
5177 path.lineTo(SkBits2Float(0x43b40000), SkBits2Float(0x44800000));  // 360, 1024
5178 path.lineTo(SkBits2Float(0x43b40000), SkBits2Float(0x45816000));  // 360, 4140
5179 
5180     SkPath path1(path);
5181     path.reset();
5182     path.setFillType((SkPath::FillType) 0);
5183 path.moveTo(SkBits2Float(0x42fe0000), SkBits2Float(0x43a08000));  // 127, 321
5184 path.lineTo(SkBits2Float(0x45d5c000), SkBits2Float(0x43870000));  // 6840, 270
5185 path.lineTo(SkBits2Float(0xd0a00000), SkBits2Float(0x4cbebc20));  // -2.14748e+10f, 1e+08
5186 path.lineTo(SkBits2Float(0x451f7000), SkBits2Float(0x42800000));  // 2551, 64
5187 path.lineTo(SkBits2Float(0x42fe0000), SkBits2Float(0x43a08000));  // 127, 321
5188 path.close();
5189 
5190     SkPath path2(path);
5191     testPathOp(reporter, path1, path2, (SkPathOp) 2, filename);
5192 }
5193 
5194 static void (*skipTest)(skiatest::Reporter* , const char* filename) = 0;
5195 static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0;
5196 static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0;
5197 
5198 #define TEST(name) { name, #name }
5199 
5200 static struct TestDesc tests[] = {
5201     TEST(crbug_526025),
5202     TEST(fuzz38),
5203     TEST(cubics44d),
5204     TEST(cubics45u),
5205     TEST(loops61i),
5206     TEST(loops62i),
5207     TEST(loops63i),
5208     TEST(loops58iAsQuads),
5209     TEST(cubics41d),
5210     TEST(loops59iasQuads),
5211     TEST(loops59i),
5212     TEST(loops44i),
5213     TEST(loops45i),
5214     TEST(loops46i),
5215     TEST(loops47i),
5216     TEST(loops48i),
5217     TEST(loops49i),
5218     TEST(loops50i),
5219     TEST(loops51i),
5220     TEST(loops52i),
5221     TEST(loops53i),
5222     TEST(loops54i),
5223     TEST(loops55i),
5224     TEST(loops56i),
5225     TEST(loops57i),
5226     TEST(loops58i),
5227     TEST(loops33iMod),
5228     TEST(loops33iAsQuads),
5229     TEST(loops33i),
5230     TEST(loops40i),
5231     TEST(loops40iAsQuads),
5232     TEST(loops39i),
5233     TEST(loops38i),
5234     TEST(loops37i),
5235     TEST(loops36i),
5236     TEST(loops35i),
5237     TEST(loops34i),
5238     TEST(loops32i),
5239     TEST(loops31i),
5240     TEST(loops30i),
5241     TEST(loops29i),
5242     TEST(loops28i),
5243     TEST(loops27i),
5244     TEST(loops26i),
5245     TEST(loops25i),
5246     TEST(loops24i),
5247     TEST(loops23i),
5248     TEST(loops22i),
5249     TEST(loops21i),
5250     TEST(loops20i),
5251     TEST(cubics20d),
5252     TEST(cubics6d),
5253     TEST(cubics7d),
5254     TEST(cubics8d),
5255     TEST(cubics9d),
5256     TEST(cubics10u),
5257     TEST(cubics11i),
5258     TEST(cubics12d),
5259     TEST(cubics13d),
5260     TEST(cubics14d),
5261     TEST(cubics15d),
5262     TEST(cubics16i),
5263     TEST(cubics17d),
5264     TEST(cubics18d),
5265     TEST(cubics19d),
5266     TEST(cubicOp157),
5267     TEST(cubicOp142),
5268     TEST(loops4i),
5269     TEST(quadRect1),
5270     TEST(quadRect2),
5271     TEST(quadRect3),
5272     TEST(quadRect4),
5273     TEST(quadRect5),
5274     TEST(quadRect6),
5275     TEST(cubicOp141),
5276     TEST(cubicOp58d),
5277     TEST(loops5i),
5278     TEST(cubicOp140),
5279     TEST(cubicOp139),
5280     TEST(cubics138),
5281     TEST(cubics137),
5282     TEST(cubicOp136a),
5283     TEST(cubicOp136),
5284     TEST(cubicOp135),
5285     TEST(cubicOp134),
5286     TEST(cubicOp133),
5287     TEST(loop12),
5288     TEST(cubicOp132),
5289     TEST(loop11),
5290     TEST(loop10),
5291     TEST(circlesOp3),
5292     TEST(loop9),
5293     TEST(loop8),
5294     TEST(rects5),
5295     TEST(loop7),
5296     TEST(cubicOp130a),
5297     TEST(rRect1x),
5298     TEST(circlesOp2),
5299     TEST(circlesOp1),
5300     TEST(cubicOp131),
5301     TEST(cubicOp130),
5302     TEST(cubicOp129),
5303     TEST(cubicOp128),
5304     TEST(cubicOp127),
5305     TEST(cubicOp126),
5306     TEST(cubicOp125),
5307     TEST(cubicOp124),
5308     TEST(loop6),
5309     TEST(loop5),
5310     TEST(cubicOp123),
5311     TEST(cubicOp122),
5312     TEST(cubicOp121),
5313     TEST(cubicOp120),
5314     TEST(cubicOp119),
5315     TEST(loop4),
5316     TEST(loop3),
5317     TEST(loop2),
5318     TEST(loop1asQuad),
5319     TEST(loop1),
5320     TEST(issue3517),
5321     TEST(cubicOp118),
5322     TEST(cubicOp117),
5323     TEST(cubicOp116),
5324     TEST(testRect2),
5325     TEST(testRect1),
5326     TEST(cubicOp115),
5327     TEST(issue2753),
5328     TEST(cubicOp114),
5329     TEST(issue2808),
5330     TEST(cubicOp114asQuad),
5331     TEST(rects4),
5332     TEST(rects3),
5333     TEST(rects2),
5334     TEST(rects1),
5335     TEST(issue2540),
5336     TEST(issue2504),
5337     TEST(kari1),
5338     TEST(quadOp10i),
5339     TEST(cubicOp113),
5340     TEST(skpcarrot_is24),
5341     TEST(issue1417),
5342     TEST(cubicOp112),
5343     TEST(skpadspert_net23),
5344     TEST(skpadspert_de11),
5345     TEST(findFirst1),
5346     TEST(xOp2i),
5347     TEST(xOp3i),
5348     TEST(xOp1u),
5349     TEST(xOp1i),
5350     TEST(cubicOp111),
5351     TEST(cubicOp110),
5352     TEST(cubicOp109),
5353     TEST(cubicOp108),
5354     TEST(cubicOp107),
5355     TEST(cubicOp106),
5356     TEST(cubicOp105),
5357     TEST(cubicOp104),
5358     TEST(cubicOp103),
5359     TEST(cubicOp102),
5360     TEST(cubicOp101),
5361     TEST(cubicOp100),
5362     TEST(cubicOp99),
5363     TEST(issue1435),
5364     TEST(cubicOp98x),
5365     TEST(cubicOp97x),
5366     TEST(skpcarpetplanet_ru22),
5367     TEST(cubicOp96d),
5368     TEST(cubicOp95u),
5369     TEST(skpadbox_lt15),
5370     TEST(skpagentxsites_com55),
5371     TEST(skpadventistmission_org572),
5372     TEST(skpadoption_org196),
5373     TEST(skpbambootheme_com12),
5374     TEST(skpbakosoft_com10),
5375     TEST(skpakmmos_ru100),
5376     TEST(skpbangalorenest_com4),
5377     TEST(skpbingoentertainment_net189),
5378     TEST(skpbestred_ru37),
5379     TEST(skpbenzoteh_ru152),
5380     TEST(skpcamcorder_kz21),
5381     TEST(skpcaffelavazzait_com_ua21),
5382     TEST(skpcarrefour_ro62),
5383     TEST(skpcavablar_net563),
5384     TEST(skpinsomnia_gr72),
5385     TEST(skpadbox_lt8),
5386     TEST(skpact_com43),
5387     TEST(skpacesoftech_com47),
5388     TEST(skpabcspark_ca103),
5389     TEST(cubicOp94u),
5390     TEST(cubicOp93d),
5391     TEST(cubicOp92i),
5392     TEST(skpadithya_putr4_blogspot_com551),
5393     TEST(skpadindex_de4),
5394     TEST(skpaiaigames_com870),
5395     TEST(skpaaalgarve_org53),
5396     TEST(skpkkiste_to716),
5397     TEST(cubicOp91u),
5398     TEST(cubicOp90u),
5399     TEST(cubicOp89u),
5400     TEST(cubicOp88u),
5401     TEST(cubicOp87u),
5402     TEST(cubicOp86i),
5403     TEST(loopEdge2),
5404     TEST(loopEdge1),
5405     TEST(rectOp3x),
5406     TEST(rectOp2i),
5407     TEST(rectOp1i),
5408     TEST(issue1418b),
5409     TEST(cubicOp85i),
5410     TEST(issue1418),
5411     TEST(skpkkiste_to98),
5412     TEST(skpahrefs_com29),
5413     TEST(cubicOp85d),
5414     TEST(skpahrefs_com88),
5415     TEST(skphealth_com76),
5416     TEST(skpancestry_com1),
5417     TEST(skpbyte_com1),
5418     TEST(skpeldorado_com_ua1),
5419     TEST(skp96prezzi1),
5420     TEST(skpClip2),
5421     TEST(skpClip1),
5422     TEST(cubicOp84d),
5423     TEST(cubicOp83i),
5424     TEST(cubicOp82i),
5425     TEST(cubicOp81d),
5426     TEST(cubicOp80i),
5427     TEST(cubicOp79u),
5428     TEST(cubicOp78u),
5429     TEST(cubicOp77i),
5430     TEST(cubicOp76u),
5431     TEST(cubicOp75d),
5432     TEST(cubicOp74d),
5433     TEST(cubicOp73d),
5434     TEST(cubicOp72i),
5435     TEST(cubicOp71d),
5436     TEST(skp5),
5437     TEST(skp4),
5438     TEST(skp3),
5439     TEST(skp2),
5440     TEST(skp1),
5441     TEST(rRect1),
5442     TEST(cubicOp70d),
5443     TEST(cubicOp69d),
5444     TEST(cubicOp68u),
5445     TEST(cubicOp67u),
5446     TEST(cubicOp66u),
5447     TEST(rectOp1d),
5448     TEST(cubicOp65d),
5449     TEST(cubicOp64d),
5450     TEST(cubicOp63d),
5451     TEST(cubicOp62d),
5452     TEST(cubicOp61d),
5453     TEST(cubicOp60d),
5454     TEST(cubicOp59d),
5455     TEST(cubicOp57d),
5456     TEST(cubicOp56d),
5457     TEST(cubicOp55d),
5458     TEST(cubicOp54d),
5459     TEST(cubicOp53d),
5460     TEST(cubicOp52d),
5461     TEST(cubicOp51d),
5462     TEST(cubicOp50d),
5463     TEST(cubicOp49d),
5464     TEST(cubicOp48d),
5465     TEST(cubicOp47d),
5466     TEST(cubicOp46d),
5467     TEST(cubicOp45d),
5468     TEST(cubicOp44d),
5469     TEST(cubicOp43d),
5470     TEST(cubicOp42d),
5471     TEST(cubicOp41i),
5472     TEST(cubicOp40d),
5473     TEST(cubicOp39d),
5474     TEST(cubicOp38d),
5475     TEST(cubicOp37d),
5476     TEST(cubicOp36u),
5477     TEST(cubicOp35d),
5478     TEST(cubicOp34d),
5479     TEST(cubicOp33i),
5480     TEST(cubicOp32d),
5481     TEST(cubicOp31d),
5482     TEST(cubicOp31x),
5483     TEST(cubicOp31u),
5484     TEST(cubicOp30d),
5485     TEST(cubicOp29d),
5486     TEST(cubicOp28u),
5487     TEST(cubicOp27d),
5488     TEST(cubicOp26d),
5489     TEST(cubicOp25i),
5490     TEST(testOp8d),
5491     TEST(testDiff1),
5492     TEST(testIntersect1),
5493     TEST(testUnion1),
5494     TEST(testXor1),
5495     TEST(testDiff2),
5496     TEST(testIntersect2),
5497     TEST(testUnion2),
5498     TEST(testXor2),
5499     TEST(testOp1d),
5500     TEST(testOp2d),
5501     TEST(testOp3d),
5502     TEST(testOp1u),
5503     TEST(testOp4d),
5504     TEST(testOp5d),
5505     TEST(testOp6d),
5506     TEST(testOp7d),
5507     TEST(testOp2u),
5508 
5509     TEST(cubicOp24d),
5510     TEST(cubicOp23d),
5511     TEST(cubicOp22d),
5512     TEST(cubicOp21d),
5513     TEST(cubicOp20d),
5514     TEST(cubicOp19i),
5515     TEST(cubicOp18d),
5516     TEST(cubicOp17d),
5517     TEST(cubicOp16d),
5518     TEST(cubicOp15d),
5519     TEST(cubicOp14d),
5520     TEST(cubicOp13d),
5521     TEST(cubicOp12d),
5522     TEST(cubicOp11d),
5523     TEST(cubicOp10d),
5524     TEST(cubicOp1i),
5525     TEST(cubicOp9d),
5526     TEST(quadOp9d),
5527     TEST(lineOp9d),
5528     TEST(cubicOp8d),
5529     TEST(cubicOp7d),
5530     TEST(cubicOp6d),
5531     TEST(cubicOp5d),
5532     TEST(cubicOp3d),
5533     TEST(cubicOp2d),
5534     TEST(cubicOp1d),
5535 };
5536 
5537 static const size_t testCount = SK_ARRAY_COUNT(tests);
5538 
5539 static struct TestDesc subTests[] = {
5540     TEST(loops47i),
5541     TEST(loops61i),
5542     TEST(loops62i),
5543     TEST(issue3517),
5544 };
5545 
5546 static const size_t subTestCount = SK_ARRAY_COUNT(subTests);
5547 
5548 static void (*firstSubTest)(skiatest::Reporter* , const char* filename) = 0;
5549 
5550 static bool runSubTests = false;
5551 static bool runSubTestsFirst = true;
5552 static bool runReverse = false;
5553 
DEF_TEST(PathOpsOp,reporter)5554 DEF_TEST(PathOpsOp, reporter) {
5555 #if DEBUG_SHOW_TEST_NAME
5556     strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
5557 #endif
5558     if (runSubTests && runSubTestsFirst) {
5559         RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stopTest, runReverse);
5560     }
5561     RunTestSet(reporter, tests, testCount, firstTest, skipTest, stopTest, runReverse);
5562     if (runSubTests && !runSubTestsFirst) {
5563         RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stopTest, runReverse);
5564     }
5565 }
5566 
fuzz535151(skiatest::Reporter * reporter,const char * filename)5567 static void fuzz535151(skiatest::Reporter* reporter, const char* filename) {
5568     SkPath one;
5569     one.setFillType(SkPath::kWinding_FillType);
5570     SkPath two;
5571     two.setFillType(SkPath::kWinding_FillType);
5572     two.moveTo(0, 0);
5573     two.lineTo(0, 50);
5574     two.lineTo(4.29497e+09f, 50);
5575     SkPath dummy;
5576     REPORTER_ASSERT(reporter, !Op(one, two, kIntersect_SkPathOp, &dummy));
5577 }
5578 
bufferOverflow(skiatest::Reporter * reporter,const char * filename)5579 static void bufferOverflow(skiatest::Reporter* reporter, const char* filename) {
5580     SkPath path;
5581     path.addRect(0,0, 300,170141183460469231731687303715884105728.f);
5582     SkPath pathB;
5583     pathB.addRect(0,0, 300,16);
5584     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
5585 }
5586 
5587 // m 100,0 60,170 -160,-110 200,0 -170,11000000000 z
fuzz433(skiatest::Reporter * reporter,const char * filename)5588 static void fuzz433(skiatest::Reporter* reporter, const char* filename) {
5589     SkPath path1, path2;
5590     path1.moveTo(100,0);
5591     path1.lineTo(60,170);
5592     path1.lineTo(-160,-110);
5593     path1.lineTo(200,0);
5594     path1.lineTo(-170,11000000000.0f);
5595     path1.close();
5596 
5597     path2.moveTo(100 + 20,0 + 20);
5598     path2.lineTo(60 + 20,170 + 20);
5599     path2.lineTo(-160 + 20,-110 + 20);
5600     path2.lineTo(200 + 20,0 + 20);
5601     path2.lineTo(-170 + 20,11000000000.0f + 20);
5602     path2.close();
5603 
5604     testPathOpCheck(reporter, path1, path2, kIntersect_SkPathOp, filename, FLAGS_runFail);
5605 }
5606 
fuzz433b(skiatest::Reporter * reporter,const char * filename)5607 static void fuzz433b(skiatest::Reporter* reporter, const char* filename) {
5608     SkPath path1, path2;
5609     path1.setFillType(SkPath::kEvenOdd_FillType);
5610     path1.moveTo(140, 40);
5611     path1.lineTo(200, 210);
5612     path1.lineTo(40, 100);
5613     path1.lineTo(240, 100);
5614     path1.lineTo(70, 1.1e+10f);
5615     path1.lineTo(140, 40);
5616     path1.close();
5617 
5618     path1.setFillType(SkPath::kWinding_FillType);
5619     path2.moveTo(190, 60);
5620     path2.lineTo(250, 230);
5621     path2.lineTo(90, 120);
5622     path2.lineTo(290, 120);
5623     path2.lineTo(120, 1.1e+10f);
5624     path2.lineTo(190, 60);
5625     path2.close();
5626 
5627     testPathOpCheck(reporter, path1, path2, kUnion_SkPathOp, filename, FLAGS_runFail);
5628 }
5629 
fuzz487a(skiatest::Reporter * reporter,const char * filename)5630 static void fuzz487a(skiatest::Reporter* reporter, const char* filename) {
5631     SkPath path;
5632     path.setFillType((SkPath::FillType) 0);
5633 path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
5634 path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000));
5635 path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x429a6666), SkBits2Float(0x42f9999a), SkBits2Float(0x4275999a), SkBits2Float(0x42d70001), SkBits2Float(0x42633333));
5636 path.lineTo(SkBits2Float(0x42e90001), SkBits2Float(0x41b8cccc));
5637 path.cubicTo(SkBits2Float(0x42dc6667), SkBits2Float(0x41ab3332), SkBits2Float(0x42cf3334), SkBits2Float(0x41a3ffff), SkBits2Float(0x42c20001), SkBits2Float(0x41a3ffff));
5638 path.lineTo(SkBits2Float(0x42c20001), SkBits2Float(0x425d999a));
5639 path.lineTo(SkBits2Float(0x42c20001), SkBits2Float(0x425d999a));
5640 path.cubicTo(SkBits2Float(0x429c6668), SkBits2Float(0x425d999a), SkBits2Float(0x4279999c), SkBits2Float(0x42886667), SkBits2Float(0x42673335), SkBits2Float(0x42ab0000));
5641 path.lineTo(SkBits2Float(0x41c0ccd0), SkBits2Float(0x42990000));
5642 path.cubicTo(SkBits2Float(0x41b33336), SkBits2Float(0x42a5999a), SkBits2Float(0x41ac0003), SkBits2Float(0x42b2cccd), SkBits2Float(0x41ac0003), SkBits2Float(0x42c00000));
5643 path.lineTo(SkBits2Float(0x4261999c), SkBits2Float(0x42c00000));
5644 path.lineTo(SkBits2Float(0x4261999c), SkBits2Float(0x42c00000));
5645 path.cubicTo(SkBits2Float(0x4261999c), SkBits2Float(0x434d3333), SkBits2Float(0x4364e667), SkBits2Float(0x4346b333), SkBits2Float(0x4364e667), SkBits2Float(0x43400000));
5646 path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
5647 path.close();
5648 
5649     SkPath path1(path);
5650     path.reset();
5651     path.setFillType((SkPath::FillType) 0);
5652 path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
5653 path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000));
5654 path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x42a20000), SkBits2Float(0x43016667), SkBits2Float(0x4287cccd), SkBits2Float(0x42ea999a), SkBits2Float(0x4273999a));
5655 path.lineTo(SkBits2Float(0x4306cccd), SkBits2Float(0x41f5999a));
5656 path.cubicTo(SkBits2Float(0x42f76667), SkBits2Float(0x41c26667), SkBits2Float(0x42dd999a), SkBits2Float(0x41a4cccd), SkBits2Float(0x42c23334), SkBits2Float(0x41a4cccd));
5657 path.lineTo(SkBits2Float(0x42c23334), SkBits2Float(0x425e0000));
5658 path.cubicTo(SkBits2Float(0x42a43334), SkBits2Float(0x425e0000), SkBits2Float(0x428a0001), SkBits2Float(0x427ecccd), SkBits2Float(0x42780002), SkBits2Float(0x4297999a));
5659 path.lineTo(SkBits2Float(0x41fccccd), SkBits2Float(0x42693333));
5660 path.cubicTo(SkBits2Float(0x41c9999a), SkBits2Float(0x428acccd), SkBits2Float(0x41ac0000), SkBits2Float(0x42a4999a), SkBits2Float(0x41ac0000), SkBits2Float(0x42c00000));
5661 path.lineTo(SkBits2Float(0x4261999a), SkBits2Float(0x42c00000));
5662 path.cubicTo(SkBits2Float(0x4261999a), SkBits2Float(0x42de0000), SkBits2Float(0x42813333), SkBits2Float(0x42f83333), SkBits2Float(0x42996666), SkBits2Float(0x4303199a));
5663 path.cubicTo(SkBits2Float(0x4272cccc), SkBits2Float(0x4303199a), SkBits2Float(0x423d3332), SkBits2Float(0x430de667), SkBits2Float(0x422d9999), SkBits2Float(0x431cb334));
5664 path.lineTo(SkBits2Float(0x7086a1dc), SkBits2Float(0x42eecccd));
5665 path.lineTo(SkBits2Float(0x41eb3333), SkBits2Float(0xc12ccccd));
5666 path.lineTo(SkBits2Float(0x42053333), SkBits2Float(0xc1cccccd));
5667 path.lineTo(SkBits2Float(0x42780000), SkBits2Float(0xc18f3334));
5668 path.cubicTo(SkBits2Float(0x43206666), SkBits2Float(0x43134ccd), SkBits2Float(0x43213333), SkBits2Float(0x430db333), SkBits2Float(0x43213333), SkBits2Float(0x43080000));
5669 path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
5670 path.close();
5671 
5672     SkPath path2(path);
5673     testPathOpFailCheck(reporter, path1, path2, (SkPathOp) 2, filename);
5674 }
5675 
fuzz487b(skiatest::Reporter * reporter,const char * filename)5676 static void fuzz487b(skiatest::Reporter* reporter, const char* filename) {
5677     SkPath path;
5678     path.setFillType((SkPath::FillType) 0);
5679 path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
5680 path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000));
5681 path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x429a6666), SkBits2Float(0x42f9999a), SkBits2Float(0x4275999a), SkBits2Float(0x42d70001), SkBits2Float(0x42633333));
5682 path.lineTo(SkBits2Float(0x42e90001), SkBits2Float(0x41b8cccc));
5683 path.cubicTo(SkBits2Float(0x42dc6667), SkBits2Float(0x41ab3332), SkBits2Float(0x42cf3334), SkBits2Float(0x41a3ffff), SkBits2Float(0x42c20001), SkBits2Float(0x41a3ffff));
5684 path.lineTo(SkBits2Float(0x42c20001), SkBits2Float(0x425d999a));
5685 path.lineTo(SkBits2Float(0x42c20001), SkBits2Float(0x425d999a));
5686 path.cubicTo(SkBits2Float(0x429c6668), SkBits2Float(0x425d999a), SkBits2Float(0x4279999c), SkBits2Float(0x42886667), SkBits2Float(0x42673335), SkBits2Float(0x42ab0000));
5687 path.lineTo(SkBits2Float(0x41c0ccd0), SkBits2Float(0x42990000));
5688 path.cubicTo(SkBits2Float(0x41b33336), SkBits2Float(0x42a5999a), SkBits2Float(0x41ac0003), SkBits2Float(0x42b2cccd), SkBits2Float(0x41ac0003), SkBits2Float(0x42c00000));
5689 path.lineTo(SkBits2Float(0x4261999c), SkBits2Float(0x42c00000));
5690 path.lineTo(SkBits2Float(0x4261999c), SkBits2Float(0x42c00000));
5691 path.cubicTo(SkBits2Float(0x4261999c), SkBits2Float(0x434d3333), SkBits2Float(0x4364e667), SkBits2Float(0x4346b333), SkBits2Float(0x4364e667), SkBits2Float(0x43400000));
5692 path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
5693 path.close();
5694 
5695     SkPath path1(path);
5696     path.reset();
5697     path.setFillType((SkPath::FillType) 0);
5698 path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
5699 path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000));
5700 path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x42a20000), SkBits2Float(0x43016667), SkBits2Float(0x4287cccd), SkBits2Float(0x42ea999a), SkBits2Float(0x4273999a));
5701 path.lineTo(SkBits2Float(0x4306cccd), SkBits2Float(0x41f5999a));
5702 path.cubicTo(SkBits2Float(0x42f76667), SkBits2Float(0x41c26667), SkBits2Float(0x42dd999a), SkBits2Float(0x41a4cccd), SkBits2Float(0x42c23334), SkBits2Float(0x41a4cccd));
5703 path.lineTo(SkBits2Float(0x42c23334), SkBits2Float(0x425e0000));
5704 path.cubicTo(SkBits2Float(0x42a43334), SkBits2Float(0x425e0000), SkBits2Float(0x428a0001), SkBits2Float(0x427ecccd), SkBits2Float(0x42780002), SkBits2Float(0x4297999a));
5705 path.lineTo(SkBits2Float(0x41fccccd), SkBits2Float(0x42693333));
5706 path.cubicTo(SkBits2Float(0x41c9999a), SkBits2Float(0x428acccd), SkBits2Float(0x41ac0000), SkBits2Float(0x42a4999a), SkBits2Float(0x41ac0000), SkBits2Float(0x42c00000));
5707 path.lineTo(SkBits2Float(0x4261999a), SkBits2Float(0x42c00000));
5708 path.cubicTo(SkBits2Float(0x4261999a), SkBits2Float(0x42de0000), SkBits2Float(0x42813333), SkBits2Float(0x42f83333), SkBits2Float(0x42996666), SkBits2Float(0x4303199a));
5709 path.cubicTo(SkBits2Float(0x4272cccc), SkBits2Float(0x4303199a), SkBits2Float(0x423d3332), SkBits2Float(0x430de667), SkBits2Float(0x422d9999), SkBits2Float(0x431cb334));
5710 path.lineTo(SkBits2Float(0x7086a1dc), SkBits2Float(0x42eecccd));
5711 path.lineTo(SkBits2Float(0x41eb3333), SkBits2Float(0xc12ccccd));
5712 path.lineTo(SkBits2Float(0x42053333), SkBits2Float(0xc1cccccd));
5713 path.lineTo(SkBits2Float(0x42780000), SkBits2Float(0xc18f3334));
5714 path.cubicTo(SkBits2Float(0x43206666), SkBits2Float(0x43134ccd), SkBits2Float(0x43213333), SkBits2Float(0x430db333), SkBits2Float(0x43213333), SkBits2Float(0x43080000));
5715 path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
5716 path.close();
5717 
5718     SkPath path2(path);
5719     testPathOpCheck(reporter, path1, path2, (SkPathOp) 2, filename, FLAGS_runFail);
5720 }
5721 
fuzz714(skiatest::Reporter * reporter,const char * filename)5722 static void fuzz714(skiatest::Reporter* reporter, const char* filename) {
5723     SkPath path;
5724     path.setFillType((SkPath::FillType) 1);
5725 path.moveTo(SkBits2Float(0x430c0000), SkBits2Float(0x42200000));
5726 path.lineTo(SkBits2Float(0x43480000), SkBits2Float(0x43520000));
5727 path.lineTo(SkBits2Float(0x42200000), SkBits2Float(0x42c80000));
5728 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x42c80000));  // 2.22222e+022f
5729 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x43520000));  // 2.22222e+022f
5730 path.lineTo(SkBits2Float(0x430c0000), SkBits2Float(0x42200000));
5731 path.close();
5732 
5733     SkPath path1(path);
5734     path.reset();
5735     path.setFillType((SkPath::FillType) 0);
5736 path.moveTo(SkBits2Float(0x43200000), SkBits2Float(0x42700000));
5737 path.lineTo(SkBits2Float(0x435c0000), SkBits2Float(0x43660000));
5738 path.lineTo(SkBits2Float(0x42700000), SkBits2Float(0x42f00000));
5739 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x42f00000));  // 2.22222e+022f
5740 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x43660000));  // 2.22222e+022f
5741 path.lineTo(SkBits2Float(0x43200000), SkBits2Float(0x42700000));
5742 path.close();
5743 
5744     SkPath path2(path);
5745     testPathOpCheck(reporter, path1, path2, (SkPathOp) 2, filename, FLAGS_runFail);
5746 }
5747 
fuzz1(skiatest::Reporter * reporter,const char * filename)5748 static void fuzz1(skiatest::Reporter* reporter, const char* filename) {
5749     SkPath path;
5750     path.setFillType((SkPath::FillType) 0);
5751 path.moveTo(SkBits2Float(0x7f800000), SkBits2Float(0x7f800000));
5752 path.quadTo(SkBits2Float(0x7f800000), SkBits2Float(0x7f800000), SkBits2Float(0x7f800000), SkBits2Float(0x7f800000));
5753 path.quadTo(SkBits2Float(0x7f800000), SkBits2Float(0x7f800000), SkBits2Float(0x7f800000), SkBits2Float(0x7f800000));
5754 path.quadTo(SkBits2Float(0xffc00000), SkBits2Float(0x7f800000), SkBits2Float(0xffc00000), SkBits2Float(0x7f800000));
5755 path.quadTo(SkBits2Float(0xff000001), SkBits2Float(0x7f800000), SkBits2Float(0xff000001), SkBits2Float(0x7f800000));
5756 path.quadTo(SkBits2Float(0xff000001), SkBits2Float(0xffc00000), SkBits2Float(0xffc00000), SkBits2Float(0xffc00000));
5757 path.quadTo(SkBits2Float(0xffc00000), SkBits2Float(0xff000001), SkBits2Float(0x7f800000), SkBits2Float(0xff000001));
5758 path.quadTo(SkBits2Float(0x7f800000), SkBits2Float(0xff000001), SkBits2Float(0x7f800000), SkBits2Float(0xffc00000));
5759 path.quadTo(SkBits2Float(0x7f800000), SkBits2Float(0xffc00000), SkBits2Float(0x7f800000), SkBits2Float(0x7f800000));
5760 path.close();
5761 
5762     SkPath path1(path);
5763     path.reset();
5764     path.setFillType((SkPath::FillType) 0);
5765 
5766     SkPath path2(path);
5767     testPathFailOp(reporter, path1, path2, (SkPathOp) 2, filename);
5768 }
5769 
5770 
fuzz753_91(skiatest::Reporter * reporter,const char * filename)5771 static void fuzz753_91(skiatest::Reporter* reporter, const char* filename) {
5772     SkPath path;
5773     path.setFillType((SkPath::FillType) 0);
5774 path.moveTo(SkBits2Float(0x42910000), SkBits2Float(0x00000000));  // 72.5f, 0
5775 path.lineTo(SkBits2Float(0x42166668), SkBits2Float(0x00000000));  // 37.6f, 0
5776 path.cubicTo(SkBits2Float(0x42166668), SkBits2Float(0xc1966668), SkBits2Float(0x41c66668), SkBits2Float(0xc20a6666), SkBits2Float(0x40f00010), SkBits2Float(0xc21ccccd));  // 37.6f, -18.8f, 24.8f, -34.6f, 7.50001f, -39.2f
5777 path.lineTo(SkBits2Float(0x41840004), SkBits2Float(0xc291cccd));  // 16.5f, -72.9f
5778 path.lineTo(SkBits2Float(0x42fb6668), SkBits2Float(0x42c73334));  // 125.7f, 99.6f
5779 path.lineTo(SkBits2Float(0x43646668), SkBits2Float(0x43880ccd));  // 228.4f, 272.1f
5780 
5781     SkPath path1(path);
5782     path.reset();
5783     path.setFillType((SkPath::FillType) 0);
5784 path.moveTo(SkBits2Float(0x428bf702), SkBits2Float(0xcf223cbf));  // 69.9824f, -2.72189e+09f
5785 path.lineTo(SkBits2Float(0x42112d68), SkBits2Float(0xcf223cbf));  // 36.2943f, -2.72189e+09f
5786 path.cubicTo(SkBits2Float(0x4220d9fc), SkBits2Float(0xcf223cc0), SkBits2Float(0x420ee118), SkBits2Float(0xcf223cc0), SkBits2Float(0x41cef2f8), SkBits2Float(0xcf223cc0));  // 40.2129f, -2.72189e+09f, 35.7198f, -2.72189e+09f, 25.8686f, -2.72189e+09f
5787 path.lineTo(SkBits2Float(0x424a99e0), SkBits2Float(0xcf223cc0));  // 50.6503f, -2.72189e+09f
5788 path.cubicTo(SkBits2Float(0x42266e32), SkBits2Float(0xcf223cc0), SkBits2Float(0x41f0fa20), SkBits2Float(0xcf223cc0), SkBits2Float(0x41872ed4), SkBits2Float(0xcf223cc0));  // 41.6076f, -2.72189e+09f, 30.1221f, -2.72189e+09f, 16.8979f, -2.72189e+09f
5789 path.lineTo(SkBits2Float(0x40f8fbe0), SkBits2Float(0xcf223cc0));  // 7.78075f, -2.72189e+09f
5790 
5791     SkPath path2(path);
5792     testPathFailOp(reporter, path1, path2, (SkPathOp) 2, filename);
5793 }
5794 
bug597926_0(skiatest::Reporter * reporter,const char * filename)5795 static void bug597926_0(skiatest::Reporter* reporter, const char* filename) {
5796 SkPath path;
5797 path.setFillType((SkPath::FillType) 0);
5798 path.moveTo(SkBits2Float(0x43b38000), SkBits2Float(0x433e0000));  // 359, 190
5799 path.lineTo(SkBits2Float(0x40c00000), SkBits2Float(0x449ce000));  // 6, 1255
5800 path.cubicTo(SkBits2Float(0x438c0000), SkBits2Float(0x4497a000), SkBits2Float(0x43e40000), SkBits2Float(0x44750000), SkBits2Float(0x41000000), SkBits2Float(0x44aa2000));  // 280, 1213, 456, 980, 8, 1361
5801 path.moveTo(SkBits2Float(0x43290000), SkBits2Float(0x4431c000));  // 169, 711
5802 path.lineTo(SkBits2Float(0xd987d6ba), SkBits2Float(0xd93d0ad4));  // -4.7794e+15f, -3.32567e+15f
5803 path.conicTo(SkBits2Float(0x43cc8000), SkBits2Float(0x445b8000), SkBits2Float(0xd888b096), SkBits2Float(0xd9a1ebfa), SkBits2Float(0x3ebcb199));  // 409, 878, -1.20234e+15f, -5.69712e+15f, 0.368542f
5804 path.cubicTo(SkBits2Float(0x43c00000), SkBits2Float(0x443a8000), SkBits2Float(0x42380000), SkBits2Float(0x4421c000), SkBits2Float(0x42500000), SkBits2Float(0x448ca000));  // 384, 746, 46, 647, 52, 1125
5805 path.quadTo(SkBits2Float(0x43948000), SkBits2Float(0x42ac0000), SkBits2Float(0x43880000), SkBits2Float(0x4487e000));  // 297, 86, 272, 1087
5806 SkPath path1(path);
5807 path.reset();
5808 path.setFillType((SkPath::FillType) 0);
5809 path.moveTo(SkBits2Float(0xc51d735c), SkBits2Float(0xc49db029));  // -2519.21f, -1261.51f
5810 path.cubicTo(SkBits2Float(0xc51d1dbd), SkBits2Float(0xc49d7a3f), SkBits2Float(0xc51c524a), SkBits2Float(0xc49d1610), SkBits2Float(0xc51d1a96), SkBits2Float(0xc49d86a6));  // -2513.86f, -1259.82f, -2501.14f, -1256.69f, -2513.66f, -1260.21f
5811 path.cubicTo(SkBits2Float(0xc51cd471), SkBits2Float(0xc49d54d0), SkBits2Float(0xc51c2e51), SkBits2Float(0xc49d0081), SkBits2Float(0xc51d197b), SkBits2Float(0xc49d7927));  // -2509.28f, -1258.65f, -2498.89f, -1256.02f, -2513.59f, -1259.79f
5812 path.quadTo(SkBits2Float(0xc51bf7eb), SkBits2Float(0xc49cf010), SkBits2Float(0xc51ba866), SkBits2Float(0xc49cb9e6));  // -2495.49f, -1255.5f, -2490.52f, -1253.81f
5813 path.cubicTo(SkBits2Float(0xc51bac0d), SkBits2Float(0xc49cc50e), SkBits2Float(0xc51c29eb), SkBits2Float(0xc49cfb01), SkBits2Float(0xc51c5bca), SkBits2Float(0xc49d1fa6));  // -2490.75f, -1254.16f, -2498.62f, -1255.84f, -2501.74f, -1256.99f
5814 SkPath path2(path);
5815 testPathFailOp(reporter, path1, path2, (SkPathOp) 1, filename);
5816 }
5817 
5818 static struct TestDesc failTests[] = {
5819     TEST(bug597926_0),
5820     TEST(fuzz535151),
5821     TEST(fuzz753_91),
5822     TEST(fuzz714),
5823     TEST(fuzz487a),
5824     TEST(fuzz433),
5825     TEST(fuzz1),
5826     TEST(fuzz487b),
5827     TEST(fuzz433b),
5828     TEST(bufferOverflow),
5829 };
5830 
5831 static const size_t failTestCount = SK_ARRAY_COUNT(failTests);
5832 
DEF_TEST(PathOpsFailOp,reporter)5833 DEF_TEST(PathOpsFailOp, reporter) {
5834 #if DEBUG_SHOW_TEST_NAME
5835     strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
5836 #endif
5837     RunTestSet(reporter, failTests, failTestCount, nullptr, nullptr, nullptr, false);
5838 }
5839