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
9#define TEST(name) { name, #name }
10
11static void testLine1(skiatest::Reporter* reporter) {
12    SkPath path;
13    path.moveTo(2,0);
14    path.lineTo(1,1);
15    path.lineTo(0,0);
16    path.close();
17    testSimplify(reporter, path);
18}
19
20static void testLine1x(skiatest::Reporter* reporter) {
21    SkPath path;
22    path.setFillType(SkPath::kEvenOdd_FillType);
23    path.moveTo(2,0);
24    path.lineTo(1,1);
25    path.lineTo(0,0);
26    path.close();
27    testSimplify(reporter, path);
28}
29
30static void addInnerCWTriangle(SkPath& path) {
31    path.moveTo(3,0);
32    path.lineTo(4,1);
33    path.lineTo(2,1);
34    path.close();
35}
36
37static void addInnerCCWTriangle(SkPath& path) {
38    path.moveTo(3,0);
39    path.lineTo(2,1);
40    path.lineTo(4,1);
41    path.close();
42}
43
44static void addOuterCWTriangle(SkPath& path) {
45    path.moveTo(3,0);
46    path.lineTo(6,2);
47    path.lineTo(0,2);
48    path.close();
49}
50
51static void addOuterCCWTriangle(SkPath& path) {
52    path.moveTo(3,0);
53    path.lineTo(0,2);
54    path.lineTo(6,2);
55    path.close();
56}
57
58static void testLine2(skiatest::Reporter* reporter) {
59    SkPath path;
60    path.setFillType(SkPath::kEvenOdd_FillType);
61    addInnerCWTriangle(path);
62    addOuterCWTriangle(path);
63    testSimplify(reporter, path);
64}
65
66static void testLine2x(skiatest::Reporter* reporter) {
67    SkPath path;
68    path.setFillType(SkPath::kEvenOdd_FillType);
69    addInnerCWTriangle(path);
70    addOuterCWTriangle(path);
71    testSimplify(reporter, path);
72}
73
74static void testLine3(skiatest::Reporter* reporter) {
75    SkPath path;
76    path.setFillType(SkPath::kEvenOdd_FillType);
77    addInnerCCWTriangle(path);
78    addOuterCWTriangle(path);
79    testSimplify(reporter, path);
80}
81
82static void testLine3x(skiatest::Reporter* reporter) {
83    SkPath path;
84    path.setFillType(SkPath::kEvenOdd_FillType);
85    addInnerCCWTriangle(path);
86    addOuterCWTriangle(path);
87    testSimplify(reporter, path);
88}
89
90static void testLine3a(skiatest::Reporter* reporter) {
91    SkPath path;
92    addInnerCWTriangle(path);
93    addOuterCCWTriangle(path);
94    testSimplify(reporter, path);
95}
96
97static void testLine3ax(skiatest::Reporter* reporter) {
98    SkPath path;
99    path.setFillType(SkPath::kEvenOdd_FillType);
100    addInnerCWTriangle(path);
101    addOuterCCWTriangle(path);
102    testSimplify(reporter, path);
103}
104
105static void testLine3b(skiatest::Reporter* reporter) {
106    SkPath path;
107    addInnerCCWTriangle(path);
108    addOuterCCWTriangle(path);
109    testSimplify(reporter, path);
110}
111
112static void testLine3bx(skiatest::Reporter* reporter) {
113    SkPath path;
114    path.setFillType(SkPath::kEvenOdd_FillType);
115    addInnerCCWTriangle(path);
116    addOuterCCWTriangle(path);
117    testSimplify(reporter, path);
118}
119
120static void testLine4(skiatest::Reporter* reporter) {
121    SkPath path;
122    addOuterCCWTriangle(path);
123    addOuterCWTriangle(path);
124    testSimplify(reporter, path);
125}
126
127static void testLine4x(skiatest::Reporter* reporter) {
128    SkPath path;
129    path.setFillType(SkPath::kEvenOdd_FillType);
130    addOuterCCWTriangle(path);
131    addOuterCWTriangle(path);
132    testSimplify(reporter, path);
133}
134
135static void testLine5(skiatest::Reporter* reporter) {
136    SkPath path;
137    addOuterCWTriangle(path);
138    addOuterCWTriangle(path);
139    testSimplify(reporter, path);
140}
141
142static void testLine5x(skiatest::Reporter* reporter) {
143    SkPath path;
144    path.setFillType(SkPath::kEvenOdd_FillType);
145    addOuterCWTriangle(path);
146    addOuterCWTriangle(path);
147    testSimplify(reporter, path);
148}
149
150static void testLine6(skiatest::Reporter* reporter) {
151    SkPath path;
152    path.moveTo(0,0);
153    path.lineTo(4,0);
154    path.lineTo(2,2);
155    path.close();
156    path.moveTo(2,0);
157    path.lineTo(6,0);
158    path.lineTo(4,2);
159    path.close();
160    testSimplify(reporter, path);
161}
162
163static void testLine6x(skiatest::Reporter* reporter) {
164    SkPath path;
165    path.setFillType(SkPath::kEvenOdd_FillType);
166    path.moveTo(0,0);
167    path.lineTo(4,0);
168    path.lineTo(2,2);
169    path.close();
170    path.moveTo(2,0);
171    path.lineTo(6,0);
172    path.lineTo(4,2);
173    path.close();
174    testSimplify(reporter, path);
175}
176
177static void testLine7(skiatest::Reporter* reporter) {
178    SkPath path;
179    path.moveTo(0,0);
180    path.lineTo(4,0);
181    path.lineTo(2,2);
182    path.close();
183    path.moveTo(6,0);
184    path.lineTo(2,0);
185    path.lineTo(4,2);
186    path.close();
187    testSimplify(reporter, path);
188}
189
190static void testLine7x(skiatest::Reporter* reporter) {
191    SkPath path;
192    path.setFillType(SkPath::kEvenOdd_FillType);
193    path.moveTo(0,0);
194    path.lineTo(4,0);
195    path.lineTo(2,2);
196    path.close();
197    path.moveTo(6,0);
198    path.lineTo(2,0);
199    path.lineTo(4,2);
200    path.close();
201    testSimplify(reporter, path);
202}
203
204static void testLine7a(skiatest::Reporter* reporter) {
205    SkPath path;
206    path.moveTo(0,0);
207    path.lineTo(4,0);
208    path.lineTo(2,2);
209    path.close();
210    testSimplify(reporter, path);
211}
212
213static void testLine7ax(skiatest::Reporter* reporter) {
214    SkPath path;
215    path.setFillType(SkPath::kEvenOdd_FillType);
216    path.moveTo(0,0);
217    path.lineTo(4,0);
218    path.lineTo(2,2);
219    path.close();
220    testSimplify(reporter, path);
221}
222
223static void testLine7b(skiatest::Reporter* reporter) {
224    SkPath path;
225    path.moveTo(0,0);
226    path.lineTo(4,0);
227    path.close();
228    path.moveTo(6,0);
229    path.lineTo(2,0);
230    path.lineTo(4,2);
231    path.close();
232    testSimplify(reporter, path);
233}
234
235static void testLine7bx(skiatest::Reporter* reporter) {
236    SkPath path;
237    path.setFillType(SkPath::kEvenOdd_FillType);
238    path.moveTo(0,0);
239    path.lineTo(4,0);
240    path.close();
241    path.moveTo(6,0);
242    path.lineTo(2,0);
243    path.lineTo(4,2);
244    path.close();
245    testSimplify(reporter, path);
246}
247
248static void testLine8(skiatest::Reporter* reporter) {
249    SkPath path;
250    path.moveTo(0,4);
251    path.lineTo(4,4);
252    path.lineTo(2,2);
253    path.close();
254    path.moveTo(2,4);
255    path.lineTo(6,4);
256    path.lineTo(4,2);
257    path.close();
258    testSimplify(reporter, path);
259}
260
261static void testLine8x(skiatest::Reporter* reporter) {
262    SkPath path;
263    path.setFillType(SkPath::kEvenOdd_FillType);
264    path.moveTo(0,4);
265    path.lineTo(4,4);
266    path.lineTo(2,2);
267    path.close();
268    path.moveTo(2,4);
269    path.lineTo(6,4);
270    path.lineTo(4,2);
271    path.close();
272    testSimplify(reporter, path);
273}
274
275static void testLine9(skiatest::Reporter* reporter) {
276    SkPath path;
277    path.moveTo(0,4);
278    path.lineTo(4,4);
279    path.lineTo(2,2);
280    path.close();
281    path.moveTo(6,4);
282    path.lineTo(2,4);
283    path.lineTo(4,2);
284    path.close();
285    testSimplify(reporter, path);
286}
287
288static void testLine9x(skiatest::Reporter* reporter) {
289    SkPath path;
290    path.setFillType(SkPath::kEvenOdd_FillType);
291    path.moveTo(0,4);
292    path.lineTo(4,4);
293    path.lineTo(2,2);
294    path.close();
295    path.moveTo(6,4);
296    path.lineTo(2,4);
297    path.lineTo(4,2);
298    path.close();
299    testSimplify(reporter, path);
300}
301
302static void testLine10(skiatest::Reporter* reporter) {
303    SkPath path;
304    path.moveTo(0,4);
305    path.lineTo(4,4);
306    path.lineTo(2,2);
307    path.close();
308    path.moveTo(2,1);
309    path.lineTo(3,4);
310    path.lineTo(6,1);
311    path.close();
312    testSimplify(reporter, path);
313}
314
315static void testLine10x(skiatest::Reporter* reporter) {
316    SkPath path;
317    path.setFillType(SkPath::kEvenOdd_FillType);
318    path.moveTo(0,4);
319    path.lineTo(4,4);
320    path.lineTo(2,2);
321    path.close();
322    path.moveTo(2,1);
323    path.lineTo(3,4);
324    path.lineTo(6,1);
325    path.close();
326    testSimplify(reporter, path);
327}
328
329static void testLine10a(skiatest::Reporter* reporter) {
330    SkPath path;
331    path.moveTo(0,4);
332    path.lineTo(8,4);
333    path.lineTo(4,0);
334    path.close();
335    path.moveTo(2,2);
336    path.lineTo(3,3);
337    path.lineTo(4,2);
338    path.close();
339    testSimplify(reporter, path);
340}
341
342static void testLine10ax(skiatest::Reporter* reporter) {
343    SkPath path;
344    path.setFillType(SkPath::kEvenOdd_FillType);
345    path.moveTo(0,4);
346    path.lineTo(8,4);
347    path.lineTo(4,0);
348    path.close();
349    path.moveTo(2,2);
350    path.lineTo(3,3);
351    path.lineTo(4,2);
352    path.close();
353    testSimplify(reporter, path);
354}
355
356static void addCWContainer(SkPath& path) {
357    path.moveTo(6,4);
358    path.lineTo(0,4);
359    path.lineTo(3,1);
360    path.close();
361}
362
363static void addCCWContainer(SkPath& path) {
364    path.moveTo(0,4);
365    path.lineTo(6,4);
366    path.lineTo(3,1);
367    path.close();
368}
369
370static void addCWContents(SkPath& path) {
371    path.moveTo(2,3);
372    path.lineTo(3,2);
373    path.lineTo(4,3);
374    path.close();
375}
376
377static void addCCWContents(SkPath& path) {
378    path.moveTo(3,2);
379    path.lineTo(2,3);
380    path.lineTo(4,3);
381    path.close();
382}
383
384static void testLine11(skiatest::Reporter* reporter) {
385    SkPath path;
386    addCWContainer(path);
387    addCWContents(path);
388    testSimplify(reporter, path);
389}
390
391static void testLine11x(skiatest::Reporter* reporter) {
392    SkPath path;
393    path.setFillType(SkPath::kEvenOdd_FillType);
394    addCWContainer(path);
395    addCWContents(path);
396    testSimplify(reporter, path);
397}
398
399static void testLine12(skiatest::Reporter* reporter) {
400    SkPath path;
401    addCCWContainer(path);
402    addCWContents(path);
403    testSimplify(reporter, path);
404}
405
406static void testLine12x(skiatest::Reporter* reporter) {
407    SkPath path;
408    path.setFillType(SkPath::kEvenOdd_FillType);
409    addCCWContainer(path);
410    addCWContents(path);
411    testSimplify(reporter, path);
412}
413
414static void testLine13(skiatest::Reporter* reporter) {
415    SkPath path;
416    addCWContainer(path);
417    addCCWContents(path);
418    testSimplify(reporter, path);
419}
420
421static void testLine13x(skiatest::Reporter* reporter) {
422    SkPath path;
423    path.setFillType(SkPath::kEvenOdd_FillType);
424    addCWContainer(path);
425    addCCWContents(path);
426    testSimplify(reporter, path);
427}
428
429static void testLine14(skiatest::Reporter* reporter) {
430    SkPath path;
431    addCCWContainer(path);
432    addCCWContents(path);
433    testSimplify(reporter, path);
434}
435
436static void testLine14x(skiatest::Reporter* reporter) {
437    SkPath path;
438    path.setFillType(SkPath::kEvenOdd_FillType);
439    addCCWContainer(path);
440    addCCWContents(path);
441    testSimplify(reporter, path);
442}
443
444static void testLine15(skiatest::Reporter* reporter) {
445    SkPath path;
446    path.addRect(0, 0, 9, 9, SkPath::kCW_Direction);
447    testSimplify(reporter, path);
448}
449
450static void testLine15x(skiatest::Reporter* reporter) {
451    SkPath path;
452    path.setFillType(SkPath::kEvenOdd_FillType);
453    path.addRect(0, 0, 9, 9, SkPath::kCW_Direction);
454    testSimplify(reporter, path);
455}
456
457static void testLine16(skiatest::Reporter* reporter) {
458    SkPath path;
459    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
460    path.addRect(0, 4, 9, 9, SkPath::kCW_Direction);
461    testSimplify(reporter, path);
462}
463
464static void testLine16x(skiatest::Reporter* reporter) {
465    SkPath path;
466    path.setFillType(SkPath::kEvenOdd_FillType);
467    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
468    path.addRect(0, 4, 9, 9, SkPath::kCW_Direction);
469    testSimplify(reporter, path);
470}
471
472static void testLine17(skiatest::Reporter* reporter) {
473    SkPath path;
474    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
475    path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
476    testSimplify(reporter, path);
477}
478
479static void testLine17x(skiatest::Reporter* reporter) {
480    SkPath path;
481    path.setFillType(SkPath::kEvenOdd_FillType);
482    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
483    path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
484    testSimplify(reporter, path);
485}
486
487static void testLine18(skiatest::Reporter* reporter) {
488    SkPath path;
489    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
490    path.addRect(12, 4, 21, 21, SkPath::kCW_Direction);
491    testSimplify(reporter, path);
492}
493
494static void testLine18x(skiatest::Reporter* reporter) {
495    SkPath path;
496    path.setFillType(SkPath::kEvenOdd_FillType);
497    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
498    path.addRect(12, 4, 21, 21, SkPath::kCW_Direction);
499    testSimplify(reporter, path);
500}
501
502static void testLine19(skiatest::Reporter* reporter) {
503    SkPath path;
504    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
505    path.addRect(12, 16, 21, 21, SkPath::kCW_Direction);
506    testSimplify(reporter, path);
507}
508
509static void testLine19x(skiatest::Reporter* reporter) {
510    SkPath path;
511    path.setFillType(SkPath::kEvenOdd_FillType);
512    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
513    path.addRect(12, 16, 21, 21, SkPath::kCW_Direction);
514    testSimplify(reporter, path);
515}
516
517static void testLine20(skiatest::Reporter* reporter) {
518    SkPath path;
519    path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
520    path.addRect(0, 12, 9, 9, SkPath::kCW_Direction);
521    testSimplify(reporter, path);
522}
523
524static void testLine20x(skiatest::Reporter* reporter) {
525    SkPath path;
526    path.setFillType(SkPath::kEvenOdd_FillType);
527    path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
528    path.addRect(0, 12, 9, 9, SkPath::kCW_Direction);
529    testSimplify(reporter, path);
530}
531
532static void testLine21(skiatest::Reporter* reporter) {
533    SkPath path;
534    path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
535    path.addRect(0, 16, 9, 9, SkPath::kCW_Direction);
536    testSimplify(reporter, path);
537}
538
539static void testLine21x(skiatest::Reporter* reporter) {
540    SkPath path;
541    path.setFillType(SkPath::kEvenOdd_FillType);
542    path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
543    path.addRect(0, 16, 9, 9, SkPath::kCW_Direction);
544    testSimplify(reporter, path);
545}
546
547static void testLine22(skiatest::Reporter* reporter) {
548    SkPath path;
549    path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
550    path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
551    testSimplify(reporter, path);
552}
553
554static void testLine22x(skiatest::Reporter* reporter) {
555    SkPath path;
556    path.setFillType(SkPath::kEvenOdd_FillType);
557    path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
558    path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
559    testSimplify(reporter, path);
560}
561
562static void testLine23(skiatest::Reporter* reporter) {
563    SkPath path;
564    path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
565    path.addRect(12, 0, 21, 21, SkPath::kCW_Direction);
566    testSimplify(reporter, path);
567}
568
569static void testLine23x(skiatest::Reporter* reporter) {
570    SkPath path;
571    path.setFillType(SkPath::kEvenOdd_FillType);
572    path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
573    path.addRect(12, 0, 21, 21, SkPath::kCW_Direction);
574    testSimplify(reporter, path);
575}
576
577static void testLine24a(skiatest::Reporter* reporter) {
578    SkPath path;
579    path.moveTo(2,0);
580    path.lineTo(4,4);
581    path.lineTo(0,4);
582    path.close();
583    path.moveTo(2,0);
584    path.lineTo(1,2);
585    path.lineTo(2,2);
586    path.close();
587    testSimplify(reporter, path);
588}
589
590static void testLine24ax(skiatest::Reporter* reporter) {
591    SkPath path;
592    path.setFillType(SkPath::kEvenOdd_FillType);
593    path.moveTo(2,0);
594    path.lineTo(4,4);
595    path.lineTo(0,4);
596    path.close();
597    path.moveTo(2,0);
598    path.lineTo(1,2);
599    path.lineTo(2,2);
600    path.close();
601    testSimplify(reporter, path);
602}
603
604static void testLine24(skiatest::Reporter* reporter) {
605    SkPath path;
606    path.addRect(0, 18, 12, 12, SkPath::kCW_Direction);
607    path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
608    testSimplify(reporter, path);
609}
610
611static void testLine24x(skiatest::Reporter* reporter) {
612    SkPath path;
613    path.setFillType(SkPath::kEvenOdd_FillType);
614    path.addRect(0, 18, 12, 12, SkPath::kCW_Direction);
615    path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
616    testSimplify(reporter, path);
617}
618
619static void testLine25(skiatest::Reporter* reporter) {
620    SkPath path;
621    path.addRect(0, 6, 12, 12, SkPath::kCW_Direction);
622    path.addRect(12, 0, 21, 21, SkPath::kCW_Direction);
623    testSimplify(reporter, path);
624}
625
626static void testLine25x(skiatest::Reporter* reporter) {
627    SkPath path;
628    path.setFillType(SkPath::kEvenOdd_FillType);
629    path.addRect(0, 6, 12, 12, SkPath::kCW_Direction);
630    path.addRect(12, 0, 21, 21, SkPath::kCW_Direction);
631    testSimplify(reporter, path);
632}
633
634static void testLine26(skiatest::Reporter* reporter) {
635    SkPath path;
636    path.addRect(0, 18, 12, 12, SkPath::kCW_Direction);
637    path.addRect(0, 12, 9, 9, SkPath::kCW_Direction);
638    testSimplify(reporter, path);
639}
640
641static void testLine26x(skiatest::Reporter* reporter) {
642    SkPath path;
643    path.setFillType(SkPath::kEvenOdd_FillType);
644    path.addRect(0, 18, 12, 12, SkPath::kCW_Direction);
645    path.addRect(0, 12, 9, 9, SkPath::kCW_Direction);
646    testSimplify(reporter, path);
647}
648
649static void testLine27(skiatest::Reporter* reporter) {
650    SkPath path;
651    path.addRect(0, 18, 12, 12, SkPath::kCW_Direction);
652    path.addRect(12, 8, 21, 21, SkPath::kCW_Direction);
653    testSimplify(reporter, path);
654}
655
656static void testLine27x(skiatest::Reporter* reporter) {
657    SkPath path;
658    path.setFillType(SkPath::kEvenOdd_FillType);
659    path.addRect(0, 18, 12, 12, SkPath::kCW_Direction);
660    path.addRect(12, 8, 21, 21, SkPath::kCW_Direction);
661    testSimplify(reporter, path);
662}
663
664static void testLine28(skiatest::Reporter* reporter) {
665    SkPath path;
666    path.addRect(0, 6, 12, 12, SkPath::kCW_Direction);
667    path.addRect(0, 0, 9, 9, SkPath::kCW_Direction);
668    testSimplify(reporter, path);
669}
670
671static void testLine28x(skiatest::Reporter* reporter) {
672    SkPath path;
673    path.setFillType(SkPath::kEvenOdd_FillType);
674    path.addRect(0, 6, 12, 12, SkPath::kCW_Direction);
675    path.addRect(0, 0, 9, 9, SkPath::kCW_Direction);
676    testSimplify(reporter, path);
677}
678
679static void testLine29(skiatest::Reporter* reporter) {
680    SkPath path;
681    path.addRect(0, 18, 12, 12, SkPath::kCW_Direction);
682    path.addRect(12, 12, 21, 21, SkPath::kCW_Direction);
683    testSimplify(reporter, path);
684}
685
686static void testLine29x(skiatest::Reporter* reporter) {
687    SkPath path;
688    path.setFillType(SkPath::kEvenOdd_FillType);
689    path.addRect(0, 18, 12, 12, SkPath::kCW_Direction);
690    path.addRect(12, 12, 21, 21, SkPath::kCW_Direction);
691    testSimplify(reporter, path);
692}
693
694static void testLine30(skiatest::Reporter* reporter) {
695    SkPath path;
696    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
697    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
698    path.addRect(4, 4, 13, 13, SkPath::kCW_Direction);
699    testSimplify(reporter, path);
700}
701
702static void testLine30x(skiatest::Reporter* reporter) {
703    SkPath path;
704    path.setFillType(SkPath::kEvenOdd_FillType);
705    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
706    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
707    path.addRect(4, 4, 13, 13, SkPath::kCW_Direction);
708    testSimplify(reporter, path);
709}
710
711static void testLine31(skiatest::Reporter* reporter) {
712    SkPath path;
713    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
714    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
715    path.addRect(0, 4, 9, 9, SkPath::kCW_Direction);
716    testSimplify(reporter, path);
717}
718
719static void testLine31x(skiatest::Reporter* reporter) {
720    SkPath path;
721    path.setFillType(SkPath::kEvenOdd_FillType);
722    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
723    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
724    path.addRect(0, 4, 9, 9, SkPath::kCW_Direction);
725    testSimplify(reporter, path);
726}
727
728static void testLine32(skiatest::Reporter* reporter) {
729    SkPath path;
730    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
731    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
732    path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
733    testSimplify(reporter, path);
734}
735
736static void testLine32x(skiatest::Reporter* reporter) {
737    SkPath path;
738    path.setFillType(SkPath::kEvenOdd_FillType);
739    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
740    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
741    path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
742    testSimplify(reporter, path);
743}
744
745static void testLine33(skiatest::Reporter* reporter) {
746    SkPath path;
747    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
748    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
749    path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
750    testSimplify(reporter, path);
751}
752
753static void testLine33x(skiatest::Reporter* reporter) {
754    SkPath path;
755    path.setFillType(SkPath::kEvenOdd_FillType);
756    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
757    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
758    path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
759    testSimplify(reporter, path);
760}
761
762static void testLine34(skiatest::Reporter* reporter) {
763    SkPath path;
764    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
765    path.addRect(0, 6, 12, 12, SkPath::kCW_Direction);
766    path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
767    testSimplify(reporter, path);
768}
769
770static void testLine34x(skiatest::Reporter* reporter) {
771    SkPath path;
772    path.setFillType(SkPath::kEvenOdd_FillType);
773    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
774    path.addRect(0, 6, 12, 12, SkPath::kCW_Direction);
775    path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
776    testSimplify(reporter, path);
777}
778
779static void testLine35(skiatest::Reporter* reporter) {
780    SkPath path;
781    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
782    path.addRect(6, 0, 18, 18, SkPath::kCW_Direction);
783    path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
784    testSimplify(reporter, path);
785}
786
787static void testLine35x(skiatest::Reporter* reporter) {
788    SkPath path;
789    path.setFillType(SkPath::kEvenOdd_FillType);
790    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
791    path.addRect(6, 0, 18, 18, SkPath::kCW_Direction);
792    path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
793    testSimplify(reporter, path);
794}
795
796static void testLine36(skiatest::Reporter* reporter) {
797    SkPath path;
798    path.addRect(0, 10, 20, 20, SkPath::kCW_Direction);
799    path.addRect(6, 12, 18, 18, SkPath::kCW_Direction);
800    path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
801    testSimplify(reporter, path);
802}
803
804static void testLine36x(skiatest::Reporter* reporter) {
805    SkPath path;
806    path.setFillType(SkPath::kEvenOdd_FillType);
807    path.addRect(0, 10, 20, 20, SkPath::kCW_Direction);
808    path.addRect(6, 12, 18, 18, SkPath::kCW_Direction);
809    path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
810    testSimplify(reporter, path);
811}
812
813static void testLine37(skiatest::Reporter* reporter) {
814    SkPath path;
815    path.addRect(0, 20, 20, 20, SkPath::kCW_Direction);
816    path.addRect(18, 24, 30, 30, SkPath::kCW_Direction);
817    path.addRect(0, 0, 9, 9, SkPath::kCW_Direction);
818    testSimplify(reporter, path);
819}
820
821static void testLine37x(skiatest::Reporter* reporter) {
822    SkPath path;
823    path.setFillType(SkPath::kEvenOdd_FillType);
824    path.addRect(0, 20, 20, 20, SkPath::kCW_Direction);
825    path.addRect(18, 24, 30, 30, SkPath::kCW_Direction);
826    path.addRect(0, 0, 9, 9, SkPath::kCW_Direction);
827    testSimplify(reporter, path);
828}
829
830static void testLine38(skiatest::Reporter* reporter) {
831    SkPath path;
832    path.addRect(10, 0, 30, 30, SkPath::kCW_Direction);
833    path.addRect(6, 12, 18, 18, SkPath::kCW_Direction);
834    path.addRect(12, 12, 21, 21, SkPath::kCW_Direction);
835    testSimplify(reporter, path);
836}
837
838static void testLine38x(skiatest::Reporter* reporter) {
839    SkPath path;
840    path.setFillType(SkPath::kEvenOdd_FillType);
841    path.addRect(10, 0, 30, 30, SkPath::kCW_Direction);
842    path.addRect(6, 12, 18, 18, SkPath::kCW_Direction);
843    path.addRect(12, 12, 21, 21, SkPath::kCW_Direction);
844    testSimplify(reporter, path);
845}
846
847static void testLine40(skiatest::Reporter* reporter) {
848    SkPath path;
849    path.addRect(10, 0, 30, 30, SkPath::kCW_Direction);
850    path.addRect(12, 18, 24, 24, SkPath::kCW_Direction);
851    path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
852    testSimplify(reporter, path);
853}
854
855static void testLine40x(skiatest::Reporter* reporter) {
856    SkPath path;
857    path.setFillType(SkPath::kEvenOdd_FillType);
858    path.addRect(10, 0, 30, 30, SkPath::kCW_Direction);
859    path.addRect(12, 18, 24, 24, SkPath::kCW_Direction);
860    path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
861    testSimplify(reporter, path);
862}
863
864static void testLine41(skiatest::Reporter* reporter) {
865    SkPath path;
866    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
867    path.addRect(18, 24, 30, 30, SkPath::kCW_Direction);
868    path.addRect(12, 0, 21, 21, SkPath::kCW_Direction);
869    testSimplify(reporter, path);
870}
871
872static void testLine41x(skiatest::Reporter* reporter) {
873    SkPath path;
874    path.setFillType(SkPath::kEvenOdd_FillType);
875    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
876    path.addRect(18, 24, 30, 30, SkPath::kCW_Direction);
877    path.addRect(12, 0, 21, 21, SkPath::kCW_Direction);
878    testSimplify(reporter, path);
879}
880
881static void testLine42(skiatest::Reporter* reporter) {
882    SkPath path;
883    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
884    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
885    path.addRect(8, 16, 17, 17, SkPath::kCW_Direction);
886    testSimplify(reporter, path);
887}
888
889static void testLine42x(skiatest::Reporter* reporter) {
890    SkPath path;
891    path.setFillType(SkPath::kEvenOdd_FillType);
892    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
893    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
894    path.addRect(8, 16, 17, 17, SkPath::kCW_Direction);
895    testSimplify(reporter, path);
896}
897
898static void testLine43(skiatest::Reporter* reporter) {
899    SkPath path;
900    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
901    path.addRect(6, 24, 18, 18, SkPath::kCW_Direction);
902    path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
903    testSimplify(reporter, path);
904}
905
906static void testLine43x(skiatest::Reporter* reporter) {
907    SkPath path;
908    path.setFillType(SkPath::kEvenOdd_FillType);
909    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
910    path.addRect(6, 24, 18, 18, SkPath::kCW_Direction);
911    path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
912    testSimplify(reporter, path);
913}
914
915static void testLine44(skiatest::Reporter* reporter) {
916    SkPath path;
917    path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
918    path.addRect(18, 0, 30, 30, SkPath::kCW_Direction);
919    path.addRect(18, 32, 27, 36, SkPath::kCCW_Direction);
920    testSimplify(reporter, path);
921}
922
923static void testLine44x(skiatest::Reporter* reporter) {
924    SkPath path;
925    path.setFillType(SkPath::kEvenOdd_FillType);
926    path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
927    path.addRect(18, 0, 30, 30, SkPath::kCW_Direction);
928    path.addRect(18, 32, 27, 36, SkPath::kCCW_Direction);
929    testSimplify(reporter, path);
930}
931
932static void testLine45(skiatest::Reporter* reporter) {
933    SkPath path;
934    path.addRect(10, 0, 30, 30, SkPath::kCW_Direction);
935    path.addRect(18, 0, 30, 30, SkPath::kCW_Direction);
936    path.addRect(24, 32, 33, 36, SkPath::kCW_Direction);
937    testSimplify(reporter, path);
938}
939
940static void testLine45x(skiatest::Reporter* reporter) {
941    SkPath path;
942    path.setFillType(SkPath::kEvenOdd_FillType);
943    path.addRect(10, 0, 30, 30, SkPath::kCW_Direction);
944    path.addRect(18, 0, 30, 30, SkPath::kCW_Direction);
945    path.addRect(24, 32, 33, 36, SkPath::kCW_Direction);
946    testSimplify(reporter, path);
947}
948
949static void testLine46(skiatest::Reporter* reporter) {
950    SkPath path;
951    path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
952    path.addRect(24, 0, 36, 36, SkPath::kCW_Direction);
953    path.addRect(24, 32, 33, 36, SkPath::kCW_Direction);
954    testSimplify(reporter, path);
955}
956
957static void testLine46x(skiatest::Reporter* reporter) {
958    SkPath path;
959    path.setFillType(SkPath::kEvenOdd_FillType);
960    path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
961    path.addRect(24, 0, 36, 36, SkPath::kCW_Direction);
962    path.addRect(24, 32, 33, 36, SkPath::kCW_Direction);
963    testSimplify(reporter, path);
964}
965
966static void testLine47(skiatest::Reporter* reporter) {
967    SkPath path;
968    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
969    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
970    path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction);
971    testSimplify(reporter, path);
972}
973
974static void testLine47x(skiatest::Reporter* reporter) {
975    SkPath path;
976    path.setFillType(SkPath::kEvenOdd_FillType);
977    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
978    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
979    path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction);
980    testSimplify(reporter, path);
981}
982
983static void testLine48(skiatest::Reporter* reporter) {
984    SkPath path;
985    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
986    path.addRect(0, 6, 12, 12, SkPath::kCW_Direction);
987    path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction);
988    testSimplify(reporter, path);
989}
990
991static void testLine48x(skiatest::Reporter* reporter) {
992    SkPath path;
993    path.setFillType(SkPath::kEvenOdd_FillType);
994    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
995    path.addRect(0, 6, 12, 12, SkPath::kCW_Direction);
996    path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction);
997    testSimplify(reporter, path);
998}
999
1000static void testLine49(skiatest::Reporter* reporter) {
1001    SkPath path;
1002    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1003    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
1004    path.addRect(0, 0, 9, 9, SkPath::kCW_Direction);
1005    testSimplify(reporter, path);
1006}
1007
1008static void testLine49x(skiatest::Reporter* reporter) {
1009    SkPath path;
1010    path.setFillType(SkPath::kEvenOdd_FillType);
1011    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1012    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
1013    path.addRect(0, 0, 9, 9, SkPath::kCW_Direction);
1014    testSimplify(reporter, path);
1015}
1016
1017static void testLine50(skiatest::Reporter* reporter) {
1018    SkPath path;
1019    path.addRect(10, 30, 30, 30, SkPath::kCW_Direction);
1020    path.addRect(24, 20, 36, 30, SkPath::kCW_Direction);
1021    testSimplify(reporter, path);
1022}
1023
1024static void testLine50x(skiatest::Reporter* reporter) {
1025    SkPath path;
1026    path.setFillType(SkPath::kEvenOdd_FillType);
1027    path.addRect(10, 30, 30, 30, SkPath::kCW_Direction);
1028    path.addRect(24, 20, 36, 30, SkPath::kCW_Direction);
1029    testSimplify(reporter, path);
1030}
1031
1032static void testLine51(skiatest::Reporter* reporter) {
1033    SkPath path;
1034    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1035    path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
1036    path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction);
1037    testSimplify(reporter, path);
1038}
1039
1040static void testLine51x(skiatest::Reporter* reporter) {
1041    SkPath path;
1042    path.setFillType(SkPath::kEvenOdd_FillType);
1043    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1044    path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
1045    path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction);
1046    testSimplify(reporter, path);
1047}
1048
1049static void testLine52(skiatest::Reporter* reporter) {
1050    SkPath path;
1051    path.addRect(0, 30, 20, 20, SkPath::kCW_Direction);
1052    path.addRect(6, 20, 18, 30, SkPath::kCW_Direction);
1053    path.addRect(32, 0, 36, 41, SkPath::kCW_Direction);
1054    testSimplify(reporter, path);
1055}
1056
1057static void testLine52x(skiatest::Reporter* reporter) {
1058    SkPath path;
1059    path.setFillType(SkPath::kEvenOdd_FillType);
1060    path.addRect(0, 30, 20, 20, SkPath::kCW_Direction);
1061    path.addRect(6, 20, 18, 30, SkPath::kCW_Direction);
1062    path.addRect(32, 0, 36, 41, SkPath::kCW_Direction);
1063    testSimplify(reporter, path);
1064}
1065
1066static void testLine53(skiatest::Reporter* reporter) {
1067    SkPath path;
1068    path.addRect(10, 30, 30, 30, SkPath::kCW_Direction);
1069    path.addRect(12, 20, 24, 30, SkPath::kCW_Direction);
1070    path.addRect(12, 32, 21, 36, SkPath::kCCW_Direction);
1071    testSimplify(reporter, path);
1072}
1073
1074static void testLine53x(skiatest::Reporter* reporter) {
1075    SkPath path;
1076    path.setFillType(SkPath::kEvenOdd_FillType);
1077    path.addRect(10, 30, 30, 30, SkPath::kCW_Direction);
1078    path.addRect(12, 20, 24, 30, SkPath::kCW_Direction);
1079    path.addRect(12, 32, 21, 36, SkPath::kCCW_Direction);
1080    testSimplify(reporter, path);
1081}
1082
1083static void testLine54(skiatest::Reporter* reporter) {
1084    SkPath path;
1085    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1086    path.addRect(6, 0, 18, 18, SkPath::kCW_Direction);
1087    path.addRect(8, 4, 17, 17, SkPath::kCCW_Direction);
1088    testSimplify(reporter, path);
1089}
1090
1091static void testLine54x(skiatest::Reporter* reporter) {
1092    SkPath path;
1093    path.setFillType(SkPath::kEvenOdd_FillType);
1094    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1095    path.addRect(6, 0, 18, 18, SkPath::kCW_Direction);
1096    path.addRect(8, 4, 17, 17, SkPath::kCCW_Direction);
1097    testSimplify(reporter, path);
1098}
1099
1100static void testLine55(skiatest::Reporter* reporter) {
1101    SkPath path;
1102    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1103    path.addRect(6, 6, 18, 18, SkPath::kCW_Direction);
1104    path.addRect(4, 4, 13, 13, SkPath::kCCW_Direction);
1105    testSimplify(reporter, path);
1106}
1107
1108static void testLine55x(skiatest::Reporter* reporter) {
1109    SkPath path;
1110    path.setFillType(SkPath::kEvenOdd_FillType);
1111    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1112    path.addRect(6, 6, 18, 18, SkPath::kCW_Direction);
1113    path.addRect(4, 4, 13, 13, SkPath::kCCW_Direction);
1114    testSimplify(reporter, path);
1115}
1116
1117static void testLine56(skiatest::Reporter* reporter) {
1118    SkPath path;
1119    path.addRect(0, 20, 20, 20, SkPath::kCW_Direction);
1120    path.addRect(18, 20, 30, 30, SkPath::kCW_Direction);
1121    path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
1122    testSimplify(reporter, path);
1123}
1124
1125static void testLine56x(skiatest::Reporter* reporter) {
1126    SkPath path;
1127    path.setFillType(SkPath::kEvenOdd_FillType);
1128    path.addRect(0, 20, 20, 20, SkPath::kCW_Direction);
1129    path.addRect(18, 20, 30, 30, SkPath::kCW_Direction);
1130    path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
1131    testSimplify(reporter, path);
1132}
1133
1134static void testLine57(skiatest::Reporter* reporter) {
1135    SkPath path;
1136    path.addRect(20, 0, 40, 40, SkPath::kCW_Direction);
1137    path.addRect(20, 0, 30, 40, SkPath::kCW_Direction);
1138    path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
1139    testSimplify(reporter, path);
1140}
1141
1142static void testLine57x(skiatest::Reporter* reporter) {
1143    SkPath path;
1144    path.setFillType(SkPath::kEvenOdd_FillType);
1145    path.addRect(20, 0, 40, 40, SkPath::kCW_Direction);
1146    path.addRect(20, 0, 30, 40, SkPath::kCW_Direction);
1147    path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
1148    testSimplify(reporter, path);
1149}
1150
1151static void testLine58(skiatest::Reporter* reporter) {
1152    SkPath path;
1153    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1154    path.addRect(0, 0, 12, 12, SkPath::kCCW_Direction);
1155    path.addRect(0, 12, 9, 9, SkPath::kCCW_Direction);
1156    testSimplify(reporter, path);
1157}
1158
1159static void testLine58x(skiatest::Reporter* reporter) {
1160    SkPath path;
1161    path.setFillType(SkPath::kEvenOdd_FillType);
1162    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1163    path.addRect(0, 0, 12, 12, SkPath::kCCW_Direction);
1164    path.addRect(0, 12, 9, 9, SkPath::kCCW_Direction);
1165    testSimplify(reporter, path);
1166}
1167
1168static void testLine59(skiatest::Reporter* reporter) {
1169    SkPath path;
1170    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1171    path.addRect(6, 6, 18, 18, SkPath::kCCW_Direction);
1172    path.addRect(4, 4, 13, 13, SkPath::kCCW_Direction);
1173    testSimplify(reporter, path);
1174}
1175
1176static void testLine59x(skiatest::Reporter* reporter) {
1177    SkPath path;
1178    path.setFillType(SkPath::kEvenOdd_FillType);
1179    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1180    path.addRect(6, 6, 18, 18, SkPath::kCCW_Direction);
1181    path.addRect(4, 4, 13, 13, SkPath::kCCW_Direction);
1182    testSimplify(reporter, path);
1183}
1184
1185static void testLine60(skiatest::Reporter* reporter) {
1186    SkPath path;
1187    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1188    path.addRect(6, 12, 18, 18, SkPath::kCCW_Direction);
1189    path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction);
1190    testSimplify(reporter, path);
1191}
1192
1193static void testLine60x(skiatest::Reporter* reporter) {
1194    SkPath path;
1195    path.setFillType(SkPath::kEvenOdd_FillType);
1196    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1197    path.addRect(6, 12, 18, 18, SkPath::kCCW_Direction);
1198    path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction);
1199    testSimplify(reporter, path);
1200}
1201
1202static void testLine61(skiatest::Reporter* reporter) {
1203    SkPath path;
1204    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1205    path.addRect(12, 0, 24, 24, SkPath::kCCW_Direction);
1206    path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
1207    testSimplify(reporter, path);
1208}
1209
1210static void testLine61x(skiatest::Reporter* reporter) {
1211    SkPath path;
1212    path.setFillType(SkPath::kEvenOdd_FillType);
1213    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1214    path.addRect(12, 0, 24, 24, SkPath::kCCW_Direction);
1215    path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
1216    testSimplify(reporter, path);
1217}
1218
1219static void testLine62(skiatest::Reporter* reporter) {
1220    SkPath path;
1221    path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
1222    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1223    path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
1224    path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction);
1225    testSimplify(reporter, path);
1226}
1227
1228static void testLine62x(skiatest::Reporter* reporter) {
1229    SkPath path;
1230    path.setFillType(SkPath::kEvenOdd_FillType);
1231    path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
1232    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1233    path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
1234    path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction);
1235    testSimplify(reporter, path);
1236}
1237
1238static void testLine63(skiatest::Reporter* reporter) {
1239    SkPath path;
1240    path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
1241    path.addRect(0, 10, 20, 20, SkPath::kCW_Direction);
1242    path.addRect(0, 6, 12, 12, SkPath::kCCW_Direction);
1243    path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
1244    testSimplify(reporter, path);
1245}
1246
1247static void testLine63x(skiatest::Reporter* reporter) {
1248    SkPath path;
1249    path.setFillType(SkPath::kEvenOdd_FillType);
1250    path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
1251    path.addRect(0, 10, 20, 20, SkPath::kCW_Direction);
1252    path.addRect(0, 6, 12, 12, SkPath::kCCW_Direction);
1253    path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
1254    testSimplify(reporter, path);
1255}
1256
1257static void testLine64(skiatest::Reporter* reporter) {
1258    SkPath path;
1259    path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
1260    path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
1261    path.addRect(18, 6, 30, 30, SkPath::kCW_Direction);
1262    testSimplify(reporter, path);
1263}
1264
1265static void testLine64x(skiatest::Reporter* reporter) {
1266    SkPath path;
1267    path.setFillType(SkPath::kEvenOdd_FillType);
1268    path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
1269    path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
1270    path.addRect(18, 6, 30, 30, SkPath::kCW_Direction);
1271    testSimplify(reporter, path);
1272}
1273
1274static void testLine65(skiatest::Reporter* reporter) {
1275    SkPath path;
1276    path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
1277    path.addRect(10, 0, 30, 30, SkPath::kCW_Direction);
1278    path.addRect(24, 0, 36, 36, SkPath::kCW_Direction);
1279    path.addRect(32, 6, 36, 41, SkPath::kCCW_Direction);
1280    testSimplify(reporter, path);
1281}
1282
1283static void testLine65x(skiatest::Reporter* reporter) {
1284    SkPath path;
1285    path.setFillType(SkPath::kEvenOdd_FillType);
1286    path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
1287    path.addRect(10, 0, 30, 30, SkPath::kCW_Direction);
1288    path.addRect(24, 0, 36, 36, SkPath::kCW_Direction);
1289    path.addRect(32, 6, 36, 41, SkPath::kCCW_Direction);
1290    testSimplify(reporter, path);
1291}
1292
1293static void testLine66(skiatest::Reporter* reporter) {
1294    SkPath path;
1295    path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
1296    path.addRect(0, 30, 20, 20, SkPath::kCW_Direction);
1297    path.addRect(12, 20, 24, 30, SkPath::kCW_Direction);
1298    testSimplify(reporter, path);
1299}
1300
1301static void testLine66x(skiatest::Reporter* reporter) {
1302    SkPath path;
1303    path.setFillType(SkPath::kEvenOdd_FillType);
1304    path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
1305    path.addRect(0, 30, 20, 20, SkPath::kCW_Direction);
1306    path.addRect(12, 20, 24, 30, SkPath::kCW_Direction);
1307    testSimplify(reporter, path);
1308}
1309
1310static void testLine67(skiatest::Reporter* reporter) {
1311    SkPath path;
1312    path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
1313    path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
1314    path.addRect(24, 20, 36, 30, SkPath::kCW_Direction);
1315    path.addRect(32, 0, 36, 41, SkPath::kCW_Direction);
1316    testSimplify(reporter, path);
1317}
1318
1319static void testLine67x(skiatest::Reporter* reporter) {
1320    SkPath path;
1321    path.setFillType(SkPath::kEvenOdd_FillType);
1322    path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
1323    path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
1324    path.addRect(24, 20, 36, 30, SkPath::kCW_Direction);
1325    path.addRect(32, 0, 36, 41, SkPath::kCW_Direction);
1326    testSimplify(reporter, path);
1327}
1328
1329static void testLine68a(skiatest::Reporter* reporter) {
1330    SkPath path;
1331    path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
1332    path.addRect(2, 2, 6, 6, SkPath::kCW_Direction);
1333    path.addRect(1, 2, 4, 2, SkPath::kCW_Direction);
1334    testSimplify(reporter, path);
1335}
1336
1337static void testLine68ax(skiatest::Reporter* reporter) {
1338    SkPath path;
1339    path.setFillType(SkPath::kEvenOdd_FillType);
1340    path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
1341    path.addRect(2, 2, 6, 6, SkPath::kCW_Direction);
1342    path.addRect(1, 2, 4, 2, SkPath::kCW_Direction);
1343    testSimplify(reporter, path);
1344}
1345
1346static void testLine68b(skiatest::Reporter* reporter) {
1347    SkPath path;
1348    path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
1349    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1350    path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
1351    testSimplify(reporter, path);
1352}
1353
1354static void testLine68bx(skiatest::Reporter* reporter) {
1355    SkPath path;
1356    path.setFillType(SkPath::kEvenOdd_FillType);
1357    path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
1358    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1359    path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
1360    testSimplify(reporter, path);
1361}
1362
1363static void testLine68c(skiatest::Reporter* reporter) {
1364    SkPath path;
1365    path.addRect(0, 0, 8, 8, SkPath::kCCW_Direction);
1366    path.addRect(2, 2, 6, 6, SkPath::kCW_Direction);
1367    path.addRect(1, 2, 4, 2, SkPath::kCW_Direction);
1368    testSimplify(reporter, path);
1369}
1370
1371static void testLine68cx(skiatest::Reporter* reporter) {
1372    SkPath path;
1373    path.setFillType(SkPath::kEvenOdd_FillType);
1374    path.addRect(0, 0, 8, 8, SkPath::kCCW_Direction);
1375    path.addRect(2, 2, 6, 6, SkPath::kCW_Direction);
1376    path.addRect(1, 2, 4, 2, SkPath::kCW_Direction);
1377    testSimplify(reporter, path);
1378}
1379
1380static void testLine68d(skiatest::Reporter* reporter) {
1381    SkPath path;
1382    path.addRect(0, 0, 8, 8, SkPath::kCCW_Direction);
1383    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1384    path.addRect(1, 2, 4, 2, SkPath::kCW_Direction);
1385    testSimplify(reporter, path);
1386}
1387
1388static void testLine68dx(skiatest::Reporter* reporter) {
1389    SkPath path;
1390    path.setFillType(SkPath::kEvenOdd_FillType);
1391    path.addRect(0, 0, 8, 8, SkPath::kCCW_Direction);
1392    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1393    path.addRect(1, 2, 4, 2, SkPath::kCW_Direction);
1394    testSimplify(reporter, path);
1395}
1396
1397static void testLine68e(skiatest::Reporter* reporter) {
1398    SkPath path;
1399    path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
1400    path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
1401    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1402    path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
1403    testSimplify(reporter, path);
1404}
1405
1406static void testLine68ex(skiatest::Reporter* reporter) {
1407    SkPath path;
1408    path.setFillType(SkPath::kEvenOdd_FillType);
1409    path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
1410    path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
1411    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1412    path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
1413    testSimplify(reporter, path);
1414}
1415
1416static void testLine68f(skiatest::Reporter* reporter) {
1417    SkPath path;
1418    path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
1419    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1420    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1421    path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
1422    testSimplify(reporter, path);
1423}
1424
1425static void testLine68fx(skiatest::Reporter* reporter) {
1426    SkPath path;
1427    path.setFillType(SkPath::kEvenOdd_FillType);
1428    path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
1429    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1430    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1431    path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
1432    testSimplify(reporter, path);
1433}
1434
1435static void testLine68g(skiatest::Reporter* reporter) {
1436    SkPath path;
1437    path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
1438    path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
1439    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1440    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1441    path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
1442    testSimplify(reporter, path);
1443}
1444
1445static void testLine68gx(skiatest::Reporter* reporter) {
1446    SkPath path;
1447    path.setFillType(SkPath::kEvenOdd_FillType);
1448    path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
1449    path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
1450    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1451    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1452    path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
1453    testSimplify(reporter, path);
1454}
1455
1456static void testLine68h(skiatest::Reporter* reporter) {
1457    SkPath path;
1458    path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
1459    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1460    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1461    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1462    path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
1463    testSimplify(reporter, path);
1464}
1465
1466static void testLine68hx(skiatest::Reporter* reporter) {
1467    SkPath path;
1468    path.setFillType(SkPath::kEvenOdd_FillType);
1469    path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
1470    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1471    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1472    path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
1473    path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
1474    testSimplify(reporter, path);
1475}
1476
1477static void testLine69(skiatest::Reporter* reporter) {
1478    SkPath path;
1479    path.addRect(0, 20, 20, 20, SkPath::kCW_Direction);
1480    path.addRect(0, 20, 12, 30, SkPath::kCW_Direction);
1481    path.addRect(12, 32, 21, 36, SkPath::kCW_Direction);
1482    testSimplify(reporter, path);
1483}
1484
1485static void testLine69x(skiatest::Reporter* reporter) {
1486    SkPath path;
1487    path.setFillType(SkPath::kEvenOdd_FillType);
1488    path.addRect(0, 20, 20, 20, SkPath::kCW_Direction);
1489    path.addRect(0, 20, 12, 30, SkPath::kCW_Direction);
1490    path.addRect(12, 32, 21, 36, SkPath::kCW_Direction);
1491    testSimplify(reporter, path);
1492}
1493
1494static void testLine70(skiatest::Reporter* reporter) {
1495    SkPath path;
1496    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1497    path.addRect(0, 24, 12, 12, SkPath::kCW_Direction);
1498    path.addRect(12, 32, 21, 36, SkPath::kCCW_Direction);
1499    testSimplify(reporter, path);
1500}
1501
1502static void testLine70x(skiatest::Reporter* reporter) {
1503    SkPath path;
1504    path.setFillType(SkPath::kEvenOdd_FillType);
1505    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1506    path.addRect(0, 24, 12, 12, SkPath::kCW_Direction);
1507    path.addRect(12, 32, 21, 36, SkPath::kCCW_Direction);
1508    testSimplify(reporter, path);
1509}
1510
1511static void testLine71(skiatest::Reporter* reporter) {
1512    SkPath path;
1513    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1514    path.addRect(12, 0, 24, 24, SkPath::kCW_Direction);
1515    path.addRect(12, 32, 21, 36, SkPath::kCW_Direction);
1516    testSimplify(reporter, path);
1517}
1518
1519static void testLine71x(skiatest::Reporter* reporter) {
1520    SkPath path;
1521    path.setFillType(SkPath::kEvenOdd_FillType);
1522    path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
1523    path.addRect(12, 0, 24, 24, SkPath::kCW_Direction);
1524    path.addRect(12, 32, 21, 36, SkPath::kCW_Direction);
1525    testSimplify(reporter, path);
1526}
1527
1528static void testLine72(skiatest::Reporter* reporter) {
1529    SkPath path;
1530    path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
1531    path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
1532    path.addRect(6, 20, 18, 30, SkPath::kCW_Direction);
1533    testSimplify(reporter, path);
1534}
1535
1536static void testLine72x(skiatest::Reporter* reporter) {
1537    SkPath path;
1538    path.setFillType(SkPath::kEvenOdd_FillType);
1539    path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
1540    path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
1541    path.addRect(6, 20, 18, 30, SkPath::kCW_Direction);
1542    testSimplify(reporter, path);
1543}
1544
1545static void testLine73(skiatest::Reporter* reporter) {
1546    SkPath path;
1547    path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
1548    path.addRect(0, 40, 20, 20, SkPath::kCW_Direction);
1549    path.addRect(0, 20, 12, 30, SkPath::kCW_Direction);
1550    path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction);
1551    testSimplify(reporter, path);
1552}
1553
1554static void testLine73x(skiatest::Reporter* reporter) {
1555    SkPath path;
1556    path.setFillType(SkPath::kEvenOdd_FillType);
1557    path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
1558    path.addRect(0, 40, 20, 20, SkPath::kCW_Direction);
1559    path.addRect(0, 20, 12, 30, SkPath::kCW_Direction);
1560    path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction);
1561    testSimplify(reporter, path);
1562}
1563
1564static void testLine74(skiatest::Reporter* reporter) {
1565    SkPath path;
1566    path.addRect(20, 30, 40, 40, SkPath::kCW_Direction);
1567    path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction);
1568    path.addRect(32, 24, 36, 41, SkPath::kCCW_Direction);
1569    testSimplify(reporter, path);
1570}
1571
1572static void testLine74x(skiatest::Reporter* reporter) {
1573    SkPath path;
1574    path.setFillType(SkPath::kEvenOdd_FillType);
1575    path.addRect(20, 30, 40, 40, SkPath::kCW_Direction);
1576    path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction);
1577    path.addRect(32, 24, 36, 41, SkPath::kCCW_Direction);
1578    testSimplify(reporter, path);
1579}
1580
1581static void testLine75(skiatest::Reporter* reporter) {
1582    SkPath path;
1583    path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
1584    path.addRect(10, 0, 30, 30, SkPath::kCCW_Direction);
1585    path.addRect(18, 0, 30, 30, SkPath::kCCW_Direction);
1586    path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
1587    testSimplify(reporter, path);
1588}
1589
1590static void testLine75x(skiatest::Reporter* reporter) {
1591    SkPath path;
1592    path.setFillType(SkPath::kEvenOdd_FillType);
1593    path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
1594    path.addRect(10, 0, 30, 30, SkPath::kCCW_Direction);
1595    path.addRect(18, 0, 30, 30, SkPath::kCCW_Direction);
1596    path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
1597    testSimplify(reporter, path);
1598}
1599
1600static void testLine76(skiatest::Reporter* reporter) {
1601    SkPath path;
1602    path.addRect(36, 0, 66, 60, SkPath::kCW_Direction);
1603    path.addRect(10, 20, 40, 30, SkPath::kCW_Direction);
1604    path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction);
1605    path.addRect(32, 6, 36, 41, SkPath::kCCW_Direction);
1606    testSimplify(reporter, path);
1607}
1608
1609static void testLine76x(skiatest::Reporter* reporter) {
1610    SkPath path;
1611    path.setFillType(SkPath::kEvenOdd_FillType);
1612    path.addRect(36, 0, 66, 60, SkPath::kCW_Direction);
1613    path.addRect(10, 20, 40, 30, SkPath::kCW_Direction);
1614    path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction);
1615    path.addRect(32, 6, 36, 41, SkPath::kCCW_Direction);
1616    testSimplify(reporter, path);
1617}
1618
1619static void testLine77(skiatest::Reporter* reporter) {
1620    SkPath path;
1621    path.addRect(20, 0, 40, 40, SkPath::kCW_Direction);
1622    path.addRect(24, 6, 36, 36, SkPath::kCCW_Direction);
1623    path.addRect(24, 32, 33, 36, SkPath::kCCW_Direction);
1624    testSimplify(reporter, path);
1625}
1626
1627static void testLine77x(skiatest::Reporter* reporter) {
1628    SkPath path;
1629    path.setFillType(SkPath::kEvenOdd_FillType);
1630    path.addRect(20, 0, 40, 40, SkPath::kCW_Direction);
1631    path.addRect(24, 6, 36, 36, SkPath::kCCW_Direction);
1632    path.addRect(24, 32, 33, 36, SkPath::kCCW_Direction);
1633    testSimplify(reporter, path);
1634}
1635
1636static void testLine78(skiatest::Reporter* reporter) {
1637    SkPath path;
1638    path.addRect(0, 0, 30, 60, SkPath::kCW_Direction);
1639    path.addRect(10, 20, 30, 30, SkPath::kCCW_Direction);
1640    path.addRect(18, 20, 30, 30, SkPath::kCCW_Direction);
1641    path.addRect(32, 0, 36, 41, SkPath::kCCW_Direction);
1642    testSimplify(reporter, path);
1643}
1644
1645static void testLine78x(skiatest::Reporter* reporter) {
1646    SkPath path;
1647    path.setFillType(SkPath::kEvenOdd_FillType);
1648    path.addRect(0, 0, 30, 60, SkPath::kCW_Direction);
1649    path.addRect(10, 20, 30, 30, SkPath::kCCW_Direction);
1650    path.addRect(18, 20, 30, 30, SkPath::kCCW_Direction);
1651    path.addRect(32, 0, 36, 41, SkPath::kCCW_Direction);
1652    testSimplify(reporter, path);
1653}
1654
1655static void testLine79(skiatest::Reporter* reporter) {
1656    SkPath path;
1657    path.addRect(0, 36, 60, 30, SkPath::kCW_Direction);
1658    path.addRect(10, 30, 40, 30, SkPath::kCW_Direction);
1659    path.addRect(0, 20, 12, 30, SkPath::kCCW_Direction);
1660    path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
1661    testSimplify(reporter, path);
1662}
1663
1664static void testLine79x(skiatest::Reporter* reporter) {
1665    SkPath path;
1666    path.setFillType(SkPath::kEvenOdd_FillType);
1667    path.addRect(0, 36, 60, 30, SkPath::kCW_Direction);
1668    path.addRect(10, 30, 40, 30, SkPath::kCW_Direction);
1669    path.addRect(0, 20, 12, 30, SkPath::kCCW_Direction);
1670    path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
1671    testSimplify(reporter, path);
1672}
1673
1674static void testLine81(skiatest::Reporter* reporter) {
1675    SkPath path;
1676    path.addRect(-1, -1, 3, 3, SkPath::kCW_Direction);
1677    path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
1678    path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
1679    path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
1680    path.addRect(1, 1, 2, 2, SkPath::kCCW_Direction);
1681    testSimplify(reporter, path);
1682}
1683
1684static void testDegenerate1(skiatest::Reporter* reporter) {
1685    SkPath path;
1686    path.moveTo(0, 0);
1687    path.lineTo(0, 0);
1688    path.lineTo(2, 0);
1689    path.close();
1690    path.moveTo(0, 0);
1691    path.lineTo(1, 0);
1692    path.lineTo(2, 0);
1693    path.close();
1694    testSimplify(reporter, path);
1695}
1696
1697static void testDegenerate1x(skiatest::Reporter* reporter) {
1698    SkPath path;
1699    path.setFillType(SkPath::kEvenOdd_FillType);
1700    path.moveTo(0, 0);
1701    path.lineTo(0, 0);
1702    path.lineTo(2, 0);
1703    path.close();
1704    path.moveTo(0, 0);
1705    path.lineTo(1, 0);
1706    path.lineTo(2, 0);
1707    path.close();
1708    testSimplify(reporter, path);
1709}
1710
1711static void testDegenerate2(skiatest::Reporter* reporter) {
1712    SkPath path;
1713    path.moveTo(0, 0);
1714    path.lineTo(0, 0);
1715    path.lineTo(0, 0);
1716    path.close();
1717    path.moveTo(0, 0);
1718    path.lineTo(1, 0);
1719    path.lineTo(0, 1);
1720    path.close();
1721    testSimplify(reporter, path);
1722}
1723
1724static void testDegenerate2x(skiatest::Reporter* reporter) {
1725    SkPath path;
1726    path.setFillType(SkPath::kEvenOdd_FillType);
1727    path.moveTo(0, 0);
1728    path.lineTo(0, 0);
1729    path.lineTo(0, 0);
1730    path.close();
1731    path.moveTo(0, 0);
1732    path.lineTo(1, 0);
1733    path.lineTo(0, 1);
1734    path.close();
1735    testSimplify(reporter, path);
1736}
1737
1738static void testDegenerate3(skiatest::Reporter* reporter) {
1739    SkPath path;
1740    path.moveTo(0, 0);
1741    path.lineTo(2, 0);
1742    path.lineTo(1, 0);
1743    path.close();
1744    path.moveTo(0, 0);
1745    path.lineTo(0, 0);
1746    path.lineTo(3, 0);
1747    path.close();
1748    testSimplify(reporter, path);
1749}
1750
1751static void testDegenerate3x(skiatest::Reporter* reporter) {
1752    SkPath path;
1753    path.setFillType(SkPath::kEvenOdd_FillType);
1754    path.moveTo(0, 0);
1755    path.lineTo(2, 0);
1756    path.lineTo(1, 0);
1757    path.close();
1758    path.moveTo(0, 0);
1759    path.lineTo(0, 0);
1760    path.lineTo(3, 0);
1761    path.close();
1762    testSimplify(reporter, path);
1763}
1764
1765static void testDegenerate4(skiatest::Reporter* reporter) {
1766    SkPath path;
1767    path.moveTo(0, 0);
1768    path.lineTo(1, 0);
1769    path.lineTo(1, 3);
1770    path.close();
1771    path.moveTo(1, 0);
1772    path.lineTo(1, 1);
1773    path.lineTo(1, 2);
1774    path.close();
1775    testSimplify(reporter, path);
1776}
1777
1778static void testDegenerate4x(skiatest::Reporter* reporter) {
1779    SkPath path;
1780    path.setFillType(SkPath::kEvenOdd_FillType);
1781    path.moveTo(0, 0);
1782    path.lineTo(1, 0);
1783    path.lineTo(1, 3);
1784    path.close();
1785    path.moveTo(1, 0);
1786    path.lineTo(1, 1);
1787    path.lineTo(1, 2);
1788    path.close();
1789    testSimplify(reporter, path);
1790}
1791
1792static void testNondegenerate1(skiatest::Reporter* reporter) {
1793    SkPath path;
1794    path.moveTo(0, 0);
1795    path.lineTo(3, 0);
1796    path.lineTo(1, 3);
1797    path.close();
1798    path.moveTo(1, 1);
1799    path.lineTo(2, 1);
1800    path.lineTo(1, 2);
1801    path.close();
1802    testSimplify(reporter, path);
1803}
1804
1805static void testNondegenerate1x(skiatest::Reporter* reporter) {
1806    SkPath path;
1807    path.setFillType(SkPath::kEvenOdd_FillType);
1808    path.moveTo(0, 0);
1809    path.lineTo(3, 0);
1810    path.lineTo(1, 3);
1811    path.close();
1812    path.moveTo(1, 1);
1813    path.lineTo(2, 1);
1814    path.lineTo(1, 2);
1815    path.close();
1816    testSimplify(reporter, path);
1817}
1818
1819static void testNondegenerate2(skiatest::Reporter* reporter) {
1820    SkPath path;
1821    path.moveTo(1, 0);
1822    path.lineTo(0, 1);
1823    path.lineTo(1, 1);
1824    path.close();
1825    path.moveTo(0, 2);
1826    path.lineTo(0, 3);
1827    path.lineTo(1, 2);
1828    path.close();
1829    testSimplify(reporter, path);
1830}
1831
1832static void testNondegenerate2x(skiatest::Reporter* reporter) {
1833    SkPath path;
1834    path.setFillType(SkPath::kEvenOdd_FillType);
1835    path.moveTo(1, 0);
1836    path.lineTo(0, 1);
1837    path.lineTo(1, 1);
1838    path.close();
1839    path.moveTo(0, 2);
1840    path.lineTo(0, 3);
1841    path.lineTo(1, 2);
1842    path.close();
1843    testSimplify(reporter, path);
1844}
1845
1846static void testNondegenerate3(skiatest::Reporter* reporter) {
1847    SkPath path;
1848    path.moveTo(0, 0);
1849    path.lineTo(1, 0);
1850    path.lineTo(2, 1);
1851    path.close();
1852    path.moveTo(0, 1);
1853    path.lineTo(1, 1);
1854    path.lineTo(0, 2);
1855    path.close();
1856    testSimplify(reporter, path);
1857}
1858
1859static void testNondegenerate3x(skiatest::Reporter* reporter) {
1860    SkPath path;
1861    path.setFillType(SkPath::kEvenOdd_FillType);
1862    path.moveTo(0, 0);
1863    path.lineTo(1, 0);
1864    path.lineTo(2, 1);
1865    path.close();
1866    path.moveTo(0, 1);
1867    path.lineTo(1, 1);
1868    path.lineTo(0, 2);
1869    path.close();
1870    testSimplify(reporter, path);
1871}
1872
1873static void testNondegenerate4(skiatest::Reporter* reporter) {
1874    SkPath path;
1875    path.moveTo(1, 0);
1876    path.lineTo(0, 1);
1877    path.lineTo(1, 2);
1878    path.close();
1879    path.moveTo(0, 2);
1880    path.lineTo(0, 3);
1881    path.lineTo(1, 3);
1882    path.close();
1883    testSimplify(reporter, path);
1884}
1885
1886static void testNondegenerate4x(skiatest::Reporter* reporter) {
1887    SkPath path;
1888    path.setFillType(SkPath::kEvenOdd_FillType);
1889    path.moveTo(1, 0);
1890    path.lineTo(0, 1);
1891    path.lineTo(1, 2);
1892    path.close();
1893    path.moveTo(0, 2);
1894    path.lineTo(0, 3);
1895    path.lineTo(1, 3);
1896    path.close();
1897    testSimplify(reporter, path);
1898}
1899
1900static void testQuadralateral5(skiatest::Reporter* reporter) {
1901    SkPath path;
1902    path.moveTo(0, 0);
1903    path.lineTo(0, 0);
1904    path.lineTo(1, 0);
1905    path.lineTo(1, 1);
1906    path.close();
1907    path.moveTo(0, 0);
1908    path.lineTo(2, 2);
1909    path.lineTo(3, 2);
1910    path.lineTo(3, 3);
1911    path.close();
1912    testSimplify(reporter, path);
1913}
1914
1915static void testQuadralateral5x(skiatest::Reporter* reporter) {
1916    SkPath path;
1917    path.setFillType(SkPath::kEvenOdd_FillType);
1918    path.moveTo(0, 0);
1919    path.lineTo(0, 0);
1920    path.lineTo(1, 0);
1921    path.lineTo(1, 1);
1922    path.close();
1923    path.moveTo(0, 0);
1924    path.lineTo(2, 2);
1925    path.lineTo(3, 2);
1926    path.lineTo(3, 3);
1927    path.close();
1928    testSimplify(reporter, path);
1929}
1930
1931static void testQuadralateral6(skiatest::Reporter* reporter) {
1932    SkPath path;
1933    path.moveTo(0, 0);
1934    path.lineTo(0, 0);
1935    path.lineTo(1, 0);
1936    path.lineTo(1, 1);
1937    path.close();
1938    path.moveTo(1, 0);
1939    path.lineTo(2, 0);
1940    path.lineTo(0, 2);
1941    path.lineTo(2, 2);
1942    path.close();
1943    testSimplify(reporter, path);
1944}
1945
1946static void testQuadralateral6x(skiatest::Reporter* reporter) {
1947    SkPath path;
1948    path.setFillType(SkPath::kEvenOdd_FillType);
1949    path.moveTo(0, 0);
1950    path.lineTo(0, 0);
1951    path.lineTo(1, 0);
1952    path.lineTo(1, 1);
1953    path.close();
1954    path.moveTo(1, 0);
1955    path.lineTo(2, 0);
1956    path.lineTo(0, 2);
1957    path.lineTo(2, 2);
1958    path.close();
1959    testSimplify(reporter, path);
1960}
1961
1962static void testFauxQuadralateral6(skiatest::Reporter* reporter) {
1963    SkPath path;
1964    path.moveTo(0, 0);
1965    path.lineTo(1, 0);
1966    path.lineTo(1, 1);
1967    path.close();
1968    path.moveTo(1, 0);
1969    path.lineTo(2, 0);
1970    path.lineTo(1 + 1.0f/3, 2.0f/3);
1971    path.close();
1972    path.moveTo(1 + 1.0f/3, 2.0f/3);
1973    path.lineTo(0, 2);
1974    path.lineTo(2, 2);
1975    path.close();
1976    testSimplify(reporter, path);
1977}
1978
1979static void testFauxQuadralateral6x(skiatest::Reporter* reporter) {
1980    SkPath path;
1981    path.setFillType(SkPath::kEvenOdd_FillType);
1982    path.moveTo(0, 0);
1983    path.lineTo(1, 0);
1984    path.lineTo(1, 1);
1985    path.close();
1986    path.moveTo(1, 0);
1987    path.lineTo(2, 0);
1988    path.lineTo(1 + 1.0f/3, 2.0f/3);
1989    path.close();
1990    path.moveTo(1 + 1.0f/3, 2.0f/3);
1991    path.lineTo(0, 2);
1992    path.lineTo(2, 2);
1993    path.close();
1994    testSimplify(reporter, path);
1995}
1996
1997static void testFauxQuadralateral6a(skiatest::Reporter* reporter) {
1998    SkPath path;
1999    path.moveTo(0, 0);
2000    path.lineTo(3, 0);
2001    path.lineTo(3, 3);
2002    path.close();
2003    path.moveTo(3, 0);
2004    path.lineTo(6, 0);
2005    path.lineTo(4, 2);
2006    path.close();
2007    path.moveTo(4, 2);
2008    path.lineTo(0, 6);
2009    path.lineTo(6, 6);
2010    path.close();
2011    testSimplify(reporter, path);
2012}
2013
2014static void testFauxQuadralateral6ax(skiatest::Reporter* reporter) {
2015    SkPath path;
2016    path.setFillType(SkPath::kEvenOdd_FillType);
2017    path.moveTo(0, 0);
2018    path.lineTo(3, 0);
2019    path.lineTo(3, 3);
2020    path.close();
2021    path.moveTo(3, 0);
2022    path.lineTo(6, 0);
2023    path.lineTo(4, 2);
2024    path.close();
2025    path.moveTo(4, 2);
2026    path.lineTo(0, 6);
2027    path.lineTo(6, 6);
2028    path.close();
2029    testSimplify(reporter, path);
2030}
2031
2032static void testFauxQuadralateral6b(skiatest::Reporter* reporter) {
2033    SkPath path;
2034    path.moveTo(0, 0);
2035    path.lineTo(3, 0);
2036    path.lineTo(3, 3);
2037    path.close();
2038    path.moveTo(3, 0);
2039    path.lineTo(6, 0);
2040    path.lineTo(4, 2);
2041    path.close();
2042    path.moveTo(4, 2);
2043    path.lineTo(6, 6);
2044    path.lineTo(0, 6);
2045    path.close();
2046    testSimplify(reporter, path);
2047}
2048
2049static void testFauxQuadralateral6bx(skiatest::Reporter* reporter) {
2050    SkPath path;
2051    path.setFillType(SkPath::kEvenOdd_FillType);
2052    path.moveTo(0, 0);
2053    path.lineTo(3, 0);
2054    path.lineTo(3, 3);
2055    path.close();
2056    path.moveTo(3, 0);
2057    path.lineTo(6, 0);
2058    path.lineTo(4, 2);
2059    path.close();
2060    path.moveTo(4, 2);
2061    path.lineTo(6, 6);
2062    path.lineTo(0, 6);
2063    path.close();
2064    testSimplify(reporter, path);
2065}
2066
2067static void testFauxQuadralateral6c(skiatest::Reporter* reporter) {
2068    SkPath path;
2069    path.moveTo(0, 0);
2070    path.lineTo(3, 3);
2071    path.lineTo(3, 0);
2072    path.close();
2073    path.moveTo(3, 0);
2074    path.lineTo(6, 0);
2075    path.lineTo(4, 2);
2076    path.close();
2077    path.moveTo(4, 2);
2078    path.lineTo(0, 6);
2079    path.lineTo(6, 6);
2080    path.close();
2081    testSimplify(reporter, path);
2082}
2083
2084static void testFauxQuadralateral6cx(skiatest::Reporter* reporter) {
2085    SkPath path;
2086    path.setFillType(SkPath::kEvenOdd_FillType);
2087    path.moveTo(0, 0);
2088    path.lineTo(3, 3);
2089    path.lineTo(3, 0);
2090    path.close();
2091    path.moveTo(3, 0);
2092    path.lineTo(6, 0);
2093    path.lineTo(4, 2);
2094    path.close();
2095    path.moveTo(4, 2);
2096    path.lineTo(0, 6);
2097    path.lineTo(6, 6);
2098    path.close();
2099    testSimplify(reporter, path);
2100}
2101
2102static void testFauxQuadralateral6d(skiatest::Reporter* reporter) {
2103    SkPath path;
2104    path.moveTo(0, 0);
2105    path.lineTo(3, 3);
2106    path.lineTo(3, 0);
2107    path.close();
2108    path.moveTo(3, 0);
2109    path.lineTo(6, 0);
2110    path.lineTo(4, 2);
2111    path.close();
2112    path.moveTo(4, 2);
2113    path.lineTo(6, 6);
2114    path.lineTo(0, 6);
2115    path.close();
2116    testSimplify(reporter, path);
2117}
2118
2119static void testFauxQuadralateral6dx(skiatest::Reporter* reporter) {
2120    SkPath path;
2121    path.setFillType(SkPath::kEvenOdd_FillType);
2122    path.moveTo(0, 0);
2123    path.lineTo(3, 3);
2124    path.lineTo(3, 0);
2125    path.close();
2126    path.moveTo(3, 0);
2127    path.lineTo(6, 0);
2128    path.lineTo(4, 2);
2129    path.close();
2130    path.moveTo(4, 2);
2131    path.lineTo(6, 6);
2132    path.lineTo(0, 6);
2133    path.close();
2134    testSimplify(reporter, path);
2135}
2136
2137static void testQuadralateral6a(skiatest::Reporter* reporter) {
2138    SkPath path;
2139    path.moveTo(0, 0);
2140    path.lineTo(0, 0);
2141    path.lineTo(3, 0);
2142    path.lineTo(3, 3);
2143    path.close();
2144    path.moveTo(3, 0);
2145    path.lineTo(6, 0);
2146    path.lineTo(0, 6);
2147    path.lineTo(6, 6);
2148    path.close();
2149    testSimplify(reporter, path);
2150}
2151
2152static void testQuadralateral6ax(skiatest::Reporter* reporter) {
2153    SkPath path;
2154    path.setFillType(SkPath::kEvenOdd_FillType);
2155    path.moveTo(0, 0);
2156    path.lineTo(0, 0);
2157    path.lineTo(3, 0);
2158    path.lineTo(3, 3);
2159    path.close();
2160    path.moveTo(3, 0);
2161    path.lineTo(6, 0);
2162    path.lineTo(0, 6);
2163    path.lineTo(6, 6);
2164    path.close();
2165    testSimplify(reporter, path);
2166}
2167
2168static void testQuadralateral7(skiatest::Reporter* reporter) {
2169    SkPath path;
2170    path.moveTo(0, 0);
2171    path.lineTo(0, 0);
2172    path.lineTo(1, 0);
2173    path.lineTo(2, 1);
2174    path.close();
2175    path.moveTo(1, 0);
2176    path.lineTo(1, 1);
2177    path.lineTo(2, 2);
2178    path.lineTo(1, 3);
2179    path.close();
2180    testSimplify(reporter, path);
2181}
2182
2183static void testQuadralateral7x(skiatest::Reporter* reporter) {
2184    SkPath path;
2185    path.setFillType(SkPath::kEvenOdd_FillType);
2186    path.moveTo(0, 0);
2187    path.lineTo(0, 0);
2188    path.lineTo(1, 0);
2189    path.lineTo(2, 1);
2190    path.close();
2191    path.moveTo(1, 0);
2192    path.lineTo(1, 1);
2193    path.lineTo(2, 2);
2194    path.lineTo(1, 3);
2195    path.close();
2196    testSimplify(reporter, path);
2197}
2198
2199static void testQuadralateral8(skiatest::Reporter* reporter) {
2200    SkPath path;
2201    path.moveTo(0, 0);
2202    path.lineTo(3, 1);
2203    path.lineTo(1, 3);
2204    path.lineTo(3, 3);
2205    path.close();
2206    path.moveTo(2, 1);
2207    path.lineTo(0, 2);
2208    path.lineTo(3, 2);
2209    path.lineTo(2, 3);
2210    path.close();
2211    testSimplify(reporter, path);
2212}
2213
2214static void testQuadralateral8x(skiatest::Reporter* reporter) {
2215    SkPath path;
2216    path.setFillType(SkPath::kEvenOdd_FillType);
2217    path.moveTo(0, 0);
2218    path.lineTo(3, 1);
2219    path.lineTo(1, 3);
2220    path.lineTo(3, 3);
2221    path.close();
2222    path.moveTo(2, 1);
2223    path.lineTo(0, 2);
2224    path.lineTo(3, 2);
2225    path.lineTo(2, 3);
2226    path.close();
2227    testSimplify(reporter, path);
2228}
2229
2230static void testQuadralateral9(skiatest::Reporter* reporter) {
2231    SkPath path;
2232    path.moveTo(0, 0);
2233    path.lineTo(1, 0);
2234    path.lineTo(1, 2);
2235    path.lineTo(2, 2);
2236    path.close();
2237    path.moveTo(1, 1);
2238    path.lineTo(2, 1);
2239    path.lineTo(1, 3);
2240    path.lineTo(2, 3);
2241    path.close();
2242    testSimplify(reporter, path);
2243}
2244
2245static void testQuadralateral9x(skiatest::Reporter* reporter) {
2246    SkPath path;
2247    path.setFillType(SkPath::kEvenOdd_FillType);
2248    path.moveTo(0, 0);
2249    path.lineTo(1, 0);
2250    path.lineTo(1, 2);
2251    path.lineTo(2, 2);
2252    path.close();
2253    path.moveTo(1, 1);
2254    path.lineTo(2, 1);
2255    path.lineTo(1, 3);
2256    path.lineTo(2, 3);
2257    path.close();
2258    testSimplify(reporter, path);
2259}
2260
2261static void testLine1a(skiatest::Reporter* reporter) {
2262    SkPath path;
2263    path.setFillType(SkPath::kWinding_FillType);
2264    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
2265    path.addRect(4, 0, 13, 13, SkPath::kCCW_Direction);
2266    testSimplify(reporter, path);
2267}
2268
2269static void testLine1ax(skiatest::Reporter* reporter) {
2270    SkPath path;
2271    path.setFillType(SkPath::kEvenOdd_FillType);
2272    path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
2273    path.addRect(4, 0, 13, 13, SkPath::kCCW_Direction);
2274    testSimplify(reporter, path);
2275}
2276
2277static void testLine2ax(skiatest::Reporter* reporter) {
2278    SkPath path;
2279    path.setFillType(SkPath::kEvenOdd_FillType);
2280    path.addRect(0, 20, 20, 20, SkPath::kCW_Direction);
2281    path.addRect(0, 20, 12, 30, SkPath::kCW_Direction);
2282    path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
2283    testSimplify(reporter, path);
2284}
2285
2286static void testLine3aax(skiatest::Reporter* reporter) {
2287    SkPath path;
2288    path.setFillType(SkPath::kEvenOdd_FillType);
2289    path.addRect(10, 30, 30, 30, SkPath::kCW_Direction);
2290    path.addRect(18, 20, 30, 30, SkPath::kCCW_Direction);
2291    path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
2292    testSimplify(reporter, path);
2293}
2294
2295static void testLine4ax(skiatest::Reporter* reporter) {
2296    SkPath path;
2297    path.setFillType(SkPath::kEvenOdd_FillType);
2298    path.addRect(10, 30, 30, 30, SkPath::kCW_Direction);
2299    path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction);
2300    path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
2301    testSimplify(reporter, path);
2302}
2303
2304static void testQuadratic1(skiatest::Reporter* reporter) {
2305    SkPath path;
2306    path.moveTo(0, 0);
2307    path.quadTo(0, 0, 0, 0);
2308    path.lineTo(1, 0);
2309    path.close();
2310    path.moveTo(0, 0);
2311    path.lineTo(0, 0);
2312    path.quadTo(0, 0, 0, 0);
2313    path.close();
2314    testSimplify(reporter, path);
2315}
2316
2317static void testQuadratic1x(skiatest::Reporter* reporter) {
2318    SkPath path;
2319    path.setFillType(SkPath::kEvenOdd_FillType);
2320    path.moveTo(0, 0);
2321    path.quadTo(0, 0, 0, 0);
2322    path.lineTo(1, 0);
2323    path.close();
2324    path.moveTo(0, 0);
2325    path.lineTo(0, 0);
2326    path.quadTo(0, 0, 0, 0);
2327    path.close();
2328    testSimplify(reporter, path);
2329}
2330
2331static void testQuadratic2(skiatest::Reporter* reporter) {
2332    SkPath path;
2333    path.moveTo(0, 0);
2334    path.quadTo(0, 0, 0, 0);
2335    path.lineTo(3, 0);
2336    path.close();
2337    path.moveTo(0, 0);
2338    path.lineTo(0, 0);
2339    path.quadTo(1, 0, 0, 1);
2340    path.close();
2341    testSimplify(reporter, path);
2342}
2343
2344static void testQuadratic2x(skiatest::Reporter* reporter) {
2345    SkPath path;
2346    path.setFillType(SkPath::kEvenOdd_FillType);
2347    path.moveTo(0, 0);
2348    path.quadTo(0, 0, 0, 0);
2349    path.lineTo(3, 0);
2350    path.close();
2351    path.moveTo(0, 0);
2352    path.lineTo(0, 0);
2353    path.quadTo(1, 0, 0, 1);
2354    path.close();
2355    testSimplify(reporter, path);
2356}
2357
2358static void testQuadratic3(skiatest::Reporter* reporter) {
2359    SkPath path;
2360    path.moveTo(0, 0);
2361    path.quadTo(0, 0, 1, 0);
2362    path.lineTo(0, 2);
2363    path.close();
2364    path.moveTo(0, 0);
2365    path.lineTo(0, 0);
2366    path.quadTo(1, 0, 0, 1);
2367    path.close();
2368    testSimplify(reporter, path);
2369}
2370
2371static void testQuadratic3x(skiatest::Reporter* reporter) {
2372    SkPath path;
2373    path.setFillType(SkPath::kEvenOdd_FillType);
2374    path.moveTo(0, 0);
2375    path.quadTo(0, 0, 1, 0);
2376    path.lineTo(0, 2);
2377    path.close();
2378    path.moveTo(0, 0);
2379    path.lineTo(0, 0);
2380    path.quadTo(1, 0, 0, 1);
2381    path.close();
2382    testSimplify(reporter, path);
2383}
2384
2385static void testQuadratic4(skiatest::Reporter* reporter) {
2386    SkPath path;
2387    path.moveTo(0, 0);
2388    path.quadTo(0, 0, 1, 0);
2389    path.lineTo(0, 2);
2390    path.close();
2391    path.moveTo(0, 0);
2392    path.lineTo(0, 0);
2393    path.quadTo(1, 0, 0, 2);
2394    path.close();
2395    testSimplify(reporter, path);
2396}
2397
2398static void testQuadratic4x(skiatest::Reporter* reporter) {
2399    SkPath path;
2400    path.setFillType(SkPath::kEvenOdd_FillType);
2401    path.moveTo(0, 0);
2402    path.quadTo(0, 0, 1, 0);
2403    path.lineTo(0, 2);
2404    path.close();
2405    path.moveTo(0, 0);
2406    path.lineTo(0, 0);
2407    path.quadTo(1, 0, 0, 2);
2408    path.close();
2409    testSimplify(reporter, path);
2410}
2411
2412static void testQuadratic5(skiatest::Reporter* reporter) {
2413    SkPath path;
2414    path.moveTo(0, 0);
2415    path.quadTo(0, 0, 0, 0);
2416    path.lineTo(0, 1);
2417    path.close();
2418    path.moveTo(0, 0);
2419    path.lineTo(1, 0);
2420    path.quadTo(0, 1, 0, 2);
2421    path.close();
2422    testSimplify(reporter, path);
2423}
2424
2425static void testQuadratic6(skiatest::Reporter* reporter) {
2426    SkPath path;
2427    path.moveTo(0, 0);
2428    path.quadTo(0, 0, 1, 0);
2429    path.lineTo(2, 1);
2430    path.close();
2431    path.moveTo(0, 0);
2432    path.lineTo(0, 0);
2433    path.quadTo(2, 0, 0, 1);
2434    path.close();
2435    testSimplify(reporter, path);
2436}
2437
2438static void testQuadratic7(skiatest::Reporter* reporter) {
2439    SkPath path;
2440    path.moveTo(0, 0);
2441    path.quadTo(0, 0, 1, 0);
2442    path.lineTo(3, 1);
2443    path.close();
2444    path.moveTo(0, 0);
2445    path.lineTo(0, 0);
2446    path.quadTo(3, 0, 1, 2);
2447    path.close();
2448    testSimplify(reporter, path);
2449}
2450
2451static void testQuadratic8(skiatest::Reporter* reporter) {
2452    SkPath path;
2453    path.moveTo(0, 0);
2454    path.quadTo(0, 0, 1, 0);
2455    path.lineTo(0, 2);
2456    path.close();
2457    path.moveTo(0, 0);
2458    path.lineTo(1, 0);
2459    path.quadTo(0, 1, 1, 2);
2460    path.close();
2461    testSimplify(reporter, path);
2462}
2463
2464static void testQuadratic9(skiatest::Reporter* reporter) {
2465    SkPath path;
2466    path.moveTo(0, 0);
2467    path.quadTo(0, 0, 1, 0);
2468    path.lineTo(3, 1);
2469    path.close();
2470    path.moveTo(0, 0);
2471    path.lineTo(1, 0);
2472    path.quadTo(1, 2, 3, 2);
2473    path.close();
2474    testSimplify(reporter, path);
2475}
2476
2477static void testQuadratic14(skiatest::Reporter* reporter) {
2478    SkPath path;
2479    path.moveTo(0, 0);
2480    path.quadTo(0, 0, 1, 0);
2481    path.lineTo(3, 2);
2482    path.close();
2483    path.moveTo(0, 0);
2484    path.lineTo(1, 0);
2485    path.quadTo(3, 2, 3, 3);
2486    path.close();
2487    testSimplify(reporter, path);
2488}
2489
2490static void testQuadratic15(skiatest::Reporter* reporter) {
2491    SkPath path;
2492    path.moveTo(0, 0);
2493    path.quadTo(0, 0, 1, 0);
2494    path.lineTo(1, 3);
2495    path.close();
2496    path.moveTo(1, 0);
2497    path.lineTo(0, 1);
2498    path.quadTo(1, 1, 0, 3);
2499    path.close();
2500    testSimplify(reporter, path);
2501}
2502
2503static void testQuadratic17x(skiatest::Reporter* reporter) {
2504    SkPath path;
2505    path.setFillType(SkPath::kEvenOdd_FillType);
2506    path.moveTo(0, 0);
2507    path.quadTo(0, 0, 3, 1);
2508    path.lineTo(0, 2);
2509    path.close();
2510    path.moveTo(0, 0);
2511    path.lineTo(1, 0);
2512    path.quadTo(3, 1, 0, 2);
2513    path.close();
2514    testSimplify(reporter, path);
2515}
2516
2517static void testQuadratic18(skiatest::Reporter* reporter) {
2518    SkPath path;
2519    path.moveTo(0, 0);
2520    path.quadTo(1, 0, 0, 1);
2521    path.lineTo(0, 1);
2522    path.close();
2523    path.moveTo(0, 0);
2524    path.lineTo(0, 0);
2525    path.quadTo(1, 0, 1, 1);
2526    path.close();
2527    testSimplify(reporter, path);
2528}
2529
2530static void testQuadratic19(skiatest::Reporter* reporter) {
2531    SkPath path;
2532    path.moveTo(0, 0);
2533    path.quadTo(1, 0, 0, 1);
2534    path.lineTo(0, 1);
2535    path.close();
2536    path.moveTo(0, 0);
2537    path.lineTo(0, 0);
2538    path.quadTo(2, 0, 0, 1);
2539    path.close();
2540    testSimplify(reporter, path);
2541}
2542
2543static void testQuadratic20(skiatest::Reporter* reporter) {
2544    SkPath path;
2545    path.moveTo(0, 0);
2546    path.quadTo(1, 0, 0, 1);
2547    path.lineTo(0, 1);
2548    path.close();
2549    path.moveTo(0, 0);
2550    path.lineTo(0, 0);
2551    path.quadTo(1, 0, 0, 1);
2552    path.close();
2553    testSimplify(reporter, path);
2554}
2555
2556static void testQuadratic21(skiatest::Reporter* reporter) {
2557    SkPath path;
2558    path.moveTo(0, 0);
2559    path.quadTo(1, 0, 0, 1);
2560    path.lineTo(0, 1);
2561    path.close();
2562    path.moveTo(0, 0);
2563    path.lineTo(0, 0);
2564    path.quadTo(1, 0, 0, 2);
2565    path.close();
2566    testSimplify(reporter, path);
2567}
2568
2569static void testQuadratic22(skiatest::Reporter* reporter) {
2570    SkPath path;
2571    path.moveTo(0, 0);
2572    path.quadTo(1, 0, 0, 1);
2573    path.lineTo(0, 1);
2574    path.close();
2575    path.moveTo(0, 0);
2576    path.lineTo(0, 0);
2577    path.quadTo(0, 1, 2, 1);
2578    path.close();
2579    testSimplify(reporter, path);
2580}
2581
2582static void testQuadratic23(skiatest::Reporter* reporter) {
2583    SkPath path;
2584    path.moveTo(0, 0);
2585    path.quadTo(1, 0, 0, 1);
2586    path.lineTo(0, 1);
2587    path.close();
2588    path.moveTo(0, 0);
2589    path.lineTo(0, 0);
2590    path.quadTo(0, 2, 1, 2);
2591    path.close();
2592    testSimplify(reporter, path);
2593}
2594
2595static void testQuadratic24(skiatest::Reporter* reporter) {
2596    SkPath path;
2597    path.moveTo(0, 0);
2598    path.quadTo(1, 0, 0, 1);
2599    path.lineTo(0, 1);
2600    path.close();
2601    path.moveTo(0, 0);
2602    path.lineTo(1, 0);
2603    path.quadTo(2, 0, 0, 1);
2604    path.close();
2605    testSimplify(reporter, path);
2606}
2607
2608static void testQuadratic25(skiatest::Reporter* reporter) {
2609    SkPath path;
2610    path.moveTo(0, 0);
2611    path.quadTo(1, 0, 1, 1);
2612    path.lineTo(1, 1);
2613    path.close();
2614    path.moveTo(0, 0);
2615    path.lineTo(0, 0);
2616    path.quadTo(2, 1, 0, 2);
2617    path.close();
2618    testSimplify(reporter, path);
2619}
2620
2621static void testQuadratic26(skiatest::Reporter* reporter) {
2622    SkPath path;
2623    path.moveTo(0, 0);
2624    path.quadTo(1, 0, 1, 1);
2625    path.lineTo(0, 2);
2626    path.close();
2627    path.moveTo(0, 0);
2628    path.lineTo(0, 0);
2629    path.quadTo(1, 0, 0, 1);
2630    path.close();
2631    testSimplify(reporter, path);
2632}
2633
2634static void testQuadratic27(skiatest::Reporter* reporter) {
2635    SkPath path;
2636    path.moveTo(0, 0);
2637    path.quadTo(1, 0, 1, 1);
2638    path.lineTo(2, 1);
2639    path.close();
2640    path.moveTo(0, 0);
2641    path.lineTo(0, 0);
2642    path.quadTo(2, 1, 0, 2);
2643    path.close();
2644    testSimplify(reporter, path);
2645}
2646
2647static void testQuadratic28(skiatest::Reporter* reporter) {
2648    SkPath path;
2649    path.moveTo(0, 0);
2650    path.quadTo(1, 0, 0, 1);
2651    path.lineTo(0, 1);
2652    path.close();
2653    path.moveTo(0, 0);
2654    path.lineTo(0, 2);
2655    path.quadTo(1, 2, 0, 3);
2656    path.close();
2657    testSimplify(reporter, path);
2658}
2659
2660static void testQuadratic29(skiatest::Reporter* reporter) {
2661    SkPath path;
2662    path.moveTo(0, 0);
2663    path.quadTo(1, 0, 2, 1);
2664    path.lineTo(0, 2);
2665    path.close();
2666    path.moveTo(0, 0);
2667    path.lineTo(0, 0);
2668    path.quadTo(1, 0, 0, 1);
2669    path.close();
2670    testSimplify(reporter, path);
2671}
2672
2673static void testQuadratic30(skiatest::Reporter* reporter) {
2674    SkPath path;
2675    path.moveTo(0, 0);
2676    path.quadTo(1, 0, 1, 2);
2677    path.lineTo(1, 2);
2678    path.close();
2679    path.moveTo(0, 0);
2680    path.lineTo(1, 0);
2681    path.quadTo(0, 1, 1, 2);
2682    path.close();
2683    testSimplify(reporter, path);
2684}
2685
2686static void testQuadratic31(skiatest::Reporter* reporter) {
2687    SkPath path;
2688    path.moveTo(0, 0);
2689    path.quadTo(1, 0, 1, 2);
2690    path.lineTo(1, 2);
2691    path.close();
2692    path.moveTo(0, 0);
2693    path.lineTo(1, 0);
2694    path.quadTo(0, 1, 1, 3);
2695    path.close();
2696    testSimplify(reporter, path);
2697}
2698
2699static void testQuadratic32(skiatest::Reporter* reporter) {
2700    SkPath path;
2701    path.moveTo(0, 0);
2702    path.quadTo(1, 0, 2, 3);
2703    path.lineTo(2, 3);
2704    path.close();
2705    path.moveTo(0, 0);
2706    path.lineTo(0, 0);
2707    path.quadTo(3, 1, 0, 2);
2708    path.close();
2709    testSimplify(reporter, path);
2710}
2711
2712static void testQuadratic33(skiatest::Reporter* reporter) {
2713    SkPath path;
2714    path.moveTo(0, 0);
2715    path.quadTo(2, 0, 0, 1);
2716    path.lineTo(0, 1);
2717    path.close();
2718    path.moveTo(0, 0);
2719    path.lineTo(1, 1);
2720    path.quadTo(2, 1, 2, 2);
2721    path.close();
2722    testSimplify(reporter, path);
2723}
2724
2725static void testQuadratic34(skiatest::Reporter* reporter) {
2726    SkPath path;
2727    path.moveTo(0, 0);
2728    path.quadTo(2, 0, 0, 1);
2729    path.lineTo(0, 1);
2730    path.close();
2731    path.moveTo(1, 0);
2732    path.lineTo(1, 1);
2733    path.quadTo(2, 1, 1, 2);
2734    path.close();
2735    testSimplify(reporter, path);
2736}
2737
2738static void testQuadratic35(skiatest::Reporter* reporter) {
2739    SkPath path;
2740    path.moveTo(0, 0);
2741    path.quadTo(0, 1, 1, 1);
2742    path.lineTo(1, 3);
2743    path.close();
2744    path.moveTo(2, 0);
2745    path.lineTo(3, 0);
2746    path.quadTo(0, 1, 1, 1);
2747    path.close();
2748    testSimplify(reporter, path);
2749}
2750
2751static void testQuadratic36(skiatest::Reporter* reporter) {
2752    SkPath path;
2753    path.moveTo(0, 0);
2754    path.quadTo(2, 1, 2, 3);
2755    path.lineTo(2, 3);
2756    path.close();
2757    path.moveTo(3, 1);
2758    path.lineTo(1, 2);
2759    path.quadTo(3, 2, 1, 3);
2760    path.close();
2761    testSimplify(reporter, path);
2762}
2763
2764static void testQuadratic37(skiatest::Reporter* reporter) {
2765    SkPath path;
2766    path.moveTo(0, 0);
2767    path.quadTo(0, 2, 1, 2);
2768    path.lineTo(1, 2);
2769    path.close();
2770    path.moveTo(0, 0);
2771    path.lineTo(3, 1);
2772    path.quadTo(0, 2, 1, 2);
2773    path.close();
2774    testSimplify(reporter, path);
2775}
2776
2777static void testQuadratic38(skiatest::Reporter* reporter) {
2778    SkPath path;
2779    path.moveTo(1, 0);
2780    path.quadTo(0, 1, 1, 1);
2781    path.lineTo(1, 1);
2782    path.close();
2783    path.moveTo(1, 0);
2784    path.lineTo(1, 2);
2785    path.quadTo(2, 2, 1, 3);
2786    path.close();
2787    testSimplify(reporter, path);
2788}
2789
2790static void testQuadratic51(skiatest::Reporter* reporter) {
2791    SkPath path;
2792    path.moveTo(369.863983f, 145.645813f);
2793    path.quadTo(382.380371f, 121.254936f, 406.236359f, 121.254936f);
2794    path.lineTo(369.863983f, 145.645813f);
2795    path.close();
2796    path.moveTo(369.970581f, 137.94342f);
2797    path.quadTo(383.98465f, 121.254936f, 406.235992f, 121.254936f);
2798    path.lineTo(369.970581f, 137.94342f);
2799    path.close();
2800    testSimplify(reporter, path);
2801}
2802
2803static void testQuadratic53(skiatest::Reporter* reporter) {
2804    SkPath path;
2805    path.moveTo(303.12088f, 141.299606f);
2806    path.lineTo(330.463562f, 217.659027f);
2807    path.lineTo(303.12088f, 141.299606f);
2808    path.close();
2809    path.moveTo(371.919067f, 205.854996f);
2810    path.lineTo(326.236786f, 205.854996f);
2811    path.quadTo(329.104431f, 231.663818f, 351.512085f, 231.663818f);
2812    path.lineTo(371.919067f, 205.854996f);
2813    path.close();
2814    testSimplify(reporter, path);
2815}
2816
2817static void testQuadratic55(skiatest::Reporter* reporter) {
2818    SkPath path;
2819path.moveTo(303.12088f, 141.299606f);
2820path.lineTo(330.463562f, 217.659027f);
2821path.lineTo(358.606506f, 141.299606f);
2822path.lineTo(303.12088f, 141.299606f);
2823path.close();
2824path.moveTo(326.236786f, 205.854996f);
2825path.quadTo(329.104431f, 231.663818f, 351.512085f, 231.663818f);
2826path.lineTo(326.236786f, 205.854996f);
2827path.close();
2828    testSimplify(reporter, path);
2829}
2830
2831static void testQuadratic56(skiatest::Reporter* reporter) {
2832    SkPath path;
2833path.moveTo(366.608826f, 151.196014f);
2834path.quadTo(378.803101f, 136.674606f, 398.164948f, 136.674606f);
2835path.lineTo(354.009216f, 208.816208f);
2836path.lineTo(393.291473f, 102.232819f);
2837path.lineTo(359.978058f, 136.581512f);
2838path.quadTo(378.315979f, 136.581512f, 388.322723f, 149.613556f);
2839path.lineTo(364.390686f, 157.898193f);
2840path.quadTo(375.281769f, 136.674606f, 396.039917f, 136.674606f);
2841path.lineTo(350, 120);
2842path.lineTo(366.608826f, 151.196014f);
2843path.close();
2844    testSimplify(reporter, path);
2845}
2846
2847static void testLine80(skiatest::Reporter* reporter) {
2848    SkPath path;
2849path.moveTo(4, 0);
2850path.lineTo(3, 7);
2851path.lineTo(7, 5);
2852path.lineTo(2, 2);
2853path.close();
2854path.moveTo(0, 6);
2855path.lineTo(6, 12);
2856path.lineTo(8, 3);
2857path.close();
2858    testSimplify(reporter, path);
2859}
2860
2861static void testQuadratic58(skiatest::Reporter* reporter) {
2862    SkPath path;
2863    path.moveTo(283.714233f, 240);
2864    path.lineTo(283.714233f, 141.299606f);
2865    path.lineTo(303.12088f, 141.299606f);
2866    path.lineTo(330.463562f, 217.659027f);
2867    path.lineTo(358.606506f, 141.299606f);
2868    path.lineTo(362.874634f, 159.705902f);
2869    path.lineTo(335.665344f, 233.397751f);
2870    path.lineTo(322.12738f, 233.397751f);
2871    path.lineTo(295.718353f, 159.505829f);
2872    path.lineTo(295.718353f, 240);
2873    path.lineTo(283.714233f, 240);
2874    path.close();
2875    path.moveTo(322.935669f, 231.030273f);
2876    path.quadTo(312.832214f, 220.393295f, 312.832214f, 203.454178f);
2877    path.quadTo(312.832214f, 186.981888f, 321.73526f, 176.444946f);
2878    path.quadTo(330.638306f, 165.90802f, 344.509705f, 165.90802f);
2879    path.quadTo(357.647522f, 165.90802f, 364.81665f, 175.244537f);
2880    path.lineTo(371.919067f, 205.854996f);
2881    path.lineTo(326.236786f, 205.854996f);
2882    path.quadTo(329.104431f, 231.663818f, 351.512085f, 231.663818f);
2883    path.lineTo(322.935669f, 231.030273f);
2884    path.close();
2885    path.moveTo(326.837006f, 195.984955f);
2886    path.lineTo(358.78125f, 195.984955f);
2887    path.quadTo(358.78125f, 175.778046f, 343.709442f, 175.778046f);
2888    path.quadTo(328.570923f, 175.778046f, 326.837006f, 195.984955f);
2889    path.close();
2890    testSimplify(reporter, path);
2891}
2892
2893static void testQuadratic59x(skiatest::Reporter* reporter) {
2894    SkPath path;
2895    path.setFillType(SkPath::kEvenOdd_FillType);
2896    path.moveTo(0, 0);
2897    path.quadTo(0, 0, 0, 0);
2898    path.lineTo(2, 2);
2899    path.close();
2900    path.moveTo(0, 0);
2901    path.lineTo(2, 0);
2902    path.quadTo(3, 1, 1, 2);
2903    path.close();
2904    testSimplify(reporter, path);
2905}
2906
2907static void testQuadratic59(skiatest::Reporter* reporter) {
2908    SkPath path;
2909    path.setFillType(SkPath::kWinding_FillType);
2910    path.moveTo(0, 0);
2911    path.quadTo(0, 0, 0, 0);
2912    path.lineTo(2, 2);
2913    path.close();
2914    path.moveTo(0, 0);
2915    path.lineTo(2, 0);
2916    path.quadTo(3, 1, 1, 2);
2917    path.close();
2918    testSimplify(reporter, path);
2919}
2920
2921static void testQuadratic63(skiatest::Reporter* reporter) {
2922    SkPath path;
2923    path.moveTo(0, 0);
2924    path.quadTo(0, 0, 0, 0);
2925    path.lineTo(3, 2);
2926    path.close();
2927    path.moveTo(1, 0);
2928    path.lineTo(2, 1);
2929    path.quadTo(2, 1, 2, 2);
2930    path.close();
2931    testSimplify(reporter, path);
2932}
2933
2934static void testQuadratic64(skiatest::Reporter* reporter) {
2935    SkPath path;
2936    path.moveTo(0, 0);
2937    path.quadTo(0, 0, 0, 0);
2938    path.lineTo(2, 3);
2939    path.close();
2940    path.moveTo(1, 2);
2941    path.lineTo(2, 2);
2942    path.quadTo(0, 3, 3, 3);
2943    path.close();
2944    testSimplify(reporter, path);
2945}
2946
2947static void testQuadratic65(skiatest::Reporter* reporter) {
2948    SkPath path;
2949    path.moveTo(0, 0);
2950    path.quadTo(0, 0, 0, 0);
2951    path.lineTo(3, 2);
2952    path.close();
2953    path.moveTo(2, 1);
2954    path.lineTo(2, 2);
2955    path.quadTo(0, 3, 1, 3);
2956    path.close();
2957    testSimplify(reporter, path);
2958}
2959
2960static void testQuadratic67x(skiatest::Reporter* reporter) {
2961    SkPath path;
2962    path.setFillType(SkPath::kEvenOdd_FillType);
2963    path.moveTo(0, 0);
2964    path.quadTo(0, 0, 2, 1);
2965    path.lineTo(2, 2);
2966    path.close();
2967    path.moveTo(0, 0);
2968    path.lineTo(2, 0);
2969    path.quadTo(1, 1, 3, 2);
2970    path.close();
2971    testSimplify(reporter, path);
2972}
2973
2974static void testQuadratic68(skiatest::Reporter* reporter) {
2975    SkPath path;
2976    path.moveTo(0, 0);
2977    path.quadTo(1, 0, 0, 1);
2978    path.lineTo(1, 2);
2979    path.close();
2980    path.moveTo(0, 0);
2981    path.lineTo(0, 0);
2982    path.quadTo(0, 1, 2, 1);
2983    path.close();
2984    testSimplify(reporter, path);
2985}
2986
2987static void testQuadratic69(skiatest::Reporter* reporter) {
2988    SkPath path;
2989    path.moveTo(0, 0);
2990    path.quadTo(0, 0, 0, 1);
2991    path.lineTo(3, 2);
2992    path.close();
2993    path.moveTo(2, 0);
2994    path.lineTo(1, 1);
2995    path.quadTo(3, 2, 2, 3);
2996    path.close();
2997    testSimplify(reporter, path);
2998}
2999
3000static void testQuadratic70x(skiatest::Reporter* reporter) {
3001    SkPath path;
3002    path.setFillType(SkPath::kEvenOdd_FillType);
3003    path.moveTo(0, 0);
3004    path.quadTo(1, 0, 0, 1);
3005    path.lineTo(1, 2);
3006    path.close();
3007    path.moveTo(0, 0);
3008    path.lineTo(0, 0);
3009    path.quadTo(0, 1, 2, 1);
3010    path.close();
3011    testSimplify(reporter, path);
3012}
3013
3014static void testQuadratic71(skiatest::Reporter* reporter) {
3015    SkPath path;
3016    path.moveTo(0, 0);
3017    path.quadTo(1, 0, 1, 1);
3018    path.lineTo(3, 2);
3019    path.close();
3020    path.moveTo(0, 0);
3021    path.lineTo(0, 0);
3022    path.quadTo(1, 1, 3, 1);
3023    path.close();
3024    testSimplify(reporter, path);
3025}
3026
3027static void testQuadratic72(skiatest::Reporter* reporter) {
3028    SkPath path;
3029    path.moveTo(0, 0);
3030    path.quadTo(1, 0, 1, 2);
3031    path.lineTo(1, 2);
3032    path.close();
3033    path.moveTo(0, 0);
3034    path.lineTo(1, 0);
3035    path.quadTo(0, 1, 3, 2);
3036    path.close();
3037    testSimplify(reporter, path);
3038}
3039
3040static void testQuadratic73(skiatest::Reporter* reporter) {
3041    SkPath path;
3042    path.moveTo(0, 0);
3043    path.quadTo(1, 0, 0, 3);
3044    path.lineTo(0, 3);
3045    path.close();
3046    path.moveTo(0, 0);
3047    path.lineTo(1, 0);
3048    path.quadTo(0, 1, 1, 1);
3049    path.close();
3050    testSimplify(reporter, path);
3051}
3052
3053static void testQuadratic74(skiatest::Reporter* reporter) {
3054    SkPath path;
3055    path.moveTo(0, 0);
3056    path.quadTo(1, 0, 1, 3);
3057    path.lineTo(1, 3);
3058    path.close();
3059    path.moveTo(0, 0);
3060    path.lineTo(0, 1);
3061    path.quadTo(3, 2, 2, 3);
3062    path.close();
3063    testSimplify(reporter, path);
3064}
3065
3066static void testQuadratic75(skiatest::Reporter* reporter) {
3067    SkPath path;
3068    path.moveTo(0, 0);
3069    path.quadTo(1, 0, 1, 3);
3070    path.lineTo(2, 3);
3071    path.close();
3072    path.moveTo(0, 0);
3073    path.lineTo(0, 1);
3074    path.quadTo(3, 2, 2, 3);
3075    path.close();
3076    testSimplify(reporter, path);
3077}
3078
3079static void testQuadratic76(skiatest::Reporter* reporter) {
3080    SkPath path;
3081    path.moveTo(0, 0);
3082    path.quadTo(0, 0, 0, 0);
3083    path.lineTo(2, 3);
3084    path.close();
3085    path.moveTo(1, 0);
3086    path.lineTo(1, 2);
3087    path.quadTo(1, 2, 2, 2);
3088    path.close();
3089    testSimplify(reporter, path);
3090}
3091
3092static void testQuadratic77(skiatest::Reporter* reporter) {
3093    SkPath path;
3094    path.moveTo(0, 0);
3095    path.quadTo(1, 0, 1, 1);
3096    path.lineTo(3, 1);
3097    path.close();
3098    path.moveTo(0, 0);
3099    path.lineTo(1, 0);
3100    path.quadTo(0, 1, 3, 2);
3101    path.close();
3102    testSimplify(reporter, path);
3103}
3104
3105static void testQuadratic78(skiatest::Reporter* reporter) {
3106    SkPath path;
3107    path.moveTo(0, 0);
3108    path.quadTo(1, 0, 1, 2);
3109    path.lineTo(3, 2);
3110    path.close();
3111    path.moveTo(0, 0);
3112    path.lineTo(0, 0);
3113    path.quadTo(2, 1, 0, 2);
3114    path.close();
3115    testSimplify(reporter, path);
3116}
3117
3118static void testQuadratic79(skiatest::Reporter* reporter) {
3119    SkPath path;
3120    path.moveTo(0, 0);
3121    path.quadTo(1, 0, 1, 2);
3122    path.lineTo(3, 2);
3123    path.close();
3124    path.moveTo(0, 0);
3125    path.lineTo(1, 0);
3126    path.quadTo(0, 1, 3, 2);
3127    path.close();
3128    testSimplify(reporter, path);
3129}
3130
3131static void testEight1(skiatest::Reporter* reporter) {
3132    SkPath path;
3133    path.moveTo(0, 0);
3134    path.lineTo(2, 2);
3135    path.lineTo(0, 2);
3136    path.lineTo(2, 0);
3137    path.close();
3138    testSimplify(reporter, path);
3139}
3140
3141static void testEight2(skiatest::Reporter* reporter) {
3142    SkPath path;
3143    path.moveTo(0, 0);
3144    path.lineTo(2, 0);
3145    path.lineTo(0, 2);
3146    path.lineTo(2, 2);
3147    path.close();
3148    testSimplify(reporter, path);
3149}
3150
3151static void testEight3(skiatest::Reporter* reporter) {
3152    SkPath path;
3153    path.moveTo(0, 0);
3154    path.lineTo(0, 2);
3155    path.lineTo(2, 0);
3156    path.lineTo(2, 2);
3157    path.close();
3158    testSimplify(reporter, path);
3159}
3160
3161static void testEight4(skiatest::Reporter* reporter) {
3162    SkPath path;
3163    path.moveTo(0, 0);
3164    path.lineTo(2, 2);
3165    path.lineTo(2, 0);
3166    path.lineTo(0, 2);
3167    path.close();
3168    testSimplify(reporter, path);
3169}
3170
3171static void testEight5(skiatest::Reporter* reporter) {
3172    SkPath path;
3173    path.moveTo(1, 0);
3174    path.lineTo(1, 2);
3175    path.lineTo(0, 2);
3176    path.lineTo(2, 0);
3177    path.close();
3178    testSimplify(reporter, path);
3179}
3180
3181static void testEight6(skiatest::Reporter* reporter) {
3182    SkPath path;
3183    path.moveTo(1, 0);
3184    path.lineTo(2, 0);
3185    path.lineTo(0, 2);
3186    path.lineTo(1, 2);
3187    path.close();
3188    testSimplify(reporter, path);
3189}
3190
3191static void testEight7(skiatest::Reporter* reporter) {
3192    SkPath path;
3193    path.moveTo(0, 0);
3194    path.lineTo(0, 1);
3195    path.lineTo(2, 1);
3196    path.lineTo(2, 2);
3197    path.close();
3198    testSimplify(reporter, path);
3199}
3200
3201static void testEight8(skiatest::Reporter* reporter) {
3202    SkPath path;
3203    path.moveTo(0, 0);
3204    path.lineTo(2, 2);
3205    path.lineTo(2, 1);
3206    path.lineTo(0, 1);
3207    path.close();
3208    testSimplify(reporter, path);
3209}
3210
3211static void testEight9(skiatest::Reporter* reporter) {
3212    SkPath path;
3213    path.moveTo(1, 0);
3214    path.lineTo(1, 2);
3215    path.lineTo(2, 1);
3216    path.lineTo(0, 1);
3217    path.close();
3218    testSimplify(reporter, path);
3219}
3220
3221static void testEight10(skiatest::Reporter* reporter) {
3222    SkPath path;
3223    path.moveTo(1, 0);
3224    path.lineTo(0, 1);
3225    path.lineTo(2, 1);
3226    path.lineTo(1, 2);
3227    path.close();
3228    testSimplify(reporter, path);
3229}
3230
3231static void testQuadratic80(skiatest::Reporter* reporter) {
3232    SkPath path;
3233    path.moveTo(0, 0);
3234    path.quadTo(1, 0, 2, 3);
3235    path.lineTo(2, 3);
3236    path.close();
3237    path.moveTo(1, 0);
3238    path.lineTo(3, 0);
3239    path.quadTo(0, 1, 1, 1);
3240    path.close();
3241    testSimplify(reporter, path);
3242}
3243
3244static void testQuadratic81(skiatest::Reporter* reporter) {
3245    SkPath path;
3246    path.moveTo(0, 0);
3247    path.quadTo(2, 0, 1, 1);
3248    path.lineTo(1, 1);
3249    path.close();
3250    path.moveTo(0, 0);
3251    path.lineTo(0, 0);
3252    path.quadTo(2, 1, 0, 2);
3253    path.close();
3254    testSimplify(reporter, path);
3255}
3256
3257static void testQuadratic82(skiatest::Reporter* reporter) {
3258    SkPath path;
3259    path.moveTo(0, 0);
3260    path.quadTo(2, 0, 1, 1);
3261    path.lineTo(0, 3);
3262    path.close();
3263    path.moveTo(0, 0);
3264    path.lineTo(0, 0);
3265    path.quadTo(2, 1, 0, 2);
3266    path.close();
3267    testSimplify(reporter, path);
3268}
3269
3270static void testQuadratic83(skiatest::Reporter* reporter) {
3271    SkPath path;
3272    path.moveTo(0, 0);
3273    path.quadTo(0, 0, 2, 0);
3274    path.lineTo(2, 2);
3275    path.close();
3276    path.moveTo(0, 1);
3277    path.lineTo(0, 2);
3278    path.quadTo(2, 2, 1, 3);
3279    path.close();
3280    testSimplify(reporter, path);
3281}
3282
3283static void testQuadratic84(skiatest::Reporter* reporter) {
3284    SkPath path;
3285    path.moveTo(0, 0);
3286    path.quadTo(2, 0, 1, 1);
3287    path.lineTo(2, 1);
3288    path.close();
3289    path.moveTo(1, 0);
3290    path.lineTo(2, 0);
3291    path.quadTo(0, 1, 2, 2);
3292    path.close();
3293    testSimplify(reporter, path);
3294}
3295
3296static void testQuadratic85(skiatest::Reporter* reporter) {
3297    SkPath path;
3298    path.moveTo(0, 0);
3299    path.quadTo(3, 0, 1, 1);
3300    path.lineTo(1, 1);
3301    path.close();
3302    path.moveTo(1, 0);
3303    path.lineTo(3, 0);
3304    path.quadTo(0, 1, 1, 2);
3305    path.close();
3306    testSimplify(reporter, path);
3307}
3308
3309static void testQuadratic86(skiatest::Reporter* reporter) {
3310    SkPath path;
3311    path.moveTo(0, 0);
3312    path.quadTo(0, 1, 1, 1);
3313    path.lineTo(2, 3);
3314    path.close();
3315    path.moveTo(0, 0);
3316    path.lineTo(0, 0);
3317    path.quadTo(1, 1, 1, 3);
3318    path.close();
3319    testSimplify(reporter, path);
3320}
3321
3322static void testQuadratic87(skiatest::Reporter* reporter) {
3323    SkPath path;
3324    path.moveTo(0, 0);
3325    path.quadTo(2, 1, 0, 2);
3326    path.lineTo(2, 3);
3327    path.close();
3328    path.moveTo(0, 0);
3329    path.lineTo(1, 1);
3330    path.quadTo(0, 2, 3, 2);
3331    path.close();
3332    testSimplify(reporter, path);
3333}
3334
3335static void testQuadratic88(skiatest::Reporter* reporter) {
3336    SkPath path;
3337    path.moveTo(0, 0);
3338    path.quadTo(2, 1, 0, 2);
3339    path.lineTo(2, 2);
3340    path.close();
3341    path.moveTo(1, 0);
3342    path.lineTo(1, 1);
3343    path.quadTo(0, 2, 2, 2);
3344    path.close();
3345    testSimplify(reporter, path);
3346}
3347
3348static void testQuadratic89x(skiatest::Reporter* reporter) {
3349    SkPath path;
3350    path.setFillType(SkPath::kEvenOdd_FillType);
3351    path.moveTo(0, 0);
3352    path.quadTo(3, 1, 2, 2);
3353    path.lineTo(0, 3);
3354    path.close();
3355    path.moveTo(0, 0);
3356    path.lineTo(2, 1);
3357    path.quadTo(3, 1, 3, 3);
3358    path.close();
3359    testSimplify(reporter, path);
3360}
3361
3362static void testQuadratic90x(skiatest::Reporter* reporter) {
3363    SkPath path;
3364    path.setFillType(SkPath::kEvenOdd_FillType);
3365    path.moveTo(0, 0);
3366    path.quadTo(3, 0, 2, 2);
3367    path.lineTo(1, 3);
3368    path.close();
3369    path.moveTo(0, 0);
3370    path.lineTo(0, 1);
3371    path.quadTo(3, 2, 2, 3);
3372    path.close();
3373    testSimplify(reporter, path);
3374}
3375
3376static void testQuadratic91(skiatest::Reporter* reporter) {
3377    SkPath path;
3378    path.moveTo(0, 0);
3379    path.quadTo(3, 2, 2, 3);
3380    path.lineTo(2, 3);
3381    path.close();
3382    path.moveTo(0, 0);
3383    path.lineTo(1, 1);
3384    path.quadTo(2, 1, 2, 3);
3385    path.close();
3386    testSimplify(reporter, path);
3387}
3388
3389static void testQuadratic92x(skiatest::Reporter* reporter) {
3390    SkPath path;
3391    path.setFillType(SkPath::kEvenOdd_FillType);
3392    path.moveTo(1, 0);
3393    path.quadTo(3, 0, 2, 2);
3394    path.lineTo(2, 2);
3395    path.close();
3396    path.moveTo(2, 0);
3397    path.lineTo(0, 1);
3398    path.quadTo(3, 2, 2, 3);
3399    path.close();
3400    testSimplify(reporter, path);
3401}
3402
3403static void testLine82(skiatest::Reporter* reporter) {
3404    SkPath path;
3405    path.addRect(20, 0, 40, 40, SkPath::kCCW_Direction);
3406    path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction);
3407    path.addRect(24, 32, 33, 36, SkPath::kCCW_Direction);
3408    testSimplify(reporter, path);
3409}
3410
3411static void testLine82a(skiatest::Reporter* reporter) {
3412    SkPath path;
3413    path.addRect(0, 0, 6, 10, SkPath::kCW_Direction);
3414    path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
3415    path.addRect(2, 6, 4, 8, SkPath::kCW_Direction);
3416    testSimplify(reporter, path);
3417}
3418
3419static void testLine82b(skiatest::Reporter* reporter) {
3420    SkPath path;
3421    path.addRect(0, 0, 6, 10, SkPath::kCW_Direction);
3422    path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
3423    path.addRect(2, 6, 4, 8, SkPath::kCCW_Direction);
3424    testSimplify(reporter, path);
3425}
3426
3427static void testLine82c(skiatest::Reporter* reporter) {
3428    SkPath path;
3429    path.addRect(0, 0, 6, 10, SkPath::kCW_Direction);
3430    path.addRect(2, 2, 4, 4, SkPath::kCCW_Direction);
3431    path.addRect(2, 6, 4, 8, SkPath::kCW_Direction);
3432    testSimplify(reporter, path);
3433}
3434
3435static void testLine82d(skiatest::Reporter* reporter) {
3436    SkPath path;
3437    path.addRect(0, 0, 6, 10, SkPath::kCW_Direction);
3438    path.addRect(2, 2, 4, 4, SkPath::kCCW_Direction);
3439    path.addRect(2, 6, 4, 8, SkPath::kCCW_Direction);
3440    testSimplify(reporter, path);
3441}
3442
3443static void testLine82e(skiatest::Reporter* reporter) {
3444    SkPath path;
3445    path.addRect(0, 0, 6, 10, SkPath::kCCW_Direction);
3446    path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
3447    path.addRect(2, 6, 4, 8, SkPath::kCW_Direction);
3448    testSimplify(reporter, path);
3449}
3450
3451static void testLine82f(skiatest::Reporter* reporter) {
3452    SkPath path;
3453    path.addRect(0, 0, 6, 10, SkPath::kCCW_Direction);
3454    path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
3455    path.addRect(2, 6, 4, 8, SkPath::kCCW_Direction);
3456    testSimplify(reporter, path);
3457}
3458
3459static void testLine82g(skiatest::Reporter* reporter) {
3460    SkPath path;
3461    path.addRect(0, 0, 6, 10, SkPath::kCCW_Direction);
3462    path.addRect(2, 2, 4, 4, SkPath::kCCW_Direction);
3463    path.addRect(2, 6, 4, 8, SkPath::kCW_Direction);
3464    testSimplify(reporter, path);
3465}
3466
3467static void testLine82h(skiatest::Reporter* reporter) {
3468    SkPath path;
3469    path.addRect(0, 0, 6, 10, SkPath::kCCW_Direction);
3470    path.addRect(2, 2, 4, 4, SkPath::kCCW_Direction);
3471    path.addRect(2, 6, 4, 8, SkPath::kCCW_Direction);
3472    testSimplify(reporter, path);
3473}
3474
3475static void testLine83(skiatest::Reporter* reporter) {
3476    SkPath path;
3477path.addRect(10, 30, 30, 40, SkPath::kCCW_Direction);
3478path.addRect(0, 12, 12, 18, SkPath::kCCW_Direction);
3479path.addRect(4, 13, 13, 16, SkPath::kCCW_Direction);
3480    testSimplify(reporter, path);
3481}
3482
3483static void testLine84(skiatest::Reporter* reporter) {
3484    SkPath path;
3485    path.addRect(0, 12, 60, 30, SkPath::kCCW_Direction);
3486    path.addRect(10, 20, 40, 30, SkPath::kCW_Direction);
3487    path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
3488    path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
3489    testSimplify(reporter, path);
3490}
3491
3492static void testLine84x(skiatest::Reporter* reporter) {
3493    SkPath path;
3494    path.setFillType(SkPath::kEvenOdd_FillType);
3495    path.addRect(0, 12, 60, 30, SkPath::kCCW_Direction);
3496    path.addRect(10, 20, 40, 30, SkPath::kCCW_Direction);
3497    path.addRect(0, 12, 12, 12, SkPath::kCCW_Direction);
3498    path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction);
3499    testSimplify(reporter, path);
3500}
3501
3502static void testLine85(skiatest::Reporter* reporter) {
3503    SkPath path;
3504    path.addRect(36, 0, 66, 60, SkPath::kCCW_Direction);
3505    path.addRect(20, 0, 40, 40, SkPath::kCCW_Direction);
3506    path.addRect(12, 0, 24, 24, SkPath::kCCW_Direction);
3507    path.addRect(32, 0, 36, 41, SkPath::kCCW_Direction);
3508    testSimplify(reporter, path);
3509}
3510
3511static void testQuadralateral1(skiatest::Reporter* reporter) {
3512    SkPath path;
3513    path.moveTo(0, 0);
3514    path.lineTo(0, 0);
3515    path.lineTo(0, 0);
3516    path.lineTo(3, 2);
3517    path.close();
3518    path.moveTo(0, 0);
3519    path.lineTo(2, 1);
3520    path.lineTo(2, 2);
3521    path.lineTo(2, 3);
3522    path.close();
3523    testSimplify(reporter, path);
3524}
3525
3526static void testCubic1(skiatest::Reporter* reporter) {
3527    SkPath path;
3528    path.moveTo(0, 0);
3529    path.cubicTo(0, 1, 1, 1, 1, 0);
3530    path.close();
3531    path.moveTo(1, 0);
3532    path.cubicTo(0, 0, 0, 1, 1, 1);
3533    path.close();
3534    testSimplify(reporter, path);
3535}
3536
3537static void testQuadratic93(skiatest::Reporter* reporter) {
3538    SkPath path;
3539    path.moveTo(3, 0);
3540    path.quadTo(0, 1, 3, 2);
3541    path.lineTo(0, 3);
3542    path.close();
3543    path.moveTo(1, 0);
3544    path.lineTo(2, 0);
3545    path.quadTo(1, 1, 2, 2);
3546    path.close();
3547    testSimplify(reporter, path);
3548}
3549
3550static void testCubic2(skiatest::Reporter* reporter) {
3551    SkPath path;
3552    path.moveTo(0,2);
3553    path.cubicTo(0,3, 2,1, 4,0);
3554    path.close();
3555    path.moveTo(1,2);
3556    path.cubicTo(0,4, 2,0, 3,0);
3557    path.close();
3558    testSimplify(reporter, path);
3559}
3560
3561static void testQuad1(skiatest::Reporter* reporter) {
3562    SkPath path;
3563    path.moveTo(0,0);
3564    path.quadTo(0,0, 0,1);
3565    path.lineTo(1,1);
3566    path.close();
3567    path.moveTo(0,0);
3568    path.quadTo(1,1, 0,2);
3569    path.close();
3570    testSimplify(reporter, path);
3571}
3572
3573static void testQuadralateral2(skiatest::Reporter* reporter) {
3574    SkPath path;
3575    path.moveTo(0, 0);
3576    path.lineTo(2, 2);
3577    path.lineTo(0, 3);
3578    path.lineTo(3, 3);
3579    path.close();
3580    path.moveTo(2, 0);
3581    path.lineTo(3, 0);
3582    path.lineTo(0, 1);
3583    path.lineTo(1, 2);
3584    path.close();
3585    testSimplify(reporter, path);
3586}
3587
3588static void testQuadratic94(skiatest::Reporter* reporter) {
3589    SkPath path;
3590    path.moveTo(0, 0);
3591    path.lineTo(8, 8);
3592    path.quadTo(8, 4, 4, 4);
3593    path.quadTo(4, 0, 0, 0);
3594    path.close();
3595    testSimplify(reporter, path);
3596}
3597
3598static void testQuadratic95(skiatest::Reporter* reporter) {
3599    SkPath path;
3600    path.moveTo(8, 8);
3601    path.lineTo(0, 0);
3602    path.quadTo(4, 0, 4, 4);
3603    path.quadTo(8, 4, 8, 8);
3604    path.close();
3605    testSimplify(reporter, path);
3606}
3607
3608static void testQuadratic96(skiatest::Reporter* reporter) {
3609    SkPath path;
3610    path.moveTo(8, 0);
3611    path.lineTo(0, 8);
3612    path.quadTo(0, 4, 4, 4);
3613    path.quadTo(4, 0, 8, 0);
3614    path.close();
3615    testSimplify(reporter, path);
3616}
3617
3618static void testQuadratic97(skiatest::Reporter* reporter) {
3619    SkPath path;
3620    path.moveTo(0, 8);
3621    path.lineTo(8, 0);
3622    path.quadTo(4, 0, 4, 4);
3623    path.quadTo(0, 4, 0, 8);
3624    path.close();
3625    testSimplify(reporter, path);
3626}
3627
3628static void testTriangles1(skiatest::Reporter* reporter) {
3629    SkPath path;
3630    path.moveTo(0, 0);
3631    path.lineTo(1, 0);
3632    path.lineTo(3, 3);
3633    path.close();
3634    path.moveTo(0, 0);
3635    path.lineTo(1, 2);
3636    path.lineTo(1, 1);
3637    path.close();
3638    testSimplify(reporter, path);
3639}
3640
3641static void testTriangles2(skiatest::Reporter* reporter) {
3642    SkPath path;
3643    path.moveTo(0, 0);
3644    path.lineTo(1, 0);
3645    path.lineTo(3, 3);
3646    path.close();
3647    path.moveTo(1, 1);
3648    path.lineTo(2, 3);
3649    path.lineTo(1, 2);
3650    path.close();
3651    testSimplify(reporter, path);
3652}
3653
3654// A test this for this case:
3655// contourA has two segments that are coincident
3656// contourB has two segments that are coincident in the same place
3657// each ends up with +2/0 pairs for winding count
3658// since logic in OpSegment::addTCoincident doesn't transfer count (only increments/decrements)
3659// can this be resolved to +4/0 ?
3660static void testAddTCoincident1(skiatest::Reporter* reporter) {
3661    SkPath path;
3662    path.moveTo(2, 0);
3663    path.lineTo(2, 2);
3664    path.lineTo(1, 1);
3665    path.lineTo(2, 0);
3666    path.lineTo(2, 2);
3667    path.lineTo(1, 1);
3668    path.close();
3669    path.moveTo(2, 0);
3670    path.lineTo(2, 2);
3671    path.lineTo(3, 1);
3672    path.lineTo(2, 0);
3673    path.lineTo(2, 2);
3674    path.lineTo(3, 1);
3675    path.close();
3676    testSimplify(reporter, path);
3677}
3678
3679// test with implicit close
3680static void testAddTCoincident2(skiatest::Reporter* reporter) {
3681    SkPath path;
3682    path.moveTo(2, 0);
3683    path.lineTo(2, 2);
3684    path.lineTo(1, 1);
3685    path.lineTo(2, 0);
3686    path.lineTo(2, 2);
3687    path.lineTo(1, 1);
3688    path.moveTo(2, 0);
3689    path.lineTo(2, 2);
3690    path.lineTo(3, 1);
3691    path.lineTo(2, 0);
3692    path.lineTo(2, 2);
3693    path.lineTo(3, 1);
3694    testSimplify(reporter, path);
3695}
3696
3697static void testQuad2(skiatest::Reporter* reporter) {
3698    SkPath path;
3699    path.moveTo(1, 0);
3700    path.quadTo(0, 1, 3, 2);
3701    path.lineTo(2, 3);
3702    path.close();
3703    path.moveTo(0, 0);
3704    path.lineTo(1, 0);
3705    path.quadTo(0, 1, 1, 1);
3706    path.close();
3707}
3708
3709static void testQuad3(skiatest::Reporter* reporter) {
3710    SkPath path;
3711    path.moveTo(1, 0);
3712    path.quadTo(0, 1, 3, 2);
3713    path.lineTo(3, 3);
3714    path.close();
3715    path.moveTo(0, 0);
3716    path.lineTo(1, 0);
3717    path.quadTo(0, 1, 1, 1);
3718    path.close();
3719    testSimplify(reporter, path);
3720}
3721
3722static void testQuad4(skiatest::Reporter* reporter) {
3723    SkPath path;
3724    path.moveTo(2, 0);
3725    path.quadTo(0, 1, 1, 1);
3726    path.lineTo(3, 3);
3727    path.close();
3728    path.moveTo(0, 0);
3729    path.lineTo(2, 0);
3730    path.quadTo(0, 1, 2, 2);
3731    path.close();
3732    testSimplify(reporter, path);
3733}
3734
3735static void testQuad5(skiatest::Reporter* reporter) {
3736    SkPath path;
3737    path.moveTo(2, 0);
3738    path.quadTo(0, 1, 2, 2);
3739    path.lineTo(1, 3);
3740    path.close();
3741    path.moveTo(0, 0);
3742    path.lineTo(2, 0);
3743    path.quadTo(0, 1, 1, 1);
3744    path.close();
3745    testSimplify(reporter, path);
3746}
3747
3748static void testQuad6(skiatest::Reporter* reporter) {
3749    SkPath path;
3750    path.moveTo(2, 0);
3751    path.quadTo(0, 1, 2, 2);
3752    path.lineTo(1, 3);
3753    path.close();
3754    path.moveTo(1, 0);
3755    path.lineTo(2, 0);
3756    path.quadTo(0, 1, 1, 1);
3757    path.close();
3758    testSimplify(reporter, path);
3759}
3760
3761static void testQuad7(skiatest::Reporter* reporter) {
3762    SkPath path;
3763    path.moveTo(3, 0);
3764    path.quadTo(0, 1, 1, 1);
3765    path.lineTo(1, 3);
3766    path.close();
3767    path.moveTo(1, 0);
3768    path.lineTo(3, 0);
3769    path.quadTo(0, 1, 1, 2);
3770    path.close();
3771    testSimplify(reporter, path);
3772}
3773
3774static void testQuadLineIntersect1(skiatest::Reporter* reporter) {
3775    SkPath path;
3776    path.moveTo(0, 0);
3777    path.quadTo(3, 1, 0, 3);
3778    path.lineTo(2, 3);
3779    path.close();
3780    path.moveTo(2, 0);
3781    path.lineTo(0, 1);
3782    path.quadTo(3, 1, 0, 2);
3783    path.close();
3784    testSimplify(reporter, path);
3785}
3786
3787static void testQuadLineIntersect2(skiatest::Reporter* reporter) {
3788    SkPath path;
3789    path.moveTo(0, 0);
3790    path.quadTo(3, 1, 0, 3);
3791    path.lineTo(0, 3);
3792    path.close();
3793    path.moveTo(2, 0);
3794    path.lineTo(0, 1);
3795    path.quadTo(3, 1, 0, 2);
3796    path.close();
3797    testSimplify(reporter, path);
3798}
3799
3800static void testQuadLineIntersect3(skiatest::Reporter* reporter) {
3801    SkPath path;
3802    path.moveTo(0, 0);
3803    path.quadTo(3, 1, 0, 3);
3804    path.lineTo(1, 3);
3805    path.close();
3806    path.moveTo(2, 0);
3807    path.lineTo(0, 1);
3808    path.quadTo(3, 1, 0, 2);
3809    path.close();
3810    testSimplify(reporter, path);
3811}
3812
3813static void skphealth_com76(skiatest::Reporter* reporter) {
3814    SkPath path;
3815    path.setFillType(SkPath::kWinding_FillType);
3816    path.moveTo(708.099182f, 7.09919119f);
3817    path.lineTo(708.099182f, 7.09920025f);
3818    path.quadTo(704.000000f, 11.2010098f, 704.000000f, 17.0000000f);
3819    path.lineTo(704.000000f, 33.0000000f);
3820    path.lineTo(705.000000f, 33.0000000f);
3821    path.lineTo(705.000000f, 17.0000000f);
3822    path.cubicTo(705.000000f, 13.4101496f, 706.455078f, 10.1601505f, 708.807617f, 7.80761385f);
3823    path.lineTo(708.099182f, 7.09919119f);
3824    path.close();
3825    path.moveTo(704.000000f, 3.00000000f);
3826    path.lineTo(704.000000f, 33.0000000f);
3827    path.lineTo(705.000000f, 33.0000000f);
3828    path.lineTo(719.500000f, 3.00000000f);
3829    testSimplify(reporter, path);
3830}
3831
3832static void tooCloseTest(skiatest::Reporter* reporter) {
3833    SkPath path;
3834    path.moveTo(0, 0);
3835    path.lineTo(1, 1);
3836    path.lineTo(1,-1);
3837    path.close();
3838    path.moveTo(0, 0);
3839    path.lineTo(1,-2);
3840    path.lineTo(1, 2);
3841    path.lineTo(2, 0);
3842    path.close();
3843    testSimplify(reporter, path);
3844}
3845
3846static void testRect1(skiatest::Reporter* reporter) {
3847    SkPath path;
3848    path.addRect(0, 0, 60, 60, SkPath::kCCW_Direction);
3849    path.addRect(30, 20, 50, 50, SkPath::kCCW_Direction);
3850    path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction);
3851    path.addRect(32, 24, 36, 41, SkPath::kCCW_Direction);
3852    testSimplify(reporter, path);
3853}
3854
3855static void testRect2(skiatest::Reporter* reporter) {
3856    SkPath path;
3857    path.setFillType(SkPath::kWinding_FillType);
3858    path.moveTo(0, 0);
3859    path.lineTo(60, 0);
3860    path.lineTo(60, 60);
3861    path.lineTo(0, 60);
3862    path.close();
3863    path.moveTo(30, 20);
3864    path.lineTo(30, 50);
3865    path.lineTo(50, 50);
3866    path.lineTo(50, 20);
3867    path.close();
3868    path.moveTo(24, 20);
3869    path.lineTo(24, 30);
3870    path.lineTo(36, 30);
3871    path.lineTo(36, 20);
3872    path.close();
3873    path.moveTo(32, 24);
3874    path.lineTo(32, 41);
3875    path.lineTo(36, 41);
3876    path.lineTo(36, 24);
3877    path.close();
3878    testSimplify(reporter, path);
3879}
3880
3881static void testTriangles3x(skiatest::Reporter* reporter) {
3882    SkPath path;
3883    path.setFillType(SkPath::kEvenOdd_FillType);
3884    path.moveTo(1, 0);
3885    path.quadTo(0, 1, 3, 2);
3886    path.lineTo(1, 3);
3887    path.close();
3888    path.moveTo(0, 0);
3889    path.lineTo(1, 1);
3890    path.quadTo(2, 1, 0, 2);
3891    path.close();
3892    testSimplify(reporter, path);
3893}
3894
3895static void testQuad8(skiatest::Reporter* reporter) {
3896    SkPath path;
3897    path.moveTo(3, 0);
3898    path.quadTo(0, 1, 3, 2);
3899    path.lineTo(0, 3);
3900    path.close();
3901    path.moveTo(1, 0);
3902    path.lineTo(3, 0);
3903    path.quadTo(1, 1, 2, 2);
3904    path.close();
3905    testSimplify(reporter, path);
3906}
3907
3908static void testTriangles4x(skiatest::Reporter* reporter) {
3909    SkPath path;
3910    path.setFillType(SkPath::kEvenOdd_FillType);
3911    path.moveTo(0, 0);
3912    path.quadTo(2, 0, 0, 3);
3913    path.lineTo(2, 3);
3914    path.close();
3915    path.moveTo(0, 0);
3916    path.lineTo(0, 1);
3917    path.quadTo(3, 2, 2, 3);
3918    path.close();
3919    testSimplify(reporter, path);
3920}
3921
3922static void testQuad9(skiatest::Reporter* reporter) {
3923    SkPath path;
3924    path.setFillType(SkPath::kEvenOdd_FillType);
3925    path.moveTo(1, 0);
3926    path.quadTo(0, 1, 3, 2);
3927    path.lineTo(1, 3);
3928    path.close();
3929    path.moveTo(1, 0);
3930    path.lineTo(1, 1);
3931    path.quadTo(2, 1, 1, 3);
3932    path.close();
3933    testSimplify(reporter, path);
3934}
3935
3936static void testQuad10(skiatest::Reporter* reporter) {
3937    SkPath path;
3938    path.moveTo(1, 0);
3939    path.quadTo(0, 1, 3, 2);
3940    path.lineTo(3, 3);
3941    path.close();
3942    path.moveTo(1, 0);
3943    path.lineTo(2, 0);
3944    path.quadTo(2, 3, 3, 3);
3945    path.close();
3946    testSimplify(reporter, path);
3947}
3948
3949static void testQuad11(skiatest::Reporter* reporter) {
3950    SkPath path;
3951    path.moveTo(2, 0);
3952    path.quadTo(0, 1, 1, 2);
3953    path.lineTo(1, 2);
3954    path.close();
3955    path.moveTo(0, 0);
3956    path.lineTo(1, 1);
3957    path.quadTo(1, 3, 3, 3);
3958    path.close();
3959    testSimplify(reporter, path);
3960}
3961
3962static void (*firstTest)(skiatest::Reporter* ) = 0;
3963
3964static TestDesc tests[] = {
3965    TEST(testQuad11),
3966    TEST(testQuad10),
3967    TEST(testQuad9),
3968    TEST(testTriangles4x),
3969    TEST(testQuad8),
3970    TEST(testTriangles3x),
3971    TEST(testRect2),
3972    TEST(testRect1),
3973    TEST(tooCloseTest),
3974    TEST(skphealth_com76),
3975    TEST(testQuadLineIntersect1),
3976    TEST(testQuadLineIntersect2),
3977    TEST(testQuadLineIntersect3),
3978    TEST(testQuad7),
3979    TEST(testQuad6),
3980    TEST(testQuad5),
3981    TEST(testQuad4),
3982    TEST(testQuad3),
3983    TEST(testQuad2),
3984    TEST(testAddTCoincident2),
3985    TEST(testAddTCoincident1),
3986    TEST(testTriangles2),
3987    TEST(testTriangles1),
3988    TEST(testQuadratic97),
3989    TEST(testQuadratic96),
3990    TEST(testQuadratic95),
3991    TEST(testQuadratic94),
3992    TEST(testQuadralateral2),
3993    TEST(testQuad1),
3994    TEST(testCubic2),
3995    TEST(testCubic1),
3996    TEST(testQuadralateral1),
3997    TEST(testLine85),
3998    TEST(testLine84),
3999    TEST(testLine84x),
4000    TEST(testLine83),
4001    TEST(testLine82h),
4002    TEST(testLine82g),
4003    TEST(testLine82f),
4004    TEST(testLine82e),
4005    TEST(testLine82d),
4006    TEST(testLine82c),
4007    TEST(testLine82b),
4008    TEST(testLine82a),
4009    TEST(testLine82),
4010    TEST(testQuadratic93),
4011    TEST(testQuadratic92x),
4012    TEST(testQuadratic91),
4013    TEST(testQuadratic90x),
4014    TEST(testQuadratic89x),
4015    TEST(testQuadratic88),
4016    TEST(testQuadratic87),
4017    TEST(testQuadratic86),
4018    TEST(testQuadratic85),
4019    TEST(testQuadratic84),
4020    TEST(testQuadratic83),
4021    TEST(testQuadratic82),
4022    TEST(testQuadratic81),
4023    TEST(testQuadratic80),
4024    TEST(testEight1),
4025    TEST(testEight2),
4026    TEST(testEight3),
4027    TEST(testEight4),
4028    TEST(testEight5),
4029    TEST(testEight6),
4030    TEST(testEight7),
4031    TEST(testEight8),
4032    TEST(testEight9),
4033    TEST(testEight10),
4034    TEST(testQuadratic79),
4035    TEST(testQuadratic78),
4036    TEST(testQuadratic77),
4037    TEST(testQuadratic76),
4038    TEST(testQuadratic75),
4039    TEST(testQuadratic74),
4040    TEST(testQuadratic73),
4041    TEST(testQuadratic72),
4042    TEST(testQuadratic71),
4043    TEST(testQuadratic70x),
4044    TEST(testQuadratic69),
4045    TEST(testQuadratic68),
4046    TEST(testQuadratic67x),
4047    TEST(testQuadratic65),
4048    TEST(testQuadratic64),
4049    TEST(testQuadratic63),
4050    TEST(testLine1a),
4051    TEST(testLine1ax),
4052    TEST(testQuadratic59),
4053    TEST(testQuadratic59x),
4054    TEST(testQuadratic58),
4055    TEST(testQuadratic56),
4056    TEST(testQuadratic55),
4057    TEST(testQuadratic53),
4058    TEST(testQuadratic51),
4059    TEST(testQuadratic38),
4060    TEST(testQuadratic37),
4061    TEST(testQuadratic36),
4062    TEST(testQuadratic35),
4063    TEST(testQuadratic34),
4064    TEST(testQuadratic33),
4065    TEST(testQuadratic32),
4066    TEST(testQuadratic31),
4067    TEST(testQuadratic30),
4068    TEST(testQuadratic29),
4069    TEST(testQuadratic28),
4070    TEST(testQuadratic27),
4071    TEST(testQuadratic26),
4072    TEST(testQuadratic25),
4073    TEST(testQuadratic24),
4074    TEST(testQuadratic23),
4075    TEST(testQuadratic22),
4076    TEST(testQuadratic21),
4077    TEST(testQuadratic20),
4078    TEST(testQuadratic19),
4079    TEST(testQuadratic18),
4080    TEST(testQuadratic17x),
4081    TEST(testQuadratic15),
4082    TEST(testQuadratic14),
4083    TEST(testQuadratic9),
4084    TEST(testQuadratic8),
4085    TEST(testQuadratic7),
4086    TEST(testQuadratic6),
4087    TEST(testQuadratic5),
4088    TEST(testQuadratic4x),
4089    TEST(testQuadratic3x),
4090    TEST(testQuadratic2x),
4091    TEST(testQuadratic1x),
4092    TEST(testQuadratic4),
4093    TEST(testQuadratic3),
4094    TEST(testQuadratic2),
4095    TEST(testQuadratic1),
4096    TEST(testLine4ax),
4097    TEST(testLine3aax),
4098    TEST(testLine2ax),
4099    TEST(testLine1ax),
4100    TEST(testQuadralateral9x),
4101    TEST(testQuadralateral8x),
4102    TEST(testQuadralateral7x),
4103    TEST(testQuadralateral6x),
4104    TEST(testQuadralateral6ax),
4105    TEST(testQuadralateral9),
4106    TEST(testQuadralateral8),
4107    TEST(testQuadralateral7),
4108    TEST(testQuadralateral6),
4109    TEST(testQuadralateral6a),
4110    TEST(testFauxQuadralateral6dx),
4111    TEST(testFauxQuadralateral6cx),
4112    TEST(testFauxQuadralateral6bx),
4113    TEST(testFauxQuadralateral6ax),
4114    TEST(testFauxQuadralateral6x),
4115    TEST(testFauxQuadralateral6d),
4116    TEST(testFauxQuadralateral6c),
4117    TEST(testFauxQuadralateral6b),
4118    TEST(testFauxQuadralateral6a),
4119    TEST(testFauxQuadralateral6),
4120    TEST(testQuadralateral5x),
4121    TEST(testQuadralateral5),
4122    TEST(testNondegenerate4x),
4123    TEST(testNondegenerate3x),
4124    TEST(testNondegenerate2x),
4125    TEST(testNondegenerate1x),
4126    TEST(testNondegenerate4),
4127    TEST(testNondegenerate3),
4128    TEST(testNondegenerate2),
4129    TEST(testNondegenerate1),
4130    TEST(testDegenerate4x),
4131    TEST(testDegenerate3x),
4132    TEST(testDegenerate2x),
4133    TEST(testDegenerate1x),
4134    TEST(testDegenerate4),
4135    TEST(testDegenerate3),
4136    TEST(testDegenerate2),
4137    TEST(testDegenerate1),
4138    TEST(testLine79x),
4139    TEST(testLine78x),
4140    TEST(testLine77x),
4141    TEST(testLine76x),
4142    TEST(testLine75x),
4143    TEST(testLine74x),
4144    TEST(testLine73x),
4145    TEST(testLine72x),
4146    TEST(testLine71x),
4147    TEST(testLine70x),
4148    TEST(testLine69x),
4149    TEST(testLine68hx),
4150    TEST(testLine68gx),
4151    TEST(testLine68fx),
4152    TEST(testLine68ex),
4153    TEST(testLine68dx),
4154    TEST(testLine68cx),
4155    TEST(testLine68bx),
4156    TEST(testLine68ax),
4157    TEST(testLine67x),
4158    TEST(testLine66x),
4159    TEST(testLine65x),
4160    TEST(testLine64x),
4161    TEST(testLine63x),
4162    TEST(testLine62x),
4163    TEST(testLine61x),
4164    TEST(testLine60x),
4165    TEST(testLine59x),
4166    TEST(testLine58x),
4167    TEST(testLine57x),
4168    TEST(testLine56x),
4169    TEST(testLine55x),
4170    TEST(testLine54x),
4171    TEST(testLine53x),
4172    TEST(testLine52x),
4173    TEST(testLine51x),
4174    TEST(testLine50x),
4175    TEST(testLine49x),
4176    TEST(testLine48x),
4177    TEST(testLine47x),
4178    TEST(testLine46x),
4179    TEST(testLine45x),
4180    TEST(testLine44x),
4181    TEST(testLine43x),
4182    TEST(testLine42x),
4183    TEST(testLine41x),
4184    TEST(testLine40x),
4185    TEST(testLine38x),
4186    TEST(testLine37x),
4187    TEST(testLine36x),
4188    TEST(testLine35x),
4189    TEST(testLine34x),
4190    TEST(testLine33x),
4191    TEST(testLine32x),
4192    TEST(testLine31x),
4193    TEST(testLine30x),
4194    TEST(testLine29x),
4195    TEST(testLine28x),
4196    TEST(testLine27x),
4197    TEST(testLine26x),
4198    TEST(testLine25x),
4199    TEST(testLine24ax),
4200    TEST(testLine24x),
4201    TEST(testLine23x),
4202    TEST(testLine22x),
4203    TEST(testLine21x),
4204    TEST(testLine20x),
4205    TEST(testLine19x),
4206    TEST(testLine18x),
4207    TEST(testLine17x),
4208    TEST(testLine16x),
4209    TEST(testLine15x),
4210    TEST(testLine14x),
4211    TEST(testLine13x),
4212    TEST(testLine12x),
4213    TEST(testLine11x),
4214    TEST(testLine10ax),
4215    TEST(testLine10x),
4216    TEST(testLine9x),
4217    TEST(testLine8x),
4218    TEST(testLine7bx),
4219    TEST(testLine7ax),
4220    TEST(testLine7x),
4221    TEST(testLine6x),
4222    TEST(testLine5x),
4223    TEST(testLine4x),
4224    TEST(testLine3bx),
4225    TEST(testLine3ax),
4226    TEST(testLine3x),
4227    TEST(testLine2x),
4228    TEST(testLine1x),
4229    TEST(testLine81),
4230    TEST(testLine80),
4231    TEST(testLine79),
4232    TEST(testLine78),
4233    TEST(testLine77),
4234    TEST(testLine76),
4235    TEST(testLine75),
4236    TEST(testLine74),
4237    TEST(testLine73),
4238    TEST(testLine72),
4239    TEST(testLine71),
4240    TEST(testLine70),
4241    TEST(testLine69),
4242    TEST(testLine68h),
4243    TEST(testLine68g),
4244    TEST(testLine68f),
4245    TEST(testLine68e),
4246    TEST(testLine68d),
4247    TEST(testLine68c),
4248    TEST(testLine68b),
4249    TEST(testLine68a),
4250    TEST(testLine67),
4251    TEST(testLine66),
4252    TEST(testLine65),
4253    TEST(testLine64),
4254    TEST(testLine63),
4255    TEST(testLine62),
4256    TEST(testLine61),
4257    TEST(testLine60),
4258    TEST(testLine59),
4259    TEST(testLine58),
4260    TEST(testLine57),
4261    TEST(testLine56),
4262    TEST(testLine55),
4263    TEST(testLine54),
4264    TEST(testLine53),
4265    TEST(testLine52),
4266    TEST(testLine51),
4267    TEST(testLine50),
4268    TEST(testLine49),
4269    TEST(testLine48),
4270    TEST(testLine47),
4271    TEST(testLine46),
4272    TEST(testLine45),
4273    TEST(testLine44),
4274    TEST(testLine43),
4275    TEST(testLine42),
4276    TEST(testLine41),
4277    TEST(testLine40),
4278    TEST(testLine38),
4279    TEST(testLine37),
4280    TEST(testLine36),
4281    TEST(testLine35),
4282    TEST(testLine34),
4283    TEST(testLine33),
4284    TEST(testLine32),
4285    TEST(testLine31),
4286    TEST(testLine30),
4287    TEST(testLine29),
4288    TEST(testLine28),
4289    TEST(testLine27),
4290    TEST(testLine26),
4291    TEST(testLine25),
4292    TEST(testLine24a),
4293    TEST(testLine24),
4294    TEST(testLine23),
4295    TEST(testLine22),
4296    TEST(testLine21),
4297    TEST(testLine20),
4298    TEST(testLine19),
4299    TEST(testLine18),
4300    TEST(testLine17),
4301    TEST(testLine16),
4302    TEST(testLine15),
4303    TEST(testLine14),
4304    TEST(testLine13),
4305    TEST(testLine12),
4306    TEST(testLine11),
4307    TEST(testLine10a),
4308    TEST(testLine10),
4309    TEST(testLine9),
4310    TEST(testLine8),
4311    TEST(testLine7b),
4312    TEST(testLine7a),
4313    TEST(testLine7),
4314    TEST(testLine6),
4315    TEST(testLine5),
4316    TEST(testLine4),
4317    TEST(testLine3b),
4318    TEST(testLine3a),
4319    TEST(testLine3),
4320    TEST(testLine2),
4321    TEST(testLine1),
4322};
4323
4324static const size_t testCount = SK_ARRAY_COUNT(tests);
4325
4326static TestDesc subTests[] = {
4327    TEST(testLine3),
4328    TEST(testLine2),
4329    TEST(testLine1),
4330};
4331
4332static const size_t subTestCount = SK_ARRAY_COUNT(subTests);
4333
4334static void (*firstSubTest)(skiatest::Reporter* ) = 0;
4335
4336static bool runSubTestsFirst = false;
4337static bool runReverse = false;
4338static void (*stopTest)(skiatest::Reporter* ) = 0;
4339
4340static void PathOpsSimplifyTest(skiatest::Reporter* reporter) {
4341#ifdef SK_DEBUG
4342    SkPathOpsDebug::gMaxWindSum = 4;
4343    SkPathOpsDebug::gMaxWindValue = 4;
4344#endif
4345    if (runSubTestsFirst) {
4346        RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, runReverse);
4347    }
4348    RunTestSet(reporter, tests, testCount, firstTest, stopTest, runReverse);
4349    if (!runSubTestsFirst) {
4350        RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, runReverse);
4351    }
4352#ifdef SK_DEBUG
4353    SkPathOpsDebug::gMaxWindSum = SK_MaxS32;
4354    SkPathOpsDebug::gMaxWindValue = SK_MaxS32;
4355#endif
4356}
4357
4358#include "TestClassDef.h"
4359DEFINE_TESTCLASS_SHORT(PathOpsSimplifyTest)
4360