blob: 75b6030aa5879f2b1d005f5e6393cf6e97287006 [file] [log] [blame]
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001/*
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
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000011static void cubicOp1d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +000012 SkPath path, pathB;
13 path.setFillType(SkPath::kWinding_FillType);
14 path.moveTo(0,1);
15 path.cubicTo(0,2, 1,0, 1,0);
16 path.close();
17 pathB.setFillType(SkPath::kWinding_FillType);
18 pathB.moveTo(0,1);
19 pathB.cubicTo(0,1, 1,0, 2,0);
20 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000021 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +000022}
23
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000024static void cubicOp2d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +000025 SkPath path, pathB;
26 path.setFillType(SkPath::kWinding_FillType);
27 path.moveTo(0,2);
28 path.cubicTo(0,1, 1,0, 1,0);
29 path.close();
30 pathB.setFillType(SkPath::kWinding_FillType);
31 pathB.moveTo(0,1);
32 pathB.cubicTo(0,1, 2,0, 1,0);
33 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000034 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +000035}
36
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000037static void cubicOp3d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +000038 SkPath path, pathB;
39 path.setFillType(SkPath::kWinding_FillType);
40 path.moveTo(0,1);
41 path.cubicTo(2,3, 1,0, 1,0);
42 path.close();
43 pathB.setFillType(SkPath::kWinding_FillType);
44 pathB.moveTo(0,1);
45 pathB.cubicTo(0,1, 1,0, 3,2);
46 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000047 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +000048}
49
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000050static void cubicOp5d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +000051 SkPath path, pathB;
52 path.setFillType(SkPath::kWinding_FillType);
53 path.moveTo(0,1);
54 path.cubicTo(0,2, 1,0, 2,0);
55 path.close();
56 pathB.setFillType(SkPath::kWinding_FillType);
57 pathB.moveTo(0,1);
58 pathB.cubicTo(0,2, 1,0, 2,0);
59 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000060 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +000061}
62
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000063static void cubicOp6d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +000064 SkPath path, pathB;
65 path.setFillType(SkPath::kWinding_FillType);
66 path.moveTo(0,1);
67 path.cubicTo(0,6, 1,0, 3,0);
68 path.close();
69 pathB.setFillType(SkPath::kWinding_FillType);
70 pathB.moveTo(0,1);
71 pathB.cubicTo(0,3, 1,0, 6,0);
72 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000073 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +000074}
75
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000076static void cubicOp7d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +000077 SkPath path, pathB;
78 path.setFillType(SkPath::kWinding_FillType);
79 path.moveTo(0,1);
80 path.cubicTo(3,4, 1,0, 3,0);
81 path.close();
82 pathB.setFillType(SkPath::kWinding_FillType);
83 pathB.moveTo(0,1);
84 pathB.cubicTo(0,3, 1,0, 4,3);
85 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000086 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +000087}
88
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000089static void cubicOp8d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +000090 SkPath path, pathB;
91 path.setFillType(SkPath::kWinding_FillType);
92 path.moveTo(0,1);
93 path.cubicTo(0,5, 1,0, 4,0);
94 path.close();
95 pathB.setFillType(SkPath::kWinding_FillType);
96 pathB.moveTo(0,1);
97 pathB.cubicTo(0,4, 1,0, 5,0);
98 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000099 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000100}
101
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000102static void cubicOp9d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000103 SkPath path, pathB;
104 path.setFillType(SkPath::kWinding_FillType);
105 path.moveTo(0,1);
106 path.cubicTo(1,6, 1,0, 2,1);
107 path.close();
108 pathB.setFillType(SkPath::kWinding_FillType);
109 pathB.moveTo(0,1);
110 pathB.cubicTo(1,2, 1,0, 6,1);
111 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000112 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000113}
114
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000115static void quadOp9d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000116 SkPath path, pathB;
117 path.setFillType(SkPath::kWinding_FillType);
118 path.moveTo(0,1);
119 path.quadTo(1,6, 1.5f,1);
120 path.quadTo(1.5f,0.5f, 2,1);
121 path.close();
122 pathB.setFillType(SkPath::kWinding_FillType);
123 pathB.moveTo(0,1);
124 pathB.quadTo(1,2, 1.4f,1);
125 pathB.quadTo(3,0.4f, 6,1);
126 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000127 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000128}
129
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000130static void lineOp9d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000131 SkPath path, pathB;
132 path.setFillType(SkPath::kWinding_FillType);
133 path.moveTo(0,1);
134 path.lineTo(1,6);
135 path.lineTo(1.5f,1);
136 path.lineTo(1.8f,0.8f);
137 path.lineTo(2,1);
138 path.close();
139 pathB.setFillType(SkPath::kWinding_FillType);
140 pathB.moveTo(0,1);
141 pathB.lineTo(1,2);
142 pathB.lineTo(1.4f,1);
143 pathB.lineTo(3,0.4f);
144 pathB.lineTo(6,1);
145 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000146 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000147}
148
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000149static void cubicOp1i(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000150 SkPath path, pathB;
151 path.setFillType(SkPath::kWinding_FillType);
152 path.moveTo(0,1);
153 path.cubicTo(1,2, 1,0, 2,1);
154 path.close();
155 pathB.setFillType(SkPath::kWinding_FillType);
156 pathB.moveTo(0,1);
157 pathB.cubicTo(1,2, 1,0, 2,1);
158 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000159 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000160}
161
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000162static void cubicOp10d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000163 SkPath path, pathB;
164 path.setFillType(SkPath::kWinding_FillType);
165 path.moveTo(0,1);
166 path.cubicTo(1,3, 1,0, 4,1);
167 path.close();
168 pathB.setFillType(SkPath::kWinding_FillType);
169 pathB.moveTo(0,1);
170 pathB.cubicTo(1,4, 1,0, 3,1);
171 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000172 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000173}
174
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000175static void cubicOp11d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000176 SkPath path, pathB;
177 path.setFillType(SkPath::kWinding_FillType);
178 path.moveTo(0,1);
179 path.cubicTo(3,4, 1,0, 5,1);
180 path.close();
181 pathB.setFillType(SkPath::kWinding_FillType);
182 pathB.moveTo(0,1);
183 pathB.cubicTo(1,5, 1,0, 4,3);
184 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000185 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000186}
187
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000188static void cubicOp12d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000189 SkPath path, pathB;
190 path.setFillType(SkPath::kWinding_FillType);
191 path.moveTo(0,1);
192 path.cubicTo(1,6, 1,0, 1,0);
193 path.close();
194 pathB.setFillType(SkPath::kWinding_FillType);
195 pathB.moveTo(0,1);
196 pathB.cubicTo(0,1, 1,0, 6,1);
197 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000198 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000199}
200
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000201static void cubicOp13d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000202 SkPath path, pathB;
203 path.setFillType(SkPath::kWinding_FillType);
204 path.moveTo(0,1);
205 path.cubicTo(4,5, 1,0, 5,3);
206 path.close();
207 pathB.setFillType(SkPath::kWinding_FillType);
208 pathB.moveTo(0,1);
209 pathB.cubicTo(3,5, 1,0, 5,4);
210 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000211 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000212}
213
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000214static void cubicOp14d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000215 SkPath path, pathB;
216 path.setFillType(SkPath::kWinding_FillType);
217 path.moveTo(0,1);
218 path.cubicTo(0,2, 2,0, 2,1);
219 path.close();
220 pathB.setFillType(SkPath::kWinding_FillType);
221 pathB.moveTo(0,2);
222 pathB.cubicTo(1,2, 1,0, 2,0);
223 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000224 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000225}
226
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000227static void cubicOp15d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000228 SkPath path, pathB;
229 path.setFillType(SkPath::kWinding_FillType);
230 path.moveTo(0,1);
231 path.cubicTo(3,6, 2,0, 2,1);
232 path.close();
233 pathB.setFillType(SkPath::kWinding_FillType);
234 pathB.moveTo(0,2);
235 pathB.cubicTo(1,2, 1,0, 6,3);
236 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000237 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000238}
239
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000240static void cubicOp16d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000241 SkPath path, pathB;
242 path.setFillType(SkPath::kWinding_FillType);
243 path.moveTo(0,2);
244 path.cubicTo(0,1, 3,0, 1,0);
245 path.close();
246 pathB.setFillType(SkPath::kWinding_FillType);
247 pathB.moveTo(0,3);
248 pathB.cubicTo(0,1, 2,0, 1,0);
249 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000250 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000251}
252
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000253static void cubicOp17d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000254 SkPath path, pathB;
255 path.setFillType(SkPath::kWinding_FillType);
256 path.moveTo(0,2);
257 path.cubicTo(0,2, 4,0, 2,1);
258 path.close();
259 pathB.setFillType(SkPath::kWinding_FillType);
260 pathB.moveTo(0,4);
261 pathB.cubicTo(1,2, 2,0, 2,0);
262 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000263 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000264}
265
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000266static void cubicOp18d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000267 SkPath path, pathB;
268 path.setFillType(SkPath::kWinding_FillType);
269 path.moveTo(0,1);
270 path.cubicTo(3,5, 2,0, 2,1);
271 path.close();
272 pathB.setFillType(SkPath::kWinding_FillType);
273 pathB.moveTo(0,2);
274 pathB.cubicTo(1,2, 1,0, 5,3);
275 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000276 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000277}
278
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000279static void cubicOp19i(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000280 SkPath path, pathB;
281 path.setFillType(SkPath::kWinding_FillType);
282 path.moveTo(0,2);
283 path.cubicTo(0,1, 2,1, 6,2);
284 path.close();
285 pathB.setFillType(SkPath::kWinding_FillType);
286 pathB.moveTo(1,2);
287 pathB.cubicTo(2,6, 2,0, 1,0);
288 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000289 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000290}
291
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000292static void cubicOp20d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000293 SkPath path, pathB;
294 path.setFillType(SkPath::kWinding_FillType);
295 path.moveTo(0,1);
296 path.cubicTo(0,1, 6,0, 2,1);
297 path.close();
298 pathB.setFillType(SkPath::kWinding_FillType);
299 pathB.moveTo(0,6);
300 pathB.cubicTo(1,2, 1,0, 1,0);
301 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000302 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000303}
304
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000305static void cubicOp21d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000306 SkPath path, pathB;
307 path.setFillType(SkPath::kWinding_FillType);
308 path.moveTo(0,1);
309 path.cubicTo(0,1, 2,1, 6,5);
310 path.close();
311 pathB.setFillType(SkPath::kWinding_FillType);
312 pathB.moveTo(1,2);
313 pathB.cubicTo(5,6, 1,0, 1,0);
314 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000315 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000316}
317
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000318static void cubicOp22d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000319 SkPath path, pathB;
320 path.setFillType(SkPath::kWinding_FillType);
321 path.moveTo(0,1);
322 path.cubicTo(2,3, 3,0, 2,1);
323 path.close();
324 pathB.setFillType(SkPath::kWinding_FillType);
325 pathB.moveTo(0,3);
326 pathB.cubicTo(1,2, 1,0, 3,2);
327 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000328 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000329}
330
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000331static void cubicOp23d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000332 SkPath path, pathB;
333 path.setFillType(SkPath::kWinding_FillType);
334 path.moveTo(0,1);
335 path.cubicTo(1,2, 4,0, 2,1);
336 path.close();
337 pathB.setFillType(SkPath::kWinding_FillType);
338 pathB.moveTo(0,4);
339 pathB.cubicTo(1,2, 1,0, 2,1);
340 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000341 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000342}
343
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000344static void cubicOp24d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000345 SkPath path, pathB;
346 path.setFillType(SkPath::kWinding_FillType);
347 path.moveTo(0,1);
348 path.cubicTo(1,2, 2,0, 3,2);
349 path.close();
350 pathB.setFillType(SkPath::kWinding_FillType);
351 pathB.moveTo(0,2);
352 pathB.cubicTo(2,3, 1,0, 2,1);
353 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000354 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000355}
356
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000357static void testIntersect1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000358 SkPath one, two;
359 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
360 two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000361 testPathOp(reporter, one, two, kIntersect_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000362}
363
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000364static void testUnion1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000365 SkPath one, two;
366 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
367 two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000368 testPathOp(reporter, one, two, kUnion_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000369}
370
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000371static void testDiff1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000372 SkPath one, two;
373 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
374 two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000375 testPathOp(reporter, one, two, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000376}
377
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000378static void testXor1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000379 SkPath one, two;
380 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
381 two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000382 testPathOp(reporter, one, two, kXOR_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000383}
384
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000385static void testIntersect2(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000386 SkPath one, two;
387 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
388 two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000389 testPathOp(reporter, one, two, kIntersect_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000390}
391
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000392static void testUnion2(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000393 SkPath one, two;
394 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
395 two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000396 testPathOp(reporter, one, two, kUnion_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000397}
398
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000399static void testDiff2(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000400 SkPath one, two;
401 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
402 two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000403 testPathOp(reporter, one, two, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000404}
405
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000406static void testXor2(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000407 SkPath one, two;
408 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
409 two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000410 testPathOp(reporter, one, two, kXOR_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000411}
412
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000413static void testOp1d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000414 SkPath path, pathB;
415 path.setFillType(SkPath::kWinding_FillType);
416 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
417 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
418 pathB.setFillType(SkPath::kWinding_FillType);
419 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
420 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000421 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000422}
423
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000424static void testOp2d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000425 SkPath path, pathB;
426 path.setFillType(SkPath::kWinding_FillType);
427 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
428 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
429 pathB.setFillType(SkPath::kEvenOdd_FillType);
430 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
431 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000432 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000433}
434
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000435static void testOp3d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000436 SkPath path, pathB;
437 path.setFillType(SkPath::kWinding_FillType);
438 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
439 path.addRect(1, 1, 2, 2, SkPath::kCW_Direction);
440 pathB.setFillType(SkPath::kWinding_FillType);
441 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
442 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000443 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000444}
445
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000446static void testOp1u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000447 SkPath path, pathB;
448 path.setFillType(SkPath::kWinding_FillType);
449 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
450 path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
451 pathB.setFillType(SkPath::kWinding_FillType);
452 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
453 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000454 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000455}
456
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000457static void testOp4d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000458 SkPath path, pathB;
459 path.setFillType(SkPath::kWinding_FillType);
460 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
461 path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
462 pathB.setFillType(SkPath::kWinding_FillType);
463 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
464 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000465 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000466}
467
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000468static void testOp5d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000469 SkPath path, pathB;
470 path.setFillType(SkPath::kEvenOdd_FillType);
471 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
472 path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
473 pathB.setFillType(SkPath::kEvenOdd_FillType);
474 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
475 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000476 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000477}
478
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000479static void testOp6d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000480 SkPath path, pathB;
481 path.setFillType(SkPath::kEvenOdd_FillType);
482 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
483 path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
484 pathB.setFillType(SkPath::kWinding_FillType);
485 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
486 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000487 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000488}
489
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000490static void testOp7d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000491 SkPath path, pathB;
492 path.setFillType(SkPath::kEvenOdd_FillType);
493 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
494 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
495 pathB.setFillType(SkPath::kEvenOdd_FillType);
496 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
497 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000498 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000499}
500
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000501static void testOp2u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000502 SkPath path, pathB;
503 path.setFillType(SkPath::kEvenOdd_FillType);
504 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
505 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
506 pathB.setFillType(SkPath::kWinding_FillType);
507 pathB.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
508 pathB.addRect(1, 1, 2, 2, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000509 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000510}
511
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000512static void testOp8d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000513 SkPath path, pathB;
514 path.addRect(0, 0, 640, 480);
515 pathB.moveTo(577330, 1971.72f);
516 pathB.cubicTo(10.7082f, -116.596f, 262.057f, 45.6468f, 294.694f, 1.96237f);
517 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000518 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000519}
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000520static void cubicOp25i(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000521 SkPath path, pathB;
522 path.setFillType(SkPath::kWinding_FillType);
523 path.moveTo(0,1);
524 path.cubicTo(2,4, 5,0, 3,2);
525 path.close();
526 pathB.setFillType(SkPath::kWinding_FillType);
527 pathB.moveTo(0,5);
528 pathB.cubicTo(2,3, 1,0, 4,2);
529 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000530 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000531}
532
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000533static void cubicOp26d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000534 SkPath path, pathB;
535 path.setFillType(SkPath::kWinding_FillType);
536 path.moveTo(0,1);
537 path.cubicTo(3,4, 4,0, 3,2);
538 path.close();
539 pathB.setFillType(SkPath::kWinding_FillType);
540 pathB.moveTo(0,4);
541 pathB.cubicTo(2,3, 1,0, 4,3);
542 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000543 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000544}
545
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000546static void cubicOp27d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000547 SkPath path, pathB;
548 path.setFillType(SkPath::kWinding_FillType);
549 path.moveTo(0,1);
550 path.cubicTo(3,6, 1,0, 5,2);
551 path.close();
552 pathB.setFillType(SkPath::kWinding_FillType);
553 pathB.moveTo(0,1);
554 pathB.cubicTo(2,5, 1,0, 6,3);
555 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000556 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000557}
558
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000559static void cubicOp28u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000560 SkPath path, pathB;
561 path.setFillType(SkPath::kWinding_FillType);
562 path.moveTo(0,1);
563 path.cubicTo(1,4, 6,0, 3,2);
564 path.close();
565 pathB.setFillType(SkPath::kWinding_FillType);
566 pathB.moveTo(0,6);
567 pathB.cubicTo(2,3, 1,0, 4,1);
568 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000569 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000570}
571
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000572static void cubicOp29d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000573 SkPath path, pathB;
574 path.setFillType(SkPath::kWinding_FillType);
575 path.moveTo(0,1);
576 path.cubicTo(2,5, 6,0, 4,2);
577 path.close();
578 pathB.setFillType(SkPath::kWinding_FillType);
579 pathB.moveTo(0,6);
580 pathB.cubicTo(2,4, 1,0, 5,2);
581 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000582 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000583}
584
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000585static void cubicOp30d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000586 SkPath path, pathB;
587 path.setFillType(SkPath::kWinding_FillType);
588 path.moveTo(0,1);
589 path.cubicTo(2,5, 6,0, 5,3);
590 path.close();
591 pathB.setFillType(SkPath::kWinding_FillType);
592 pathB.moveTo(0,6);
593 pathB.cubicTo(3,5, 1,0, 5,2);
594 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000595 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000596}
597
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000598static void cubicOp31d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000599 SkPath path, pathB;
600 path.setFillType(SkPath::kWinding_FillType);
601 path.moveTo(0,2);
602 path.cubicTo(0,3, 2,1, 4,0);
603 path.close();
604 pathB.setFillType(SkPath::kWinding_FillType);
605 pathB.moveTo(1,2);
606 pathB.cubicTo(0,4, 2,0, 3,0);
607 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000608 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000609}
610
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000611static void cubicOp31u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000612 SkPath path, pathB;
613 path.setFillType(SkPath::kWinding_FillType);
614 path.moveTo(0,2);
615 path.cubicTo(0,3, 2,1, 4,0);
616 path.close();
617 pathB.setFillType(SkPath::kWinding_FillType);
618 pathB.moveTo(1,2);
619 pathB.cubicTo(0,4, 2,0, 3,0);
620 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000621 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000622}
623
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000624static void cubicOp31x(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000625 SkPath path, pathB;
626 path.setFillType(SkPath::kWinding_FillType);
627 path.moveTo(0,2);
628 path.cubicTo(0,3, 2,1, 4,0);
629 path.close();
630 pathB.setFillType(SkPath::kWinding_FillType);
631 pathB.moveTo(1,2);
632 pathB.cubicTo(0,4, 2,0, 3,0);
633 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000634 testPathOp(reporter, path, pathB, kXOR_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000635}
636
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000637static void cubicOp32d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000638 SkPath path, pathB;
639 path.setFillType(SkPath::kWinding_FillType);
640 path.moveTo(0,1);
641 path.cubicTo(1,2, 6,0, 3,1);
642 path.close();
643 pathB.setFillType(SkPath::kWinding_FillType);
644 pathB.moveTo(0,6);
645 pathB.cubicTo(1,3, 1,0, 2,1);
646 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000647 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000648}
649
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000650static void cubicOp33i(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000651 SkPath path, pathB;
652 path.setFillType(SkPath::kWinding_FillType);
653 path.moveTo(0,1);
654 path.cubicTo(1,2, 6,0, 3,1);
655 path.close();
656 pathB.setFillType(SkPath::kWinding_FillType);
657 pathB.moveTo(0,6);
658 pathB.cubicTo(1,3, 1,0, 2,1);
659 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000660 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000661}
662
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000663static void cubicOp34d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000664 SkPath path, pathB;
665 path.setFillType(SkPath::kWinding_FillType);
666 path.moveTo(0,1);
667 path.cubicTo(3,5, 2,1, 3,1);
668 path.close();
669 pathB.setFillType(SkPath::kWinding_FillType);
670 pathB.moveTo(1,2);
671 pathB.cubicTo(1,3, 1,0, 5,3);
672 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000673 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000674}
675
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000676static void cubicOp35d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000677 SkPath path, pathB;
678 path.setFillType(SkPath::kWinding_FillType);
679 path.moveTo(0,1);
680 path.cubicTo(1,5, 2,1, 4,0);
681 path.close();
682 pathB.setFillType(SkPath::kWinding_FillType);
683 pathB.moveTo(1,2);
684 pathB.cubicTo(0,4, 1,0, 5,1);
685 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000686 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000687}
688
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000689static void cubicOp36u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000690 SkPath path, pathB;
691 path.setFillType(SkPath::kWinding_FillType);
692 path.moveTo(0,1);
693 path.cubicTo(1,6, 2,0, 5,1);
694 path.close();
695 pathB.setFillType(SkPath::kWinding_FillType);
696 pathB.moveTo(0,2);
697 pathB.cubicTo(1,5, 1,0, 6,1);
698 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000699 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000700}
701
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000702static void cubicOp37d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000703 SkPath path, pathB;
704 path.setFillType(SkPath::kWinding_FillType);
705 path.moveTo(0,1);
706 path.cubicTo(2,6, 6,1, 4,3);
707 path.close();
708 pathB.setFillType(SkPath::kWinding_FillType);
709 pathB.moveTo(1,6);
710 pathB.cubicTo(3,4, 1,0, 6,2);
711 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000712 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000713}
714
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000715// this fails to detect a cubic/cubic intersection
716// the slight overlap is missed when the cubics are approximated by quadratics
717// and the subsequent line/cubic intersection also (correctly) misses the intersection
718// if the line/cubic was a matching line/approx.quadratic then the missing intersection
719// could have been detected
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000720static void cubicOp38d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000721 SkPath path, pathB;
722 path.setFillType(SkPath::kWinding_FillType);
723 path.moveTo(0,1);
724 path.cubicTo(0,6, 3,2, 4,1);
725 path.close();
726 pathB.setFillType(SkPath::kWinding_FillType);
727 pathB.moveTo(2,3);
728 pathB.cubicTo(1,4, 1,0, 6,0);
729 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000730 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000731}
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000732
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000733static void cubicOp39d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000734 SkPath path, pathB;
735 path.setFillType(SkPath::kWinding_FillType);
736 path.moveTo(0,1);
737 path.cubicTo(2,3, 5,1, 4,3);
738 path.close();
739 pathB.setFillType(SkPath::kWinding_FillType);
740 pathB.moveTo(1,5);
741 pathB.cubicTo(3,4, 1,0, 3,2);
742 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000743 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000744}
745
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000746static void cubicOp40d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000747 SkPath path, pathB;
748 path.setFillType(SkPath::kWinding_FillType);
749 path.moveTo(0,1);
750 path.cubicTo(1,5, 3,2, 4,2);
751 path.close();
752 pathB.setFillType(SkPath::kWinding_FillType);
753 pathB.moveTo(2,3);
754 pathB.cubicTo(2,4, 1,0, 5,1);
755 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000756 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000757}
758
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000759static void cubicOp41i(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000760 SkPath path, pathB;
761 path.setFillType(SkPath::kWinding_FillType);
762 path.moveTo(0,1);
763 path.cubicTo(2,6, 4,3, 6,4);
764 path.close();
765 pathB.setFillType(SkPath::kWinding_FillType);
766 pathB.moveTo(3,4);
767 pathB.cubicTo(4,6, 1,0, 6,2);
768 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000769 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000770}
771
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000772static void cubicOp42d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000773 SkPath path, pathB;
774 path.setFillType(SkPath::kWinding_FillType);
775 path.moveTo(0,1);
776 path.cubicTo(1,2, 6,5, 5,4);
777 path.close();
778 pathB.setFillType(SkPath::kWinding_FillType);
779 pathB.moveTo(5,6);
780 pathB.cubicTo(4,5, 1,0, 2,1);
781 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000782 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000783}
784
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000785static void cubicOp43d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000786 SkPath path, pathB;
787 path.setFillType(SkPath::kWinding_FillType);
788 path.moveTo(0,2);
789 path.cubicTo(1,2, 4,0, 3,1);
790 path.close();
791 pathB.setFillType(SkPath::kWinding_FillType);
792 pathB.moveTo(0,4);
793 pathB.cubicTo(1,3, 2,0, 2,1);
794 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000795 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000796}
797
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000798static void cubicOp44d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000799 SkPath path, pathB;
800 path.setFillType(SkPath::kWinding_FillType);
801 path.moveTo(0,2);
802 path.cubicTo(3,6, 4,0, 3,2);
803 path.close();
804 pathB.setFillType(SkPath::kWinding_FillType);
805 pathB.moveTo(0,4);
806 pathB.cubicTo(2,3, 2,0, 6,3);
807 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000808 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000809}
810
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000811static void cubicOp45d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000812 SkPath path, pathB;
813 path.setFillType(SkPath::kWinding_FillType);
814 path.moveTo(0,2);
815 path.cubicTo(2,4, 4,0, 3,2);
816 path.close();
817 pathB.setFillType(SkPath::kWinding_FillType);
818 pathB.moveTo(0,4);
819 pathB.cubicTo(2,3, 2,0, 4,2);
820 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000821 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000822}
823
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000824static void cubicOp46d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000825 SkPath path, pathB;
826 path.setFillType(SkPath::kWinding_FillType);
827 path.moveTo(0,2);
828 path.cubicTo(3,5, 5,0, 4,2);
829 path.close();
830 pathB.setFillType(SkPath::kWinding_FillType);
831 pathB.moveTo(0,5);
832 pathB.cubicTo(2,4, 2,0, 5,3);
833 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000834 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000835}
836
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000837static void cubicOp47d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000838 SkPath path, pathB;
839 path.setFillType(SkPath::kWinding_FillType);
840 path.moveTo(0,1);
841 path.cubicTo(1,6, 6,2, 5,4);
842 path.close();
843 pathB.setFillType(SkPath::kWinding_FillType);
844 pathB.moveTo(2,6);
845 pathB.cubicTo(4,5, 1,0, 6,1);
846 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000847 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000848}
849
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000850static void cubicOp48d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000851 SkPath path, pathB;
852 path.setFillType(SkPath::kWinding_FillType);
853 path.moveTo(0,2);
854 path.cubicTo(2,3, 5,1, 3,2);
855 path.close();
856 pathB.setFillType(SkPath::kWinding_FillType);
857 pathB.moveTo(1,5);
858 pathB.cubicTo(2,3, 2,0, 3,2);
859 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000860 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000861}
862
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000863static void cubicOp49d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000864 SkPath path, pathB;
865 path.setFillType(SkPath::kWinding_FillType);
866 path.moveTo(0,2);
867 path.cubicTo(1,5, 3,2, 4,1);
868 path.close();
869 pathB.setFillType(SkPath::kWinding_FillType);
870 pathB.moveTo(2,3);
871 pathB.cubicTo(1,4, 2,0, 5,1);
872 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000873 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000874}
875
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000876static void cubicOp50d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000877 SkPath path, pathB;
878 path.setFillType(SkPath::kWinding_FillType);
879 path.moveTo(0,3);
880 path.cubicTo(1,6, 5,0, 5,1);
881 path.close();
882 pathB.setFillType(SkPath::kWinding_FillType);
883 pathB.moveTo(0,5);
884 pathB.cubicTo(1,5, 3,0, 6,1);
885 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000886 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000887}
888
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000889static void cubicOp51d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000890 SkPath path, pathB;
891 path.setFillType(SkPath::kWinding_FillType);
892 path.moveTo(0,3);
893 path.cubicTo(1,2, 4,1, 6,0);
894 path.close();
895 pathB.setFillType(SkPath::kWinding_FillType);
896 pathB.moveTo(1,4);
897 pathB.cubicTo(0,6, 3,0, 2,1);
898 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000899 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000900}
901
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000902static void cubicOp52d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000903 SkPath path, pathB;
904 path.setFillType(SkPath::kWinding_FillType);
905 path.moveTo(0,2);
906 path.cubicTo(1,2, 5,4, 4,3);
907 path.close();
908 pathB.setFillType(SkPath::kWinding_FillType);
909 pathB.moveTo(4,5);
910 pathB.cubicTo(3,4, 2,0, 2,1);
911 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000912 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000913}
914
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000915static void cubicOp53d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000916 SkPath path, pathB;
917 path.setFillType(SkPath::kWinding_FillType);
918 path.moveTo(0,3);
919 path.cubicTo(1,2, 5,3, 2,1);
920 path.close();
921 pathB.setFillType(SkPath::kWinding_FillType);
922 pathB.moveTo(3,5);
923 pathB.cubicTo(1,2, 3,0, 2,1);
924 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000925 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000926}
927
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000928static void cubicOp54d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000929 SkPath path, pathB;
930 path.setFillType(SkPath::kWinding_FillType);
931 path.moveTo(0,4);
932 path.cubicTo(1,3, 5,4, 4,2);
933 path.close();
934 pathB.setFillType(SkPath::kWinding_FillType);
935 pathB.moveTo(4,5);
936 pathB.cubicTo(2,4, 4,0, 3,1);
937 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000938 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000939}
940
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000941static void cubicOp55d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000942 SkPath path, pathB;
943 path.setFillType(SkPath::kWinding_FillType);
944 path.moveTo(0,5);
945 path.cubicTo(1,3, 3,2, 5,0);
946 path.close();
947 pathB.setFillType(SkPath::kWinding_FillType);
948 pathB.moveTo(2,3);
949 pathB.cubicTo(0,5, 5,0, 3,1);
950 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000951 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000952}
953
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000954static void cubicOp56d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000955 SkPath path, pathB;
956 path.setFillType(SkPath::kWinding_FillType);
957 path.moveTo(0,1);
958 path.cubicTo(2,6, 5,0, 2,1);
959 path.close();
960 pathB.setFillType(SkPath::kWinding_FillType);
961 pathB.moveTo(0,5);
962 pathB.cubicTo(1,2, 1,0, 6,2);
963 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000964 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000965}
966
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000967static void cubicOp57d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000968 SkPath path, pathB;
969 path.setFillType(SkPath::kWinding_FillType);
970 path.moveTo(0,5);
971 path.cubicTo(0,5, 5,4, 6,4);
972 path.close();
973 pathB.setFillType(SkPath::kWinding_FillType);
974 pathB.moveTo(4,5);
975 pathB.cubicTo(4,6, 5,0, 5,0);
976 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000977 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000978}
979
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000980static void cubicOp58d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000981 SkPath path, pathB;
982 path.setFillType(SkPath::kWinding_FillType);
983 path.moveTo(0,5);
984 path.cubicTo(3,4, 6,5, 5,3);
985 path.close();
986 pathB.setFillType(SkPath::kWinding_FillType);
987 pathB.moveTo(5,6);
988 pathB.cubicTo(3,5, 5,0, 4,3);
989 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000990 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000991}
992
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000993static void cubicOp59d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000994 SkPath path, pathB;
995 path.setFillType(SkPath::kWinding_FillType);
996 path.moveTo(0,1);
997 path.cubicTo(5,6, 4,0, 4,1);
998 path.close();
999 pathB.setFillType(SkPath::kWinding_FillType);
1000 pathB.moveTo(0,4);
1001 pathB.cubicTo(1,4, 1,0, 6,5);
1002 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001003 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001004}
1005
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001006static void cubicOp60d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001007 SkPath path, pathB;
1008 path.setFillType(SkPath::kWinding_FillType);
1009 path.moveTo(0,2);
1010 path.cubicTo(4,6, 6,0, 5,2);
1011 path.close();
1012 pathB.setFillType(SkPath::kWinding_FillType);
1013 pathB.moveTo(0,6);
1014 pathB.cubicTo(2,5, 2,0, 6,4);
1015 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001016 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001017}
1018
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001019static void cubicOp61d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001020 SkPath path, pathB;
1021 path.setFillType(SkPath::kWinding_FillType);
1022 path.moveTo(1,2);
1023 path.cubicTo(0,5, 3,2, 6,1);
1024 path.close();
1025 pathB.setFillType(SkPath::kWinding_FillType);
1026 pathB.moveTo(2,3);
1027 pathB.cubicTo(1,6, 2,1, 5,0);
1028 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001029 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001030}
1031
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001032static void cubicOp62d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001033 SkPath path, pathB;
1034 path.setFillType(SkPath::kWinding_FillType);
1035 path.moveTo(1,3);
1036 path.cubicTo(5,6, 5,3, 5,4);
1037 path.close();
1038 pathB.setFillType(SkPath::kWinding_FillType);
1039 pathB.moveTo(3,5);
1040 pathB.cubicTo(4,5, 3,1, 6,5);
1041 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001042 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001043}
1044
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001045static void cubicOp63d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001046 SkPath path, pathB;
1047 path.setFillType(SkPath::kWinding_FillType);
1048 path.moveTo(2,3);
1049 path.cubicTo(0,4, 3,2, 5,3);
1050 path.close();
1051 pathB.setFillType(SkPath::kWinding_FillType);
1052 pathB.moveTo(2,3);
1053 pathB.cubicTo(3,5, 3,2, 4,0);
1054 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001055 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001056}
1057
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001058static void cubicOp64d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001059 SkPath path, pathB;
1060 path.moveTo(0,1);
1061 path.cubicTo(0,1, 1,0, 3,0);
1062 path.lineTo(0,1);
1063 path.close();
1064 pathB.moveTo(0,1);
1065 pathB.cubicTo(0,3, 1,0, 1,0);
1066 pathB.lineTo(0,1);
1067 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001068 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001069}
1070
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001071static void cubicOp65d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001072 SkPath path, pathB;
1073 path.moveTo(0,1);
1074 path.cubicTo(1,5, 1,0, 1,0);
1075 path.lineTo(0,1);
1076 path.close();
1077 pathB.moveTo(0,1);
1078 pathB.cubicTo(0,1, 1,0, 5,1);
1079 pathB.lineTo(0,1);
1080 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001081 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001082}
1083
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001084static void rectOp1d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001085 SkPath path, pathB;
1086 path.moveTo(0,1);
1087 path.cubicTo(0,1, 1,0, 3,0);
1088 path.lineTo(0,1);
1089 path.close();
1090 pathB.moveTo(0,1);
1091 pathB.cubicTo(0,3, 1,0, 1,0);
1092 pathB.lineTo(0,1);
1093 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001094 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001095}
1096
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001097static void cubicOp66u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.comb3f09212013-04-17 15:49:16 +00001098 SkPath path, pathB;
1099 path.setFillType(SkPath::kWinding_FillType);
1100 path.moveTo(0,1);
1101 path.cubicTo(2,6, 4,2, 5,3);
1102 path.close();
1103 pathB.setFillType(SkPath::kWinding_FillType);
1104 pathB.moveTo(2,4);
1105 pathB.cubicTo(3,5, 1,0, 6,2);
1106 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001107 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.comb3f09212013-04-17 15:49:16 +00001108}
1109
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001110static void cubicOp67u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.comb3f09212013-04-17 15:49:16 +00001111 SkPath path, pathB;
1112 path.moveTo(3,5);
1113 path.cubicTo(1,6, 5,0, 3,1);
1114 path.lineTo(3,5);
1115 path.close();
1116 pathB.moveTo(0,5);
1117 pathB.cubicTo(1,3, 5,3, 6,1);
1118 pathB.lineTo(0,5);
1119 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001120 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.comb3f09212013-04-17 15:49:16 +00001121}
1122
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001123static void cubicOp68u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com03610322013-04-18 15:58:21 +00001124 SkPath path, pathB;
1125 path.moveTo(0,5);
1126 path.cubicTo(4,5, 4,1, 5,0);
1127 path.close();
1128 pathB.moveTo(1,4);
1129 pathB.cubicTo(0,5, 5,0, 5,4);
1130 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001131 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.com03610322013-04-18 15:58:21 +00001132}
1133
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001134static void cubicOp69d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com03610322013-04-18 15:58:21 +00001135 SkPath path, pathB;
1136 path.moveTo(1,3);
1137 path.cubicTo(0,1, 3,1, 2,0);
1138 path.close();
1139 pathB.moveTo(1,3);
1140 pathB.cubicTo(0,2, 3,1, 1,0);
1141 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001142 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com03610322013-04-18 15:58:21 +00001143}
1144
caryclark@google.com6dc7df62013-04-25 11:51:54 +00001145SkPathOp ops[] = {
1146 kUnion_PathOp,
1147 kXOR_PathOp,
1148 kReverseDifference_PathOp,
1149 kXOR_PathOp,
1150 kReverseDifference_PathOp,
1151};
1152
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001153static void rRect1(skiatest::Reporter* reporter, const char* filename) {
commit-bot@chromium.org4b413c82013-11-25 19:44:07 +00001154 SkScalar xA = 0.65f;
1155 SkScalar xB = 10.65f;
1156 SkScalar xC = 20.65f;
1157 SkScalar xD = 30.65f;
1158 SkScalar xE = 40.65f;
1159 SkScalar xF = 50.65f;
caryclark@google.com6dc7df62013-04-25 11:51:54 +00001160
commit-bot@chromium.org4b413c82013-11-25 19:44:07 +00001161 SkScalar yA = 0.65f;
1162 SkScalar yB = 10.65f;
1163 SkScalar yC = 20.65f;
1164 SkScalar yD = 30.65f;
1165 SkScalar yE = 40.65f;
1166 SkScalar yF = 50.65f;
caryclark@google.coma5e55922013-05-07 18:51:31 +00001167 SkPath paths[5];
1168 SkRect rects[5];
1169 rects[0].set(xB, yB, xE, yE);
1170 paths[0].addRoundRect(rects[0], SkIntToScalar(5), SkIntToScalar(5)); // red
1171 rects[1].set(xA, yA, xD, yD);
1172 paths[1].addRoundRect(rects[1], SkIntToScalar(5), SkIntToScalar(5)); // green
1173 rects[2].set(xC, yA, xF, yD);
1174 paths[2].addRoundRect(rects[2], SkIntToScalar(5), SkIntToScalar(5)); // blue
1175 rects[3].set(xA, yC, xD, yF);
1176 paths[3].addRoundRect(rects[3], SkIntToScalar(5), SkIntToScalar(5)); // yellow
1177 rects[4].set(xC, yC, xF, yF);
1178 paths[4].addRoundRect(rects[4], SkIntToScalar(5), SkIntToScalar(5)); // cyan
1179 SkPath path;
1180 path.setFillType(SkPath::kInverseEvenOdd_FillType);
1181 for (int index = 0; index < 5; ++index) {
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001182 testPathOp(reporter, path, paths[index], ops[index], filename);
caryclark@google.coma5e55922013-05-07 18:51:31 +00001183 Op(path, paths[index], ops[index], &path);
1184 }
1185}
1186
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001187static void skp1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.coma5e55922013-05-07 18:51:31 +00001188 SkPath path;
1189 path.setFillType(SkPath::kEvenOdd_FillType);
1190 path.moveTo(189,7);
1191 path.cubicTo(189,5.34314585f, 190.34314f,4, 192,4);
1192 path.lineTo(243,4);
1193 path.cubicTo(244.65686f,4, 246,5.34314585f, 246,7);
1194 path.lineTo(246,21);
1195 path.cubicTo(246,22.6568546f, 244.65686f,24, 243,24);
1196 path.lineTo(192,24);
1197 path.cubicTo(190.34314f,24, 189,22.6568546f, 189,21);
1198 path.lineTo(189,7);
1199 path.close();
1200 path.moveTo(191,8);
1201 path.cubicTo(191,6.89543009f, 191.895432f,6, 193,6);
1202 path.lineTo(242,6);
1203 path.cubicTo(243.104568f,6, 244,6.89543009f, 244,8);
1204 path.lineTo(244,20);
1205 path.cubicTo(244,21.1045704f, 243.104568f,22, 242,22);
1206 path.lineTo(193,22);
1207 path.cubicTo(191.895432f,22, 191,21.1045704f, 191,20);
1208 path.lineTo(191,8);
1209 path.close();
1210 SkPath pathB;
1211 pathB.setFillType(SkPath::kWinding_FillType);
1212 pathB.moveTo(189,4);
1213 pathB.lineTo(199,14);
1214 pathB.lineTo(236,14);
1215 pathB.lineTo(246,4);
1216 pathB.lineTo(189,4);
1217 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001218 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.coma5e55922013-05-07 18:51:31 +00001219}
1220
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001221static void skp2(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.coma5e55922013-05-07 18:51:31 +00001222 SkPath path;
1223 path.setFillType(SkPath::kEvenOdd_FillType);
1224 path.moveTo(253.000000f, 11757.0000f);
1225 path.lineTo(253.000000f, 222.000000f);
1226 path.lineTo(823.000000f, 222.000000f);
1227 path.lineTo(823.000000f, 11757.0000f);
1228 path.lineTo(253.000000f, 11757.0000f);
1229 path.close();
1230 SkPath pathB;
1231 pathB.setFillType(SkPath::kWinding_FillType);
1232 pathB.moveTo(258.000000f, 1028.00000f);
1233 pathB.lineTo(258.000000f, 1027.00000f);
1234 pathB.lineTo(823.000000f, 1027.00000f);
1235 pathB.lineTo(823.000000f, 1028.00000f);
1236 pathB.lineTo(258.000000f, 1028.00000f);
1237 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001238 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.coma5e55922013-05-07 18:51:31 +00001239}
1240
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001241static void skp3(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.coma5e55922013-05-07 18:51:31 +00001242 SkPath path;
1243 path.setFillType(SkPath::kEvenOdd_FillType);
1244 path.moveTo(717.000000f, 507.000000f);
1245 path.lineTo(717.000000f, 425.000000f);
1246 path.lineTo(973.000000f, 425.000000f);
1247 path.lineTo(973.000000f, 507.000000f);
1248 path.quadTo(973.000000f, 508.242645f, 972.121582f, 509.121613f);
1249 path.quadTo(971.242615f, 510.000000f, 970.000000f, 510.000000f);
1250 path.lineTo(720.000000f, 510.000000f);
1251 path.quadTo(718.757385f, 510.000000f, 717.878418f, 509.121613f);
1252 path.quadTo(717.000000f, 508.242645f, 717.000000f, 507.000000f);
1253 path.close();
1254 path.moveTo(719.000000f, 426.000000f);
1255 path.lineTo(971.000000f, 426.000000f);
1256 path.lineTo(971.000000f, 506.000000f);
1257 path.cubicTo(971.000000f, 507.104584f, 970.104553f, 508.000000f, 969.000000f, 508.000000f);
1258 path.lineTo(721.000000f, 508.000000f);
1259 path.cubicTo(719.895447f, 508.000000f, 719.000000f, 507.104584f, 719.000000f, 506.000000f);
1260 path.lineTo(719.000000f, 426.000000f);
1261 path.close();
1262 SkPath pathB;
1263 pathB.setFillType(SkPath::kWinding_FillType);
1264 pathB.moveTo(717.000000f, 510.000000f);
1265 pathB.lineTo(760.000000f, 467.000000f);
1266 pathB.lineTo(930.000000f, 467.000000f);
1267 pathB.lineTo(973.000000f, 510.000000f);
1268 pathB.lineTo(717.000000f, 510.000000f);
1269 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001270 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.coma5e55922013-05-07 18:51:31 +00001271}
1272
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001273static void skp4(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.coma5e55922013-05-07 18:51:31 +00001274 SkPath path;
1275 path.setFillType(SkPath::kEvenOdd_FillType);
1276 path.moveTo(230.756805f, 591.756775f);
1277 path.quadTo(232.514725f, 590.000000f, 235.000000f, 590.000000f);
1278 path.lineTo(300.000000f, 590.000000f);
1279 path.quadTo(302.485291f, 590.000000f, 304.243195f, 591.756775f);
1280 path.quadTo(306.000000f, 593.514709f, 306.000000f, 596.000000f);
1281 path.lineTo(306.000000f, 617.000000f);
1282 path.lineTo(229.000000f, 617.000000f);
1283 path.lineTo(229.000000f, 596.000000f);
1284 path.quadTo(229.000000f, 593.514709f, 230.756805f, 591.756775f);
1285 path.close();
1286 path.moveTo(231.000000f, 597.000000f);
1287 path.cubicTo(231.000000f, 594.238586f, 233.238571f, 592.000000f, 236.000000f, 592.000000f);
1288 path.lineTo(299.000000f, 592.000000f);
1289 path.cubicTo(301.761414f, 592.000000f, 304.000000f, 594.238586f, 304.000000f, 597.000000f);
1290 path.lineTo(304.000000f, 616.000000f);
1291 path.lineTo(231.000000f, 616.000000f);
1292 path.lineTo(231.000000f, 597.000000f);
1293 path.close();
1294 SkPath pathB;
1295 pathB.setFillType(SkPath::kWinding_FillType);
1296 pathB.moveTo(306.000000f, 590.000000f);
1297 pathB.lineTo(292.000000f, 604.000000f);
1298 pathB.lineTo(305.000000f, 617.000000f);
1299 pathB.lineTo(306.000000f, 617.000000f);
1300 pathB.lineTo(306.000000f, 590.000000f);
1301 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001302 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.coma5e55922013-05-07 18:51:31 +00001303}
1304
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001305static void skp5(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.coma5e55922013-05-07 18:51:31 +00001306 SkPath path;
1307 path.setFillType(SkPath::kEvenOdd_FillType);
1308 path.moveTo(18.0000000f, 226.000000f);
1309 path.quadTo(14.6862917f, 226.000000f, 12.3423996f, 228.342407f);
1310 path.quadTo(10.0000000f, 230.686295f, 10.0000000f, 234.000000f);
1311 path.lineTo(10.0000000f, 253.000000f);
1312 path.lineTo(1247.00000f, 253.000000f);
1313 path.lineTo(1247.00000f, 234.000000f);
1314 path.quadTo(1247.00000f, 230.686295f, 1244.65759f, 228.342407f);
1315 path.quadTo(1242.31372f, 226.000000f, 1239.00000f, 226.000000f);
1316 path.lineTo(18.0000000f, 226.000000f);
1317 path.close();
1318 SkPath pathB;
1319 pathB.setFillType(SkPath::kInverseWinding_FillType);
1320 pathB.moveTo(18.0000000f, 226.000000f);
1321 pathB.lineTo(1239.00000f, 226.000000f);
1322 pathB.cubicTo(1243.41833f, 226.000000f, 1247.00000f, 229.581726f, 1247.00000f, 234.000000f);
1323 pathB.lineTo(1247.00000f, 252.000000f);
1324 pathB.lineTo(10.0000000f, 252.000000f);
1325 pathB.lineTo(10.0000000f, 234.000000f);
1326 pathB.cubicTo(10.0000000f, 229.581726f, 13.5817204f, 226.000000f, 18.0000000f, 226.000000f);
1327 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001328 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.coma5e55922013-05-07 18:51:31 +00001329}
1330
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001331static void cubicOp70d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.coma5e55922013-05-07 18:51:31 +00001332 SkPath path, pathB;
1333 path.setFillType(SkPath::kWinding_FillType);
1334 path.moveTo(0,1);
1335 path.cubicTo(0,5, 4,0, 5,0);
1336 path.close();
1337 pathB.setFillType(SkPath::kWinding_FillType);
1338 pathB.moveTo(0,4);
1339 pathB.cubicTo(0,5, 1,0, 5,0);
1340 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001341 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com6dc7df62013-04-25 11:51:54 +00001342}
1343
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001344static void cubicOp71d(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001345 SkPath path, pathB;
1346 path.setFillType(SkPath::kWinding_FillType);
1347 path.moveTo(0,1);
1348 path.cubicTo(0,5, 4,1, 6,4);
1349 path.close();
1350 pathB.setFillType(SkPath::kWinding_FillType);
1351 pathB.moveTo(1,4);
1352 pathB.cubicTo(4,6, 1,0, 5,0);
1353 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001354 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001355}
1356
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001357static void cubicOp72i(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001358 SkPath path, pathB;
1359 path.setFillType(SkPath::kWinding_FillType);
1360 path.moveTo(0,1);
1361 path.cubicTo(0,5, 5,2, 5,4);
1362 path.close();
1363 pathB.setFillType(SkPath::kWinding_FillType);
1364 pathB.moveTo(2,5);
1365 pathB.cubicTo(4,5, 1,0, 5,0);
1366 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001367 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001368}
1369
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001370static void cubicOp73d(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001371 SkPath path, pathB;
1372 path.setFillType(SkPath::kWinding_FillType);
1373 path.moveTo(0,1);
1374 path.cubicTo(3,4, 4,0, 6,4);
1375 path.lineTo(0,1);
1376 path.close();
1377 pathB.setFillType(SkPath::kWinding_FillType);
1378 pathB.moveTo(0,4);
1379 pathB.cubicTo(4,6, 1,0, 4,3);
1380 pathB.lineTo(0,4);
1381 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001382 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001383}
1384
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001385static void cubicOp74d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001386 SkPath path, pathB;
1387 path.setFillType(SkPath::kWinding_FillType);
1388 path.moveTo(0,1);
1389 path.cubicTo(1,5, 5,1, 5,1);
1390 path.lineTo(0,1);
1391 path.close();
1392 pathB.setFillType(SkPath::kWinding_FillType);
1393 pathB.moveTo(1,5);
1394 pathB.cubicTo(1,5, 1,0, 5,1);
1395 pathB.lineTo(1,5);
1396 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001397 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001398}
1399
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001400static void cubicOp75d(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001401 SkPath path, pathB;
1402 path.setFillType(SkPath::kWinding_FillType);
1403 path.moveTo(0,1);
1404 path.cubicTo(0,4, 5,1, 6,4);
1405 path.lineTo(0,1);
1406 path.close();
1407 pathB.setFillType(SkPath::kWinding_FillType);
1408 pathB.moveTo(1,5);
1409 pathB.cubicTo(4,6, 1,0, 4,0);
1410 pathB.lineTo(1,5);
1411 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001412 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001413}
1414
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001415static void cubicOp76u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001416 SkPath path, pathB;
1417 path.setFillType(SkPath::kWinding_FillType);
1418 path.moveTo(0,1);
1419 path.cubicTo(0,2, 2,0, 5,3);
1420 path.close();
1421 pathB.setFillType(SkPath::kWinding_FillType);
1422 pathB.moveTo(0,2);
1423 pathB.cubicTo(3,5, 1,0, 2,0);
1424 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001425 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001426}
1427
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001428static void cubicOp77i(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001429 SkPath path, pathB;
1430 path.setFillType(SkPath::kEvenOdd_FillType);
1431 path.moveTo(0,1);
1432 path.cubicTo(1,3, 2,0, 3,2);
1433 path.lineTo(0,1);
1434 path.close();
1435 pathB.setFillType(SkPath::kEvenOdd_FillType);
1436 pathB.moveTo(0,2);
1437 pathB.cubicTo(2,3, 1,0, 3,1);
1438 pathB.lineTo(0,2);
1439 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001440 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001441}
1442
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001443static void cubicOp78u(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001444 SkPath path, pathB;
1445 path.setFillType(SkPath::kEvenOdd_FillType);
1446 path.moveTo(1,6);
1447 path.cubicTo(1,6, 5,0, 6,1);
1448 path.lineTo(1,6);
1449 path.close();
1450 pathB.setFillType(SkPath::kEvenOdd_FillType);
1451 pathB.moveTo(0,5);
1452 pathB.cubicTo(1,6, 6,1, 6,1);
1453 pathB.lineTo(0,5);
1454 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001455 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001456}
1457
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001458static void cubicOp79u(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001459 SkPath path, pathB;
1460 path.setFillType(SkPath::kWinding_FillType);
1461 path.moveTo(0,1);
1462 path.cubicTo(1,3, 1,0, 6,4);
1463 path.close();
1464 pathB.setFillType(SkPath::kWinding_FillType);
1465 pathB.moveTo(0,1);
1466 pathB.cubicTo(4,6, 1,0, 3,1);
1467 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001468 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001469}
1470
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001471static void cubicOp80i(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001472 SkPath path, pathB;
1473 path.setFillType(SkPath::kWinding_FillType);
1474 path.moveTo(0,1);
1475 path.cubicTo(2,3, 2,1, 4,3);
1476 path.lineTo(0,1);
1477 path.close();
1478 pathB.setFillType(SkPath::kWinding_FillType);
1479 pathB.moveTo(1,2);
1480 pathB.cubicTo(3,4, 1,0, 3,2);
1481 pathB.lineTo(1,2);
1482 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001483 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001484}
1485
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001486static void cubicOp81d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001487 SkPath path, pathB;
1488 path.setFillType(SkPath::kWinding_FillType);
1489 path.moveTo(0,1);
1490 path.cubicTo(4,6, 4,3, 5,4);
1491 path.close();
1492 pathB.setFillType(SkPath::kWinding_FillType);
1493 pathB.moveTo(3,4);
1494 pathB.cubicTo(4,5, 1,0, 6,4);
1495 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001496 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001497}
1498
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001499static void cubicOp82i(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001500 SkPath path, pathB;
1501 path.setFillType(SkPath::kEvenOdd_FillType);
1502 path.moveTo(0,1);
1503 path.cubicTo(2,3, 5,2, 3,0);
1504 path.lineTo(0,1);
1505 path.close();
1506 pathB.setFillType(SkPath::kWinding_FillType);
1507 pathB.moveTo(2,5);
1508 pathB.cubicTo(0,3, 1,0, 3,2);
1509 pathB.lineTo(2,5);
1510 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001511 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001512}
1513
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001514static void cubicOp83i(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001515 SkPath path, pathB;
1516 path.setFillType(SkPath::kWinding_FillType);
1517 path.moveTo(0,1);
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001518 path.cubicTo(0,3, 2,1, 4,1);
1519 path.lineTo(0,1);
reed@google.com277c3f82013-05-31 15:17:50 +00001520 path.close();
1521 pathB.setFillType(SkPath::kWinding_FillType);
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001522 pathB.moveTo(1,2);
1523 pathB.cubicTo(1,4, 1,0, 3,0);
1524 pathB.lineTo(1,2);
1525 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001526 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001527}
1528
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001529static void cubicOp84d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001530 SkPath path, pathB;
1531 path.setFillType(SkPath::kWinding_FillType);
1532 path.moveTo(0,4);
1533 path.cubicTo(2,3, 6,3, 3,2);
1534 path.close();
1535 pathB.setFillType(SkPath::kWinding_FillType);
1536 pathB.moveTo(3,6);
1537 pathB.cubicTo(2,3, 4,0, 3,2);
reed@google.com277c3f82013-05-31 15:17:50 +00001538 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001539 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001540}
1541
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001542static void skpClip1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001543 SkPath path;
1544 path.setFillType(SkPath::kEvenOdd_FillType);
1545 path.moveTo(1126.17114f, 877.171204f);
1546 path.quadTo(1127.34314f, 876.000000f, 1129.00000f, 876.000000f);
1547 path.lineTo(1243.00000f, 876.000000f);
1548 path.quadTo(1244.65686f, 876.000000f, 1245.82886f, 877.171204f);
1549 path.quadTo(1247.00000f, 878.343140f, 1247.00000f, 880.000000f);
1550 path.lineTo(1247.00000f, 907.000000f);
1551 path.lineTo(1246.00000f, 907.000000f);
1552 path.lineTo(1246.00000f, 880.000000f);
1553 path.cubicTo(1246.00000f, 878.343140f, 1244.65686f, 877.000000f, 1243.00000f, 877.000000f);
1554 path.lineTo(1129.00000f, 877.000000f);
1555 path.cubicTo(1127.34314f, 877.000000f, 1126.00000f, 878.343140f, 1126.00000f, 880.000000f);
1556 path.lineTo(1126.00000f, 907.000000f);
1557 path.lineTo(1125.00000f, 907.000000f);
1558 path.lineTo(1125.00000f, 880.000000f);
1559 path.quadTo(1125.00000f, 878.343140f, 1126.17114f, 877.171204f);
1560 path.close();
1561 SkPath pathB;
1562 pathB.setFillType(SkPath::kWinding_FillType);
1563 pathB.moveTo(1247.00000f, 876.000000f);
1564 pathB.lineTo(1231.00000f, 892.000000f);
1565 pathB.lineTo(1246.00000f, 907.000000f);
1566 pathB.lineTo(1247.00000f, 907.000000f);
1567 pathB.lineTo(1247.00000f, 876.000000f);
1568 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001569 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001570}
1571
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001572static void skpClip2(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001573 SkPath path;
1574 path.setFillType(SkPath::kEvenOdd_FillType);
1575 path.moveTo(134.000000f, 11414.0000f);
1576 path.cubicTo(131.990234f, 11414.0000f, 130.326660f, 11415.4824f, 130.042755f, 11417.4131f);
1577 path.cubicTo(130.233124f, 11418.3193f, 131.037079f, 11419.0000f, 132.000000f, 11419.0000f);
1578 path.lineTo(806.000000f, 11419.0000f);
1579 path.cubicTo(806.962891f, 11419.0000f, 807.766907f, 11418.3193f, 807.957275f, 11417.4131f);
1580 path.cubicTo(807.673401f, 11415.4824f, 806.009766f, 11414.0000f, 804.000000f, 11414.0000f);
1581 path.lineTo(134.000000f, 11414.0000f);
1582 path.close();
1583 SkPath pathB;
1584 pathB.setFillType(SkPath::kInverseWinding_FillType);
1585 pathB.moveTo(132.000000f, 11415.0000f);
1586 pathB.lineTo(806.000000f, 11415.0000f);
1587 pathB.cubicTo(807.104553f, 11415.0000f, 808.000000f, 11415.4473f, 808.000000f, 11416.0000f);
1588 pathB.lineTo(808.000000f, 11417.0000f);
1589 pathB.cubicTo(808.000000f, 11418.1045f, 807.104553f, 11419.0000f, 806.000000f, 11419.0000f);
1590 pathB.lineTo(132.000000f, 11419.0000f);
1591 pathB.cubicTo(130.895432f, 11419.0000f, 130.000000f, 11418.1045f, 130.000000f, 11417.0000f);
1592 pathB.lineTo(130.000000f, 11416.0000f);
1593 pathB.cubicTo(130.000000f, 11415.4473f, 130.895432f, 11415.0000f, 132.000000f, 11415.0000f);
1594 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001595 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001596}
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001597
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001598static void skp96prezzi1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001599 SkPath path;
1600 path.setFillType(SkPath::kEvenOdd_FillType);
1601 path.moveTo(157.464005f, 670.463989f);
1602 path.quadTo(158.928925f, 669.000000f, 161.000000f, 669.000000f);
1603 path.lineTo(248.000000f, 669.000000f);
1604 path.quadTo(250.071075f, 669.000000f, 251.535995f, 670.463989f);
1605 path.quadTo(253.000000f, 671.928955f, 253.000000f, 674.000000f);
1606 path.lineTo(253.000000f, 706.000000f);
1607 path.lineTo(251.000000f, 706.000000f);
1608 path.lineTo(251.000000f, 675.000000f);
1609 path.cubicTo(251.000000f, 672.790833f, 249.209137f, 671.000000f, 247.000000f, 671.000000f);
1610 path.lineTo(162.000000f, 671.000000f);
1611 path.cubicTo(159.790863f, 671.000000f, 158.000000f, 672.790833f, 158.000000f, 675.000000f);
1612 path.lineTo(158.000000f, 706.000000f);
1613 path.lineTo(156.000000f, 706.000000f);
1614 path.lineTo(156.000000f, 674.000000f);
1615 path.quadTo(156.000000f, 671.928955f, 157.464005f, 670.463989f);
1616 path.close();
1617 SkPath pathB;
1618 pathB.setFillType(SkPath::kWinding_FillType);
1619 pathB.moveTo(156.000000f, 669.000000f);
1620 pathB.lineTo(178.500000f, 691.500000f);
1621 pathB.lineTo(230.500000f, 691.500000f);
1622 pathB.lineTo(253.000000f, 669.000000f);
1623 pathB.lineTo(156.000000f, 669.000000f);
1624 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001625 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001626}
1627
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001628static void skpancestry_com1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001629 SkPath path;
1630 path.setFillType(SkPath::kEvenOdd_FillType);
1631 path.moveTo(161.000000f, 925.000000f);
1632 path.cubicTo(159.874390f, 925.000000f, 158.835663f, 925.371948f, 158.000000f, 925.999634f);
1633 path.lineTo(158.000000f, 926.000000f);
1634 path.lineTo(1108.00000f, 926.000000f);
1635 path.lineTo(1108.00000f, 925.999634f);
1636 path.cubicTo(1107.16443f, 925.371948f, 1106.12561f, 925.000000f, 1105.00000f, 925.000000f);
1637 path.lineTo(161.000000f, 925.000000f);
1638 path.close();
1639 SkPath pathB;
1640 pathB.setFillType(SkPath::kEvenOdd_FillType);
1641 pathB.moveTo(161.000000f, 926.000000f);
1642 pathB.lineTo(1105.00000f, 926.000000f);
1643 pathB.cubicTo(1107.20911f, 926.000000f, 1109.00000f, 927.790833f, 1109.00000f, 930.000000f);
1644 pathB.lineTo(1109.00000f, 956.000000f);
1645 pathB.cubicTo(1109.00000f, 958.209167f, 1107.20911f, 960.000000f, 1105.00000f, 960.000000f);
1646 pathB.lineTo(161.000000f, 960.000000f);
1647 pathB.cubicTo(158.790863f, 960.000000f, 157.000000f, 958.209167f, 157.000000f, 956.000000f);
1648 pathB.lineTo(157.000000f, 930.000000f);
1649 pathB.cubicTo(157.000000f, 927.790833f, 158.790863f, 926.000000f, 161.000000f, 926.000000f);
1650 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001651 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001652}
1653
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001654static void skpeldorado_com_ua1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001655 SkPath path;
1656 path.setFillType(SkPath::kEvenOdd_FillType);
1657 path.moveTo(286.695129f, 291.000000f);
1658 path.lineTo(229.304855f, 561.000000f);
1659 path.lineTo(979.304871f, 561.000000f);
1660 path.lineTo(1036.69507f, 291.000000f);
1661 path.lineTo(286.695129f, 291.000000f);
1662 path.close();
1663 SkPath pathB;
1664 pathB.setFillType(SkPath::kWinding_FillType);
1665 pathB.moveTo(1006.69513f, 291.000000f);
1666 pathB.cubicTo(1023.26367f, 291.000000f, 1033.84021f, 304.431458f, 1030.31836f, 321.000000f);
1667 pathB.lineTo(985.681519f, 531.000000f);
1668 pathB.cubicTo(982.159790f, 547.568542f, 965.873413f, 561.000000f, 949.304871f, 561.000000f);
1669 pathB.lineTo(259.304871f, 561.000000f);
1670 pathB.cubicTo(242.736313f, 561.000000f, 232.159805f, 547.568542f, 235.681549f, 531.000000f);
1671 pathB.lineTo(280.318420f, 321.000000f);
1672 pathB.cubicTo(283.840179f, 304.431458f, 300.126587f, 291.000000f, 316.695129f, 291.000000f);
1673 pathB.lineTo(1006.69513f, 291.000000f);
1674 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001675 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001676}
1677
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001678static void skpbyte_com1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001679 SkPath path;
1680 path.setFillType(SkPath::kEvenOdd_FillType);
1681 path.moveTo(968.000000f, 14.0000000f);
1682 path.cubicTo(965.238586f, 14.0000000f, 963.000000f, 16.2385769f, 963.000000f, 19.0000000f);
1683 path.lineTo(963.000000f, 32.0000000f);
1684 path.cubicTo(963.000000f, 34.7614250f, 965.238586f, 37.0000000f, 968.000000f, 37.0000000f);
1685 path.lineTo(1034.00000f, 37.0000000f);
1686 path.cubicTo(1036.76147f, 37.0000000f, 1039.00000f, 34.7614250f, 1039.00000f, 32.0000000f);
1687 path.lineTo(1039.00000f, 19.0000000f);
1688 path.cubicTo(1039.00000f, 16.2385769f, 1036.76147f, 14.0000000f, 1034.00000f, 14.0000000f);
1689 path.lineTo(968.000000f, 14.0000000f);
1690 path.close();
1691 SkPath pathB;
1692 pathB.setFillType(SkPath::kInverseWinding_FillType);
1693 pathB.moveTo(968.000000f, 14.0000000f);
1694 pathB.lineTo(1034.00000f, 14.0000000f);
1695 pathB.cubicTo(1036.76147f, 14.0000000f, 1039.00000f, 16.2385750f, 1039.00000f, 19.0000000f);
1696 pathB.lineTo(1039.00000f, 32.0000000f);
1697 pathB.cubicTo(1039.00000f, 34.2091408f, 1036.76147f, 36.0000000f, 1034.00000f, 36.0000000f);
1698 pathB.lineTo(968.000000f, 36.0000000f);
1699 pathB.cubicTo(965.238586f, 36.0000000f, 963.000000f, 34.2091408f, 963.000000f, 32.0000000f);
1700 pathB.lineTo(963.000000f, 19.0000000f);
1701 pathB.cubicTo(963.000000f, 16.2385750f, 965.238586f, 14.0000000f, 968.000000f, 14.0000000f);
1702 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001703 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001704}
1705
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001706static void skphealth_com76(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001707 SkPath path;
1708 path.setFillType(SkPath::kEvenOdd_FillType);
1709 path.moveTo(708.099182f, 7.09919119f);
1710 path.lineTo(708.099182f, 7.09920025f);
1711 path.quadTo(704.000000f, 11.2010098f, 704.000000f, 17.0000000f);
1712 path.lineTo(704.000000f, 33.0000000f);
1713 path.lineTo(705.000000f, 33.0000000f);
1714 path.lineTo(705.000000f, 17.0000000f);
1715 path.cubicTo(705.000000f, 13.4101496f, 706.455078f, 10.1601505f, 708.807617f, 7.80761385f);
1716 path.lineTo(708.099182f, 7.09919119f);
1717 path.close();
1718 SkPath pathB;
1719 pathB.setFillType(SkPath::kWinding_FillType);
1720 pathB.moveTo(704.000000f, 3.00000000f);
1721#if 0
1722 pathB.lineTo(719.500000f, 3.00000000f);
1723 pathB.lineTo(705.000000f, 33.0000000f);
1724 pathB.lineTo(704.000000f, 33.0000000f);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001725 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001726#else
1727 pathB.lineTo(704.000000f, 33.0000000f);
1728 pathB.lineTo(705.000000f, 33.0000000f);
1729 pathB.lineTo(719.500000f, 3.00000000f);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001730 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001731#endif
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001732}
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001733
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001734static void skpahrefs_com88(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001735 SkPath path;
1736 path.setFillType(SkPath::kEvenOdd_FillType);
1737 path.moveTo(1099.82886f, 7.17117119f);
1738 path.lineTo(1099.12134f, 7.87867832f);
1739 path.cubicTo(1099.66418f, 8.42157173f, 1100.00000f, 9.17157173f, 1100.00000f, 10.0000000f);
1740 path.lineTo(1100.00000f, 28.0000000f);
1741 path.cubicTo(1100.00000f, 29.6568546f, 1098.65686f, 31.0000000f, 1097.00000f, 31.0000000f);
1742 path.lineTo(1088.00000f, 31.0000000f);
1743 path.lineTo(1088.00000f, 32.0000000f);
1744 path.lineTo(1097.00000f, 32.0000000f);
1745 path.quadTo(1098.65686f, 32.0000000f, 1099.82886f, 30.8288002f);
1746 path.quadTo(1101.00000f, 29.6568546f, 1101.00000f, 28.0000000f);
1747 path.lineTo(1101.00000f, 10.0000000f);
1748 path.quadTo(1101.00000f, 8.34314537f, 1099.82886f, 7.17119980f);
1749 path.lineTo(1099.82886f, 7.17117119f);
1750 path.close();
1751 SkPath pathB;
1752 pathB.setFillType(SkPath::kWinding_FillType);
1753 pathB.moveTo(1101.00000f, 6.00000000f);
1754 pathB.lineTo(1088.00000f, 6.00000000f);
1755 pathB.lineTo(1088.00000f, 19.0000000f);
1756 pathB.lineTo(1101.00000f, 32.0000000f);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001757 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001758}
caryclark@google.comfa2aeee2013-07-15 13:29:13 +00001759
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001760static void skpahrefs_com29(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001761 SkPath path;
1762 path.setFillType(SkPath::kEvenOdd_FillType);
1763 path.moveTo(1037.17114f, 7.17119980f);
1764 path.quadTo(1038.34314f, 6.00000000f, 1040.00000f, 6.00000000f);
1765 path.lineTo(1074.00000f, 6.00000000f);
1766 path.lineTo(1074.00000f, 32.0000000f);
1767 path.lineTo(1040.00000f, 32.0000000f);
1768 path.quadTo(1038.34314f, 32.0000000f, 1037.17114f, 30.8288002f);
1769 path.quadTo(1036.00000f, 29.6568546f, 1036.00000f, 28.0000000f);
1770 path.lineTo(1036.00000f, 10.0000000f);
1771 path.quadTo(1036.00000f, 8.34314537f, 1037.17114f, 7.17119980f);
1772 path.close();
1773 path.moveTo(1037.00000f, 10.0000000f);
1774 path.cubicTo(1037.00000f, 8.34314537f, 1038.34314f, 7.00000000f, 1040.00000f, 7.00000000f);
1775 path.lineTo(1073.00000f, 7.00000000f);
1776 path.lineTo(1073.00000f, 31.0000000f);
1777 path.lineTo(1040.00000f, 31.0000000f);
1778 path.cubicTo(1038.34314f, 31.0000000f, 1037.00000f, 29.6568546f, 1037.00000f, 28.0000000f);
1779 path.lineTo(1037.00000f, 10.0000000f);
1780 path.close();
1781 SkPath pathB;
1782 pathB.setFillType(SkPath::kWinding_FillType);
1783 pathB.moveTo(1036.00000f, 32.0000000f);
1784 pathB.lineTo(1049.00000f, 19.0000000f);
1785 pathB.lineTo(1073.00000f, 31.0000000f);
1786 pathB.lineTo(1074.00000f, 32.0000000f);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001787 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001788}
caryclark@google.comfa2aeee2013-07-15 13:29:13 +00001789
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001790static void cubicOp85d(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001791 SkPath path;
1792 path.setFillType(SkPath::kWinding_FillType);
1793 path.moveTo(0,1);
1794 path.cubicTo(1,6, 1,0, 6,2);
1795 path.close();
1796 SkPath pathB;
1797 pathB.setFillType(SkPath::kWinding_FillType);
1798 pathB.moveTo(0,1);
1799 pathB.cubicTo(2,6, 1,0, 6,1);
1800 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001801 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.comfa2aeee2013-07-15 13:29:13 +00001802}
1803
caryclark@google.comfa2aeee2013-07-15 13:29:13 +00001804// this fails because the pair of nearly coincident cubics intersect at the ends
1805// but the line connected to one of the cubics at the same point does not intersect
1806// the other
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001807static void skpkkiste_to98(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001808 SkPath path;
1809 path.setFillType(SkPath::kEvenOdd_FillType);
1810 path.moveTo(96, 122);
1811 path.cubicTo(94.6192932f, 122, 93.3692932f, 122.559647f, 92.4644699f, 123.46447f);
1812 path.lineTo(94.1715698f, 125.17157f);
1813 path.cubicTo(94.8954315f, 124.447708f, 95.8954315f, 124, 97, 124);
1814 path.lineTo(257, 124);
1815 path.cubicTo(258.104553f, 124, 259.104584f, 124.447708f, 259.82843f, 125.17157f);
1816 path.lineTo(261.535522f, 123.46447f);
1817 path.cubicTo(260.630707f, 122.559647f, 259.380707f, 122, 258, 122);
1818 path.lineTo(96, 122);
1819 path.close();
1820 SkPath pathB;
1821 pathB.setFillType(SkPath::kWinding_FillType);
1822 pathB.moveTo(258, 122);
1823 pathB.cubicTo(260.761414f, 122, 263, 124.238579f, 263, 127);
1824 pathB.lineTo(263, 284);
1825 pathB.cubicTo(263, 286.761414f, 260.761414f, 289, 258, 289);
1826 pathB.lineTo(96, 289);
1827 pathB.cubicTo(93.2385788f, 289, 91, 286.761414f, 91, 284);
1828 pathB.lineTo(91, 127);
1829 pathB.cubicTo(91, 124.238579f, 93.2385788f, 122, 96, 122);
1830 pathB.lineTo(258, 122);
1831 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001832 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001833}
caryclark@google.comfa2aeee2013-07-15 13:29:13 +00001834
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001835#define ISSUE_1417_WORKING_ON_LINUX_32 0 // fails only in release linux skia_arch_width=32
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00001836#if ISSUE_1417_WORKING_ON_LINUX_32
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001837static void issue1417(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.com7f1af502013-07-24 07:01:12 +00001838 SkPath path1;
1839 path1.moveTo(122.58908843994140625f, 82.2836456298828125f);
1840 path1.quadTo(129.8215789794921875f, 80, 138, 80);
1841 path1.quadTo(147.15692138671875f, 80, 155.1280364990234375f, 82.86279296875f);
1842 path1.lineTo(161.1764678955078125f, 100);
1843 path1.lineTo(161.1764678955078125f, 100);
1844 path1.lineTo(115.29412078857421875f, 100);
1845 path1.lineTo(115.29412078857421875f, 100);
1846 path1.lineTo(122.58908843994140625f, 82.2836456298828125f);
1847 path1.lineTo(122.58908843994140625f, 82.2836456298828125f);
1848 path1.close();
1849 path1.moveTo(98.68194580078125f, 140.343841552734375f);
1850 path1.lineTo(115.29412078857421875f, 100);
1851 path1.lineTo(115.29412078857421875f, 100);
1852 path1.lineTo(97.9337615966796875f, 100);
1853 path1.lineTo(97.9337615966796875f, 100);
1854 path1.quadTo(88, 112.94264984130859375f, 88, 130);
1855 path1.quadTo(88, 131.544830322265625f, 88.08148956298828125f, 133.0560302734375f);
1856 path1.lineTo(98.68194580078125f, 140.343841552734375f);
1857 path1.lineTo(98.68194580078125f, 140.343841552734375f);
1858 path1.close();
1859 path1.moveTo(136.969696044921875f, 166.6666717529296875f);
1860 path1.lineTo(98.68194580078125f, 140.343841552734375f);
1861 path1.lineTo(98.68194580078125f, 140.343841552734375f);
1862 path1.lineTo(93.45894622802734375f, 153.02825927734375f);
1863 path1.lineTo(93.45894622802734375f, 153.02825927734375f);
1864 path1.quadTo(96.94116973876953125f, 159.65185546875f, 102.64466094970703125f, 165.3553466796875f);
1865 path1.quadTo(110.7924652099609375f, 173.503143310546875f, 120.8179779052734375f, 177.1177825927734375f);
1866 path1.lineTo(136.969696044921875f, 166.6666717529296875f);
1867 path1.lineTo(136.969696044921875f, 166.6666717529296875f);
1868 path1.close();
1869 path1.moveTo(175.8309783935546875f, 141.5211334228515625f);
1870 path1.lineTo(136.969696044921875f, 166.6666717529296875f);
1871 path1.lineTo(136.969696044921875f, 166.6666717529296875f);
1872 path1.lineTo(153.15728759765625f, 177.7956390380859375f);
1873 path1.lineTo(153.15728759765625f, 177.7956390380859375f);
1874 path1.quadTo(164.392425537109375f, 174.318267822265625f, 173.3553466796875f, 165.3553466796875f);
1875 path1.quadTo(177.805816650390625f, 160.9048614501953125f, 180.90380859375f, 155.8941650390625f);
1876 path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
1877 path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
1878 path1.close();
1879 path1.moveTo(175.8309783935546875f, 141.5211334228515625f);
1880 path1.lineTo(187.8782806396484375f, 133.7258148193359375f);
1881 path1.lineTo(187.8782806396484375f, 133.7258148193359375f);
1882 path1.quadTo(188, 131.8880615234375f, 188, 130);
1883 path1.quadTo(188, 112.942657470703125f, 178.0662384033203125f, 100);
1884 path1.lineTo(161.1764678955078125f, 100);
1885 path1.lineTo(161.1764678955078125f, 100);
1886 path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
1887 path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
1888 path1.close();
1889
1890 SkPath path2;
1891 path2.moveTo(174.117645263671875f, 100);
1892 path2.lineTo(161.1764678955078125f, 100);
1893 path2.lineTo(161.1764678955078125f, 100);
1894 path2.lineTo(155.1280364990234375f, 82.86279296875f);
1895 path2.lineTo(155.1280364990234375f, 82.86279296875f);
1896 path2.quadTo(153.14971923828125f, 82.15229034423828125f, 151.098419189453125f, 81.618133544921875f);
1897 path2.lineTo(143.5294189453125f, 100);
1898 path2.lineTo(143.5294189453125f, 100);
1899 path2.lineTo(161.1764678955078125f, 100);
1900 path2.lineTo(161.1764678955078125f, 100);
1901 path2.lineTo(168.23529052734375f, 120);
1902 path2.lineTo(168.23529052734375f, 120);
1903 path2.lineTo(181.1764678955078125f, 120);
1904 path2.lineTo(181.1764678955078125f, 120);
1905 path2.lineTo(186.3661956787109375f, 134.7042236328125f);
1906 path2.lineTo(186.3661956787109375f, 134.7042236328125f);
1907 path2.lineTo(187.8782806396484375f, 133.7258148193359375f);
1908 path2.lineTo(187.8782806396484375f, 133.7258148193359375f);
1909 path2.quadTo(188, 131.8880615234375f, 188, 130);
1910 path2.quadTo(188, 124.80947113037109375f, 187.080169677734375f, 120);
1911 path2.lineTo(181.1764678955078125f, 120);
1912 path2.lineTo(181.1764678955078125f, 120);
1913 path2.lineTo(174.117645263671875f, 100);
1914 path2.lineTo(174.117645263671875f, 100);
1915 path2.close();
1916 path2.moveTo(88.91983795166015625f, 120);
1917 path2.lineTo(107.0588226318359375f, 120);
1918 path2.lineTo(107.0588226318359375f, 120);
1919 path2.lineTo(98.68194580078125f, 140.343841552734375f);
1920 path2.lineTo(98.68194580078125f, 140.343841552734375f);
1921 path2.lineTo(88.08148956298828125f, 133.0560302734375f);
1922 path2.lineTo(88.08148956298828125f, 133.0560302734375f);
1923 path2.quadTo(88, 131.544830322265625f, 88, 130);
1924 path2.quadTo(88, 124.80951690673828125f, 88.91983795166015625f, 120);
1925 path2.close();
1926 path2.moveTo(96.67621612548828125f, 145.21490478515625f);
1927 path2.lineTo(98.68194580078125f, 140.343841552734375f);
1928 path2.lineTo(98.68194580078125f, 140.343841552734375f);
1929 path2.lineTo(120.68767547607421875f, 155.4727783203125f);
1930 path2.lineTo(120.68767547607421875f, 155.4727783203125f);
1931 path2.lineTo(118.68194580078125f, 160.343841552734375f);
1932 path2.lineTo(118.68194580078125f, 160.343841552734375f);
1933 path2.lineTo(96.67621612548828125f, 145.21490478515625f);
1934 path2.lineTo(96.67621612548828125f, 145.21490478515625f);
1935 path2.close();
1936 path2.moveTo(113.232177734375f, 173.5789947509765625f);
1937 path2.quadTo(116.8802642822265625f, 175.69805908203125f, 120.8179779052734375f, 177.1177825927734375f);
1938 path2.lineTo(132.2864990234375f, 169.6969757080078125f);
1939 path2.lineTo(132.2864990234375f, 169.6969757080078125f);
1940 path2.lineTo(118.68194580078125f, 160.343841552734375f);
1941 path2.lineTo(118.68194580078125f, 160.343841552734375f);
1942 path2.lineTo(113.232177734375f, 173.5789947509765625f);
1943 path2.lineTo(113.232177734375f, 173.5789947509765625f);
1944 path2.close();
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001945
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001946 testPathOp(reporter, path1, path2, kUnion_PathOp, filename);
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001947}
caryclark@google.com3dd27842013-07-15 15:00:58 +00001948#endif
1949
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001950static void issue1418(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.com7f1af502013-07-24 07:01:12 +00001951 SkPath path1;
1952 path1.moveTo(0, 0);
1953 path1.lineTo(1, 0);
1954 path1.lineTo(1, 0);
1955 path1.lineTo(1, 1);
1956 path1.lineTo(1, 1);
1957 path1.lineTo(0, 1);
1958 path1.lineTo(0, 1);
1959 path1.lineTo(0, 0);
1960 path1.lineTo(0, 0);
1961 path1.close();
1962
1963 SkPath path2;
1964 path2.moveTo(0.64644664525985717773f, -0.35355341434478759766f);
1965 path2.quadTo(0.79289329051971435547f, -0.50000005960464477539f, 1.0000001192092895508f, -0.50000005960464477539f);
1966 path2.quadTo(1.2071068286895751953f, -0.50000005960464477539f, 1.3535535335540771484f, -0.35355341434478759766f);
1967 path2.quadTo(1.5000001192092895508f, -0.20710679888725280762f, 1.5000001192092895508f, 0);
1968 path2.quadTo(1.5000001192092895508f, 0.20710679888725280762f, 1.3535535335540771484f, 0.35355341434478759766f);
1969 path2.quadTo(1.2071068286895751953f, 0.50000005960464477539f, 1.0000001192092895508f, 0.50000005960464477539f);
1970 path2.quadTo(0.79289329051971435547f, 0.50000005960464477539f, 0.64644664525985717773f, 0.35355341434478759766f);
1971 path2.quadTo(0.50000005960464477539f, 0.20710679888725280762f, 0.50000005960464477539f, 0);
caryclark@google.com4fdbb222013-07-23 15:27:41 +00001972 path2.quadTo(0.50000005960464477539f, -0.20710679888725280762f, 0.64644664525985717773f, -0.35355341434478759766f);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001973 testPathOp(reporter, path1, path2, kIntersect_PathOp, filename);
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001974}
caryclark@google.com4fdbb222013-07-23 15:27:41 +00001975
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001976static void cubicOp85i(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.com7f1af502013-07-24 07:01:12 +00001977 SkPath path, pathB;
1978 path.setFillType(SkPath::kWinding_FillType);
1979 path.moveTo(3, 4);
1980 path.cubicTo(1, 5, 4, 3, 6, 4);
1981 path.close();
1982 pathB.setFillType(SkPath::kWinding_FillType);
1983 pathB.moveTo(3, 4);
1984 pathB.cubicTo(4, 6, 4, 3, 5, 1);
1985 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001986 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com4fdbb222013-07-23 15:27:41 +00001987}
1988
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001989static void issue1418b(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00001990 SkPath path1;
1991 path1.moveTo(0, 0);
1992 path1.lineTo(1, 0);
1993 path1.lineTo(1, 1);
1994 path1.lineTo(0, 1);
1995 path1.lineTo(0, 0);
1996 path1.close();
1997 path1.setFillType(SkPath::kWinding_FillType);
1998 SkPath path2;
1999 path2.moveTo(0.646446645f, -0.353553414f);
2000 path2.quadTo(0.792893291f, -0.50000006f, 1.00000012f, -0.50000006f);
2001 path2.quadTo(1.20710683f, -0.50000006f, 1.35355353f, -0.353553414f);
2002 path2.quadTo(1.50000012f, -0.207106799f, 1.50000012f, 0);
2003 path2.quadTo(1.50000012f, 0.207106799f, 1.35355353f, 0.353553414f);
2004 path2.quadTo(1.20710683f, 0.50000006f, 1.00000012f, 0.50000006f);
2005 path2.quadTo(0.792893291f, 0.50000006f, 0.646446645f, 0.353553414f);
2006 path2.quadTo(0.50000006f, 0.207106799f, 0.50000006f, 0);
2007 path2.quadTo(0.50000006f, -0.207106799f, 0.646446645f, -0.353553414f);
2008 path2.close();
2009 path2.moveTo(1.00000012f, 0.50000006f);
2010 path2.lineTo(1.00000012f, 1.00000012f);
2011 path2.lineTo(0.50000006f, 1.00000012f);
2012 path2.quadTo(0.50000006f, 0.792893291f, 0.646446645f, 0.646446645f);
2013 path2.quadTo(0.792893291f, 0.50000006f, 1.00000012f, 0.50000006f);
2014 path2.close();
2015 path2.setFillType(SkPath::kEvenOdd_FillType);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002016 testPathOp(reporter, path1, path2, kIntersect_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002017}
2018
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002019static void rectOp1i(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002020 SkPath path, pathB;
2021 path.setFillType(SkPath::kWinding_FillType);
2022 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
2023 path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
2024 pathB.setFillType(SkPath::kWinding_FillType);
2025 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
2026 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002027 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002028}
2029
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002030static void rectOp2i(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002031 SkPath path, pathB;
2032 path.setFillType(SkPath::kEvenOdd_FillType);
2033 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
2034 path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
2035 pathB.setFillType(SkPath::kWinding_FillType);
2036 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
2037 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002038 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002039}
2040
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002041static void rectOp3x(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002042 SkPath path, pathB;
2043 path.setFillType(SkPath::kEvenOdd_FillType);
2044 path.moveTo(0, 0);
2045 path.lineTo(3, 0);
2046 path.lineTo(3, 3);
2047 path.lineTo(0, 3);
2048 path.close();
2049 path.moveTo(2, 2);
2050 path.lineTo(3, 2);
2051 path.lineTo(3, 3);
2052 path.lineTo(2, 3);
2053 path.close();
2054 pathB.setFillType(SkPath::kWinding_FillType);
2055 pathB.moveTo(1, 1);
2056 pathB.lineTo(3, 1);
2057 pathB.lineTo(3, 3);
2058 pathB.lineTo(1, 3);
2059 pathB.close();
2060 pathB.moveTo(2, 2);
2061 pathB.lineTo(3, 2);
2062 pathB.lineTo(3, 3);
2063 pathB.lineTo(2, 3);
2064 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002065 testPathOp(reporter, path, pathB, kXOR_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002066}
2067
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002068static void issue1435(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002069 SkPath path1;
2070 path1.moveTo(160, 60);
2071 path1.lineTo(220, 230);
2072 path1.lineTo(60, 120);
2073 path1.lineTo(260, 120);
2074 path1.lineTo(90, 230);
2075 path1.lineTo(160, 60);
2076 path1.close();
2077 path1.setFillType(SkPath::kEvenOdd_FillType);
2078
caryclark@google.com570863f2013-09-16 15:55:01 +00002079 SkPath path2;
2080 path2.moveTo(142.589081f, 102.283646f);
2081 path2.quadTo(149.821579f, 100, 158, 100);
2082 path2.quadTo(167.156921f, 100, 175.128036f, 102.862793f);
2083 path2.lineTo(181.176468f, 120);
2084 path2.lineTo(135.294128f, 120);
2085 path2.lineTo(142.589081f, 102.283646f);
2086 path2.close();
2087 path2.moveTo(118.681946f, 160.343842f);
2088 path2.lineTo(135.294128f, 120);
2089 path2.lineTo(117.933762f, 120);
2090 path2.quadTo(108, 132.942657f, 108, 150);
2091 path2.quadTo(108, 151.54483f, 108.08149f, 153.05603f);
2092 path2.lineTo(118.681946f, 160.343842f);
2093 path2.close();
2094 path2.moveTo(156.969696f, 186.666672f);
2095 path2.lineTo(118.681946f, 160.343842f);
2096 path2.lineTo(113.458946f, 173.028259f);
2097 path2.quadTo(116.94117f, 179.651855f, 122.644661f, 185.355347f);
2098 path2.quadTo(130.792465f, 193.503143f, 140.817978f, 197.117783f);
2099 path2.lineTo(156.969696f, 186.666672f);
2100 path2.close();
2101 path2.moveTo(195.830978f, 161.521133f);
2102 path2.lineTo(156.969696f, 186.666672f);
2103 path2.lineTo(173.157288f, 197.795639f);
2104 path2.quadTo(184.392426f, 194.318268f, 193.355347f, 185.355347f);
2105 path2.quadTo(197.805817f, 180.904861f, 200.903809f, 175.894165f);
2106 path2.lineTo(195.830978f, 161.521133f);
2107 path2.close();
2108 path2.moveTo(195.830978f, 161.521133f);
2109 path2.lineTo(207.878281f, 153.725815f);
2110 path2.quadTo(208, 151.888062f, 208, 150);
2111 path2.quadTo(208, 132.942657f, 198.066238f, 120);
2112 path2.lineTo(181.176468f, 120);
2113 path2.lineTo(195.830978f, 161.521133f);
2114 path2.close();
2115 path2.setFillType(SkPath::kEvenOdd_FillType);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002116 testPathOp(reporter, path1, path2, kIntersect_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002117}
caryclark@google.com570863f2013-09-16 15:55:01 +00002118
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002119static void skpkkiste_to716(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.com7f1af502013-07-24 07:01:12 +00002120 SkPath path;
2121 path.setFillType(SkPath::kEvenOdd_FillType);
2122 path.moveTo(1173, 284);
2123 path.cubicTo(1173, 285.125824f, 1173.37207f, 286.164734f, 1174, 287.000488f);
2124 path.lineTo(1174, 123.999496f);
2125 path.cubicTo(1173.37207f, 124.835243f, 1173, 125.874168f, 1173, 127);
2126 path.lineTo(1173, 284);
2127 path.close();
2128 SkPath pathB;
2129 pathB.setFillType(SkPath::kWinding_FillType);
2130 pathB.moveTo(1340, 122);
2131 pathB.cubicTo(1342.76147f, 122, 1345, 124.238579f, 1345, 127);
2132 pathB.lineTo(1345, 284);
2133 pathB.cubicTo(1345, 286.761414f, 1342.76147f, 289, 1340, 289);
2134 pathB.lineTo(1178, 289);
2135 pathB.cubicTo(1175.23853f, 289, 1173, 286.761414f, 1173, 284);
2136 pathB.lineTo(1173, 127);
2137 pathB.cubicTo(1173, 124.238579f, 1175.23853f, 122, 1178, 122);
2138 pathB.lineTo(1340, 122);
2139 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002140 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.com7f1af502013-07-24 07:01:12 +00002141}
caryclark@google.com3dd27842013-07-15 15:00:58 +00002142
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002143static void loopEdge1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002144 SkPath path;
2145 path.setFillType(SkPath::kEvenOdd_FillType);
2146 path.moveTo(0,0);
2147 path.lineTo(3,0);
2148 path.lineTo(3,2);
2149 path.lineTo(1,2);
2150 path.lineTo(1,1);
2151 path.lineTo(2,1);
2152 path.lineTo(2,3);
2153 path.lineTo(0,3);
2154 path.close();
2155 SkPath pathB;
2156 pathB.setFillType(SkPath::kEvenOdd_FillType);
2157 pathB.moveTo(1,2);
2158 pathB.lineTo(2,2);
2159 pathB.lineTo(2,4);
2160 pathB.lineTo(1,4);
2161 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002162 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002163}
2164
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002165static void loopEdge2(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002166 SkPath path;
2167 path.setFillType(SkPath::kEvenOdd_FillType);
2168 path.moveTo(0,0);
2169 path.lineTo(3,0);
2170 path.lineTo(3,2);
2171 path.lineTo(1,2);
2172 path.lineTo(1,1);
2173 path.lineTo(2,1);
2174 path.lineTo(2,3);
2175 path.lineTo(0,3);
2176 path.close();
2177 SkPath pathB;
2178 pathB.setFillType(SkPath::kEvenOdd_FillType);
2179 pathB.moveTo(1 - 1e-6f,2);
2180 pathB.lineTo(2 - 1e-6f,2);
2181 pathB.lineTo(2 - 1e-6f,4);
2182 pathB.lineTo(1 - 1e-6f,4);
2183 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002184 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002185}
2186
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002187static void cubicOp86i(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002188 SkPath path, pathB;
2189 path.setFillType(SkPath::kWinding_FillType);
2190 path.moveTo(0, 4);
2191 path.cubicTo(3, 4, 6, 2, 5, 2);
2192 path.close();
2193 pathB.setFillType(SkPath::kEvenOdd_FillType);
2194 pathB.moveTo(2, 6);
2195 pathB.cubicTo(2, 5, 4, 0, 4, 3);
2196 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002197 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002198}
2199
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002200static void cubicOp87u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002201 SkPath path, pathB;
2202 path.setFillType(SkPath::kWinding_FillType);
2203 path.moveTo(0,1);
2204 path.cubicTo(0,2, 2,0, 6,4);
2205 path.close();
2206 pathB.setFillType(SkPath::kWinding_FillType);
2207 pathB.moveTo(0,2);
2208 pathB.cubicTo(4,6, 1,0, 2,0);
2209 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002210 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002211}
2212
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002213static void cubicOp88u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002214 SkPath path, pathB;
2215 path.setFillType(SkPath::kWinding_FillType);
2216 path.moveTo(0,1);
2217 path.cubicTo(2,5, 5,0, 6,4);
2218 path.close();
2219 pathB.setFillType(SkPath::kWinding_FillType);
2220 pathB.moveTo(0,5);
2221 pathB.cubicTo(4,6, 1,0, 5,2);
2222 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002223 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002224}
2225
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002226static void cubicOp89u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002227 SkPath path, pathB;
2228 path.setFillType(SkPath::kWinding_FillType);
2229 path.moveTo(0, 3);
2230 path.cubicTo(1, 6, 5, 0, 6, 3);
2231 path.close();
2232 pathB.setFillType(SkPath::kWinding_FillType);
2233 pathB.moveTo(0, 5);
2234 pathB.cubicTo(3, 6, 3, 0, 6, 1);
2235 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002236 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002237}
2238
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002239static void cubicOp90u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002240 SkPath path, pathB;
2241 path.setFillType(SkPath::kEvenOdd_FillType);
2242 path.moveTo(0, 5);
2243 path.cubicTo(1, 2, 5, 2, 4, 1);
2244 path.close();
2245 pathB.setFillType(SkPath::kEvenOdd_FillType);
2246 pathB.moveTo(2, 5);
2247 pathB.cubicTo(1, 4, 5, 0, 2, 1);
2248 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002249 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002250}
2251
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002252static void cubicOp91u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002253 SkPath path, pathB;
2254 path.setFillType(SkPath::kWinding_FillType);
2255 path.moveTo(1, 6);
2256 path.cubicTo(0, 3, 6, 3, 5, 0);
2257 path.close();
2258 pathB.setFillType(SkPath::kWinding_FillType);
2259 pathB.moveTo(3, 6);
2260 pathB.cubicTo(0, 5, 6, 1, 3, 0);
2261 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002262 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002263}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002264
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002265static void skpaaalgarve_org53(skiatest::Reporter* reporter, const char* filename) { // add t cancel
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002266 SkPath path;
2267 path.setFillType(SkPath::kEvenOdd_FillType);
2268 path.moveTo(-1.24344979e-014f, 348);
2269 path.lineTo(258, 348);
2270 path.lineTo(258, 322);
2271 path.quadTo(258, 317.857849f, 255.072006f, 314.928009f);
2272 path.quadTo(252.142136f, 312, 248, 312);
2273 path.lineTo(1.77635684e-015f, 312);
2274 path.lineTo(-1.24344979e-014f, 348);
2275 path.close();
2276 SkPath pathB;
2277 pathB.setFillType(SkPath::kWinding_FillType);
2278 pathB.moveTo(0, 312);
2279 pathB.lineTo(258, 312);
2280 pathB.lineTo(258, 348);
2281 pathB.lineTo(0, 348);
2282 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002283 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002284}
2285
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002286static void skpabcspark_ca103(skiatest::Reporter* reporter, const char* filename) { // add t cancel
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002287 SkPath path;
2288 path.setFillType(SkPath::kEvenOdd_FillType);
2289 path.moveTo(1.99840144e-015f, 494);
2290 path.lineTo(97, 494);
2291 path.quadTo(100.313705f, 494, 102.6576f, 491.657593f);
2292 path.quadTo(105, 489.313721f, 105, 486);
2293 path.lineTo(105, 425);
2294 path.quadTo(105, 421.686279f, 102.6576f, 419.342407f);
2295 path.quadTo(100.313705f, 417, 97, 417);
2296 path.lineTo(2.22044605e-016f, 417);
2297 path.lineTo(1.99840144e-015f, 494);
2298 path.close();
2299 SkPath pathB;
2300 pathB.setFillType(SkPath::kWinding_FillType);
2301 pathB.moveTo(0, 417);
2302 pathB.lineTo(105, 417);
2303 pathB.lineTo(105, 494);
2304 pathB.lineTo(0, 494);
2305 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002306 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002307}
2308
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002309static void skpacesoftech_com47(skiatest::Reporter* reporter, const char* filename) { // partial coincidence
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002310 SkPath path;
2311 path.setFillType(SkPath::kEvenOdd_FillType);
2312 path.moveTo(670.537415f, 285);
2313 path.lineTo(670.387451f, 285);
2314 path.lineTo(596.315186f, 314.850708f);
2315 path.lineTo(626.19696f, 389);
2316 path.lineTo(626.346863f, 389);
2317 path.lineTo(700.419189f, 359.149261f);
2318 path.lineTo(670.537415f, 285);
2319 path.close();
2320 SkPath pathB;
2321 pathB.setFillType(SkPath::kWinding_FillType);
2322 pathB.moveTo(663.318542f, 374.100616f);
2323 pathB.quadTo(647.950989f, 380.293671f, 632.705322f, 373.806305f);
2324 pathB.quadTo(617.459595f, 367.318909f, 611.266541f, 351.951355f);
2325 pathB.quadTo(605.073486f, 336.58374f, 611.560913f, 321.338074f);
2326 pathB.quadTo(618.048279f, 306.092407f, 633.415833f, 299.899353f);
2327 pathB.quadTo(648.783447f, 293.706299f, 664.029114f, 300.193665f);
2328 pathB.quadTo(679.27478f, 306.68103f, 685.467834f, 322.048645f);
2329 pathB.quadTo(691.660889f, 337.416199f, 685.173523f, 352.661896f);
2330 pathB.quadTo(678.686157f, 367.907562f, 663.318542f, 374.100616f);
2331 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002332 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002333}
2334
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002335static void skpact_com43(skiatest::Reporter* reporter, const char* filename) { // bridge op
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002336 SkPath path;
2337 path.setFillType(SkPath::kEvenOdd_FillType);
2338 path.moveTo(1.45716772e-016f, 924.336121f);
2339 path.lineTo(-1.11022302e-016f, 920);
2340 path.lineTo(6, 920);
2341 path.lineTo(6, 926);
2342 path.lineTo(1.66389287f, 926);
2343 path.quadTo(1.18842196f, 925.674561f, 0.756800175f, 925.243225f);
2344 path.quadTo(0.325406998f, 924.811523f, 1.45716772e-016f, 924.336121f);
2345 path.close();
2346 path.moveTo(1, 921);
2347 path.lineTo(5, 921);
2348 path.lineTo(5, 925);
2349 path.cubicTo(2.79086018f, 925, 1, 923.209167f, 1, 921);
2350 path.close();
2351 SkPath pathB;
2352 pathB.setFillType(SkPath::kWinding_FillType);
2353 pathB.moveTo(-1, 920);
2354 pathB.lineTo(0, 920);
2355 pathB.lineTo(3, 927);
2356 pathB.lineTo(-1, 927);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002357 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002358}
2359
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002360static void skpadbox_lt8(skiatest::Reporter* reporter, const char* filename) { // zero span
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002361 SkPath path;
2362 path.setFillType(SkPath::kEvenOdd_FillType);
2363 path.moveTo(320.097229f, 628.573669f);
2364 path.lineTo(610.227173f, 85.7786865f);
2365 path.lineTo(946.652588f, 265.601807f);
2366 path.lineTo(656.522644f, 808.39679f);
2367 path.lineTo(320.097229f, 628.573669f);
2368 path.close();
2369 SkPath pathB;
2370 pathB.setFillType(SkPath::kInverseWinding_FillType);
2371 pathB.moveTo(333.866608f, 623.496155f);
2372 pathB.lineTo(613.368042f, 100.585754f);
2373 pathB.cubicTo(613.685303f, 99.9921265f, 614.423767f, 99.7681885f, 615.017395f, 100.085449f);
2374 pathB.lineTo(932.633057f, 269.854553f);
2375 pathB.cubicTo(933.226685f, 270.171875f, 933.450623f, 270.910278f, 933.133301f, 271.503906f);
2376 pathB.lineTo(653.631897f, 794.414307f);
2377 pathB.cubicTo(653.314636f, 795.007935f, 652.576172f, 795.231934f, 651.982544f, 794.914612f);
2378 pathB.lineTo(334.366943f, 625.145508f);
2379 pathB.cubicTo(333.773315f, 624.828247f, 333.549286f, 624.089783f, 333.866608f, 623.496155f);
2380 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002381 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002382}
2383
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002384static void skpadindex_de4(skiatest::Reporter* reporter, const char* filename) { // find chase op
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002385 SkPath path;
2386 path.setFillType(SkPath::kEvenOdd_FillType);
2387 path.moveTo(0, 926);
2388 path.lineTo(0, 0);
2389 path.lineTo(1280, 0);
2390 path.lineTo(1280, 926);
2391 path.lineTo(0, 926);
2392 path.close();
2393 SkPath pathB;
2394 pathB.setFillType(SkPath::kWinding_FillType);
2395 pathB.moveTo(0, 312);
2396 pathB.lineTo(8.20486257e-015f, 178);
2397 pathB.lineTo(49, 178);
2398 pathB.lineTo(49, 312);
2399 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002400 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002401}
2402
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002403static void skpadithya_putr4_blogspot_com551(skiatest::Reporter* reporter, const char* filename) { // calc common
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002404 SkPath path;
2405 path.setFillType(SkPath::kEvenOdd_FillType);
2406 path.moveTo(205.605804f, 142.334625f);
2407 path.lineTo(254.665359f, 85.6058044f);
2408 path.lineTo(311.394196f, 134.665359f);
2409 path.lineTo(262.334625f, 191.39418f);
2410 path.lineTo(205.605804f, 142.334625f);
2411 path.close();
2412 SkPath pathB;
2413 pathB.setFillType(SkPath::kWinding_FillType);
2414 pathB.moveTo(283.407959f, 110.462646f);
2415 pathB.cubicTo(298.864319f, 123.829437f, 300.558258f, 147.195221f, 287.191467f, 162.651581f);
2416 pathB.lineTo(286.537354f, 163.407959f);
2417 pathB.cubicTo(273.170563f, 178.864334f, 249.804779f, 180.558258f, 234.348419f, 167.191467f);
2418 pathB.lineTo(233.592026f, 166.537338f);
2419 pathB.cubicTo(218.135666f, 153.170547f, 216.441727f, 129.804779f, 229.808517f, 114.348412f);
2420 pathB.lineTo(230.462646f, 113.592026f);
2421 pathB.cubicTo(243.829437f, 98.1356659f, 267.195221f, 96.4417267f, 282.651581f, 109.808517f);
2422 pathB.lineTo(283.407959f, 110.462646f);
2423 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002424 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002425}
2426
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002427static void skpadspert_de11(skiatest::Reporter* reporter, const char* filename) { // mark and chase winding
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002428 SkPath path;
2429 path.setFillType(SkPath::kEvenOdd_FillType);
2430 path.moveTo(-4.4408921e-016f, 682.5f);
2431 path.lineTo(30.5f, 682.5f);
2432 path.cubicTo(32.709137f, 682.5f, 34.5f, 680.709167f, 34.5f, 678.5f);
2433 path.lineTo(34.5f, 486.5f);
2434 path.cubicTo(34.5f, 484.290863f, 32.709137f, 482.5f, 30.5f, 482.5f);
2435 path.lineTo(0, 482.5f);
2436 path.lineTo(-4.4408921e-016f, 682.5f);
2437 path.close();
2438 SkPath pathB;
2439 pathB.setFillType(SkPath::kWinding_FillType);
2440 pathB.moveTo(0, 482);
2441 pathB.lineTo(35, 482);
2442 pathB.lineTo(35, 683);
2443 pathB.lineTo(0, 683);
2444 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002445 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002446}
2447
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002448static void skpaiaigames_com870(skiatest::Reporter* reporter, const char* filename) { // cubic/cubic intersect
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002449 SkPath path;
2450 path.setFillType(SkPath::kEvenOdd_FillType);
2451 path.moveTo(324.071075f, 845.071045f);
2452 path.cubicTo(324.405151f, 844.737f, 324.715668f, 844.379395f, 325, 844.000977f);
2453 path.lineTo(325, 842.127197f);
2454 path.cubicTo(324.571411f, 842.956238f, 324.017761f, 843.710144f, 323.363953f, 844.363953f);
2455 path.lineTo(324.071075f, 845.071045f);
2456 path.close();
2457 path.moveTo(323.363953f, 714.636047f);
2458 path.lineTo(324.071075f, 713.928955f);
2459 path.cubicTo(324.405151f, 714.263f, 324.715668f, 714.620605f, 325, 714.999023f);
2460 path.lineTo(325, 716.872803f);
2461 path.cubicTo(324.571411f, 716.043762f, 324.017761f, 715.289856f, 323.363953f, 714.636047f);
2462 path.close();
2463 SkPath pathB;
2464 pathB.setFillType(SkPath::kWinding_FillType);
2465 pathB.moveTo(317, 711);
2466 pathB.cubicTo(322.522858f, 711, 327, 715.477173f, 327, 721);
2467 pathB.lineTo(327, 838);
2468 pathB.cubicTo(327, 843.522827f, 322.522858f, 848, 317, 848);
2469 pathB.lineTo(155, 848);
2470 pathB.cubicTo(149.477158f, 848, 145, 843.522827f, 145, 838);
2471 pathB.lineTo(145, 721);
2472 pathB.cubicTo(145, 715.477173f, 149.477158f, 711, 155, 711);
2473 pathB.lineTo(317, 711);
2474 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002475 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002476}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002477
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002478static void cubicOp92i(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002479 SkPath path, pathB;
2480 path.setFillType(SkPath::kWinding_FillType);
2481 path.moveTo(0, 1);
2482 path.cubicTo(2, 6, 4, 1, 5, 4);
2483 path.close();
2484 pathB.setFillType(SkPath::kWinding_FillType);
2485 pathB.moveTo(1, 4);
2486 pathB.cubicTo(4, 5, 1, 0, 6, 2);
2487 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002488 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002489}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002490
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002491static void cubicOp93d(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002492 SkPath path, pathB;
2493 path.setFillType(SkPath::kWinding_FillType);
2494 path.moveTo(0, 1);
2495 path.cubicTo(1, 6, 4, 1, 4, 3);
2496 path.close();
2497 pathB.setFillType(SkPath::kWinding_FillType);
2498 pathB.moveTo(1, 4);
2499 pathB.cubicTo(3, 4, 1, 0, 6, 1);
2500 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002501 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002502}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002503
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002504static void cubicOp94u(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002505 SkPath path, pathB;
2506 path.setFillType(SkPath::kEvenOdd_FillType);
2507 path.moveTo(0, 3);
2508 path.cubicTo(2, 3, 5, 0, 5, 3);
2509 path.close();
2510 pathB.setFillType(SkPath::kEvenOdd_FillType);
2511 pathB.moveTo(0, 5);
2512 pathB.cubicTo(3, 5, 3, 0, 3, 2);
2513 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002514 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002515}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002516
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002517static void skpadbox_lt15(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002518 SkPath path;
2519 path.setFillType(SkPath::kEvenOdd_FillType);
2520 path.moveTo(333.292084f, 624.570984f);
2521 path.lineTo(614.229797f, 98.9735107f);
2522 path.lineTo(933.457764f, 269.604431f);
2523 path.lineTo(652.52002f, 795.201904f);
2524 path.lineTo(333.292084f, 624.570984f);
2525 path.close();
2526 SkPath pathB;
2527 pathB.setFillType(SkPath::kWinding_FillType);
2528 pathB.moveTo(613.368042f, 100.585754f);
2529 pathB.cubicTo(613.685303f, 99.9921265f, 614.423767f, 99.7681885f, 615.017395f, 100.085449f);
2530 pathB.lineTo(932.633057f, 269.854553f);
2531 pathB.cubicTo(933.226685f, 270.171875f, 933.450623f, 270.910278f, 933.133301f, 271.503906f);
2532 pathB.lineTo(653.631897f, 794.414307f);
2533 pathB.cubicTo(653.314636f, 795.007935f, 652.576172f, 795.231934f, 651.982544f, 794.914612f);
2534 pathB.lineTo(334.366943f, 625.145508f);
2535 pathB.cubicTo(333.773315f, 624.828247f, 333.549286f, 624.089783f, 333.866608f, 623.496155f);
2536 pathB.lineTo(613.368042f, 100.585754f);
2537 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002538 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002539}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002540
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002541static void skpadoption_org196(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002542 SkPath path;
2543 path.setFillType(SkPath::kEvenOdd_FillType);
2544 path.moveTo(802, 367);
2545 path.lineTo(802, 324);
2546 path.lineTo(956, 324);
2547 path.lineTo(956, 371);
2548 path.quadTo(956, 373.071075f, 954.536011f, 374.536011f);
2549 path.quadTo(953.071045f, 376, 951, 376);
2550 path.lineTo(811, 376);
2551 path.cubicTo(806.029419f, 376, 802, 371.970551f, 802, 367);
2552 path.close();
2553 SkPath pathB;
2554 pathB.setFillType(SkPath::kInverseWinding_FillType);
2555 pathB.moveTo(803, 326);
2556 pathB.lineTo(955, 326);
2557 pathB.lineTo(955, 370);
2558 pathB.cubicTo(955, 372.761414f, 952.761414f, 375, 950, 375);
2559 pathB.lineTo(808, 375);
2560 pathB.cubicTo(805.238586f, 375, 803, 372.761414f, 803, 370);
2561 pathB.lineTo(803, 326);
2562 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002563 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002564}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002565
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002566static void skpadspert_net23(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002567 SkPath path;
2568 path.setFillType(SkPath::kEvenOdd_FillType);
2569 path.moveTo(-2.220446e-018f, 483.5f);
2570 path.lineTo(0, 482.5f);
2571 path.lineTo(30.5f, 482.5f);
2572 path.cubicTo(32.709137f, 482.5f, 34.5f, 484.290863f, 34.5f, 486.5f);
2573 path.lineTo(34.5f, 678.5f);
2574 path.cubicTo(34.5f, 680.709167f, 32.709137f, 682.5f, 30.5f, 682.5f);
2575 path.lineTo(-4.4408921e-016f, 682.5f);
2576 path.lineTo(-4.41868766e-016f, 681.5f);
2577 path.lineTo(30.5f, 681.5f);
2578 path.cubicTo(32.1568565f, 681.5f, 33.5f, 680.15686f, 33.5f, 678.5f);
2579 path.lineTo(33.5f, 486.5f);
2580 path.cubicTo(33.5f, 484.84314f, 32.1568565f, 483.5f, 30.5f, 483.5f);
2581 path.lineTo(-2.220446e-018f, 483.5f);
2582 path.close();
2583 SkPath pathB;
2584 pathB.setFillType(SkPath::kWinding_FillType);
2585 pathB.moveTo(0, 482);
2586 pathB.lineTo(35, 482);
2587 pathB.lineTo(35, 683);
2588 pathB.lineTo(0, 683);
2589 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002590 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002591}
2592
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002593static void skpadventistmission_org572(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002594 SkPath path;
2595 path.setFillType(SkPath::kEvenOdd_FillType);
2596 path.moveTo(1182.00037f, 926);
2597 path.cubicTo(1181.08813f, 924.785583f, 1179.63586f, 924, 1178, 924);
2598 path.lineTo(938, 924);
2599 path.cubicTo(936.364197f, 924, 934.911865f, 924.785583f, 933.999634f, 926);
2600 path.lineTo(1182.00037f, 926);
2601 path.close();
2602 SkPath pathB;
2603 pathB.setFillType(SkPath::kWinding_FillType);
2604 pathB.moveTo(934, 924);
2605 pathB.lineTo(1182, 924);
2606 pathB.lineTo(1182, 926);
2607 pathB.lineTo(934, 926);
2608 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002609 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002610}
2611
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002612static void skpagentxsites_com55(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002613 SkPath path;
2614 path.setFillType(SkPath::kEvenOdd_FillType);
2615 path.moveTo(925, 27);
2616 path.cubicTo(924.447693f, 27, 924, 27.4477158f, 924, 28);
2617 path.lineTo(924, 55);
2618 path.cubicTo(924, 55.5522842f, 924.447693f, 56, 925, 56);
2619 path.lineTo(1103, 56);
2620 path.cubicTo(1103.55225f, 56, 1104, 55.5522842f, 1104, 55);
2621 path.lineTo(1104, 28);
2622 path.cubicTo(1104, 27.4477158f, 1103.55225f, 27, 1103, 27);
2623 path.lineTo(925, 27);
2624 path.close();
2625 SkPath pathB;
2626 pathB.setFillType(SkPath::kWinding_FillType);
2627 pathB.moveTo(1103, 27);
2628 pathB.cubicTo(1104.10461f, 27, 1105, 27.8954315f, 1105, 29);
2629 pathB.lineTo(1105, 54);
2630 pathB.cubicTo(1105, 55.1045685f, 1104.10461f, 56, 1103, 56);
2631 pathB.lineTo(926, 56);
2632 pathB.cubicTo(924.895447f, 56, 924, 55.1045685f, 924, 54);
2633 pathB.lineTo(924, 29);
2634 pathB.cubicTo(924, 27.8954315f, 924.895447f, 27, 926, 27);
2635 pathB.lineTo(1103, 27);
2636 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002637 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002638}
2639
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002640static void skpbakosoft_com10(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002641 SkPath path;
2642 path.setFillType(SkPath::kEvenOdd_FillType);
2643 path.moveTo(190, 170);
2644 path.cubicTo(178.9543f, 170, 170, 178.9543f, 170, 190);
2645 path.cubicTo(170, 201.0457f, 178.9543f, 210, 190, 210);
2646 path.lineTo(370, 210);
2647 path.cubicTo(381.045685f, 210, 390, 201.0457f, 390, 190);
2648 path.cubicTo(390, 178.9543f, 381.045685f, 170, 370, 170);
2649 path.lineTo(190, 170);
2650 path.close();
2651 SkPath pathB;
2652 pathB.setFillType(SkPath::kWinding_FillType);
2653 pathB.moveTo(210, 190);
2654 pathB.quadTo(210, 198.284271f, 204.142136f, 204.142136f);
2655 pathB.quadTo(198.284271f, 210, 190, 210);
2656 pathB.quadTo(181.715729f, 210, 175.857864f, 204.142136f);
2657 pathB.quadTo(170, 198.284271f, 170, 190);
2658 pathB.quadTo(170, 181.715729f, 175.857864f, 175.857864f);
2659 pathB.quadTo(181.715729f, 170, 190, 170);
2660 pathB.quadTo(198.284271f, 170, 204.142136f, 175.857864f);
2661 pathB.quadTo(210, 181.715729f, 210, 190);
2662 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002663 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002664}
2665
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002666static void skpbambootheme_com12(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002667 SkPath path;
2668 path.setFillType(SkPath::kEvenOdd_FillType);
2669 path.moveTo(47.8780937f, 58);
2670 path.lineTo(0, 58);
2671 path.lineTo(-8.65973959e-015f, 96.9914017f);
2672 path.quadTo(20.0654926f, 96.6451874f, 34.3553391f, 82.3553391f);
2673 path.quadTo(44.9466133f, 71.764061f, 47.8780937f, 58);
2674 path.close();
2675 SkPath pathB;
2676 pathB.setFillType(SkPath::kEvenOdd_FillType);
2677 pathB.moveTo(-1, -3);
2678 pathB.lineTo(-1, -3);
2679 pathB.cubicTo(26.6142502f, -3, 49, 19.3857498f, 49, 47);
2680 pathB.lineTo(49, 47);
2681 pathB.cubicTo(49, 74.6142502f, 26.6142502f, 97, -1, 97);
2682 pathB.lineTo(-1, 97);
2683 pathB.cubicTo(-28.6142502f, 97, -51, 74.6142502f, -51, 47);
2684 pathB.lineTo(-51, 47);
2685 pathB.cubicTo(-51, 19.3857498f, -28.6142502f, -3, -1, -3);
2686 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002687 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002688}
2689
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002690static void skpakmmos_ru100(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002691 SkPath path;
2692 path.setFillType(SkPath::kEvenOdd_FillType);
2693 path.moveTo(693.000488f, 926);
2694 path.cubicTo(692.164734f, 925.37207f, 691.125793f, 925, 690, 925);
2695 path.lineTo(578, 925);
2696 path.cubicTo(576.874207f, 925, 575.835266f, 925.37207f, 574.999512f, 926);
2697 path.lineTo(693.000488f, 926);
2698 path.close();
2699 SkPath pathB;
2700 pathB.setFillType(SkPath::kWinding_FillType);
2701 pathB.moveTo(575, 925);
2702 pathB.lineTo(693, 925);
2703 pathB.lineTo(693, 926);
2704 pathB.lineTo(575, 926);
2705 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002706 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002707}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002708
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002709static void skpcarpetplanet_ru22(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002710 SkPath path;
2711 path.setFillType(SkPath::kEvenOdd_FillType);
2712 path.moveTo(195, 785);
2713 path.cubicTo(124.307556f, 785, 67, 841.859863f, 67, 912);
2714 path.lineTo(67, 913);
2715 path.cubicTo(67, 917.388916f, 67.2243805f, 921.725769f, 67.662384f, 926);
2716 path.lineTo(322, 926);
2717 path.lineTo(322, 896.048035f);
2718 path.cubicTo(314.09201f, 833.437622f, 260.247131f, 785, 195, 785);
2719 path.close();
2720 SkPath pathB;
2721 pathB.setFillType(SkPath::kWinding_FillType);
2722 pathB.moveTo(195, 785);
2723 pathB.cubicTo(265.140167f, 785, 322, 842.307556f, 322, 913);
2724 pathB.cubicTo(322, 983.692444f, 265.140167f, 1041, 195, 1041);
2725 pathB.lineTo(194, 1041);
2726 pathB.cubicTo(123.85984f, 1041, 67, 983.692444f, 67, 913);
2727 pathB.cubicTo(67, 842.307556f, 123.85984f, 785, 194, 785);
2728 pathB.lineTo(195, 785);
2729 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002730 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002731}
2732
caryclark@google.coma2bbc6e2013-11-01 17:36:03 +00002733#define SKPS_WORKING 0
2734#if SKPS_WORKING
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002735// this fails because cubic/quad misses an intersection (failure is isolated in c/q int test)
2736static void skpcarrot_is24(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002737 SkPath path;
2738 path.setFillType(SkPath::kEvenOdd_FillType);
2739 path.moveTo(945, 597);
2740 path.quadTo(913.93396f, 597, 891.96698f, 618.96698f);
2741 path.quadTo(870, 640.93396f, 870, 672);
2742 path.quadTo(870, 703.06604f, 891.96698f, 725.03302f);
2743 path.quadTo(913.93396f, 747, 945, 747);
2744 path.quadTo(976.06604f, 747, 998.03302f, 725.03302f);
2745 path.quadTo(1020, 703.06604f, 1020, 672);
2746 path.quadTo(1020, 640.93396f, 998.03302f, 618.96698f);
2747 path.quadTo(976.06604f, 597, 945, 597);
2748 path.close();
2749 SkPath pathB;
2750 pathB.setFillType(SkPath::kWinding_FillType);
2751 pathB.moveTo(945.080994f, 597.161987f);
2752 pathB.cubicTo(903.659973f, 597.161987f, 870.080994f, 630.73999f, 870.080994f, 672.161987f);
2753 pathB.cubicTo(870.080994f, 676.096008f, 870.387024f, 679.957031f, 870.971008f, 683.726013f);
2754 pathB.cubicTo(876.53302f, 719.656006f, 907.593994f, 747.161987f, 945.080994f, 747.161987f);
2755 pathB.cubicTo(982.567993f, 747.161987f, 1013.62903f, 719.656006f, 1019.19104f, 683.726013f);
2756 pathB.cubicTo(1019.77502f, 679.955017f, 1020.08099f, 676.094971f, 1020.08099f, 672.161987f);
2757 pathB.cubicTo(1020.08002f, 630.73999f, 986.502014f, 597.161987f, 945.080994f, 597.161987f);
2758 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002759 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002760}
2761
2762#endif
2763
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002764static void skpbangalorenest_com4(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002765 SkPath path;
2766 path.setFillType(SkPath::kEvenOdd_FillType);
2767 path.moveTo(0, 926);
2768 path.lineTo(0, 0);
2769 path.lineTo(1265, 0);
2770 path.lineTo(1265, 926);
2771 path.lineTo(0, 926);
2772 path.close();
2773 SkPath pathB;
2774 pathB.setFillType(SkPath::kWinding_FillType);
2775 pathB.moveTo(0, 290);
2776 pathB.lineTo(-2.64514972e-014f, 146);
2777 pathB.lineTo(30, 146);
2778 pathB.lineTo(30, 290);
2779 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002780 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002781}
2782
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002783static void skpbenzoteh_ru152(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002784 SkPath path;
2785 path.setFillType(SkPath::kEvenOdd_FillType);
2786 path.moveTo(883, 23);
2787 path.lineTo(883, 0);
2788 path.lineTo(1122.5f, 0);
2789 path.lineTo(1122.5f, 25.2136822f);
2790 path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2791 path.quadTo(1120.07104f, 28, 1118, 28);
2792 path.lineTo(888, 28);
2793 path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2794 path.quadTo(883, 25.0710678f, 883, 23);
2795 path.close();
2796 SkPath pathB;
2797 pathB.setFillType(SkPath::kWinding_FillType);
2798 pathB.moveTo(883, 0);
2799 pathB.lineTo(1123, 0);
2800 pathB.lineTo(1123, 23);
2801 pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2802 pathB.quadTo(1120.07104f, 28, 1118, 28);
2803 pathB.lineTo(888, 28);
2804 pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2805 pathB.quadTo(883, 25.0710678f, 883, 23);
2806 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002807 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002808}
2809
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002810static void skpbestred_ru37(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002811 SkPath path;
2812 path.setFillType(SkPath::kEvenOdd_FillType);
2813 path.moveTo(883, 23);
2814 path.lineTo(883, 0);
2815 path.lineTo(1122.5f, 0);
2816 path.lineTo(1122.5f, 25.2136822f);
2817 path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2818 path.quadTo(1120.07104f, 28, 1118, 28);
2819 path.lineTo(888, 28);
2820 path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2821 path.quadTo(883, 25.0710678f, 883, 23);
2822 path.close();
2823 SkPath pathB;
2824 pathB.setFillType(SkPath::kWinding_FillType);
2825 pathB.moveTo(883, 0);
2826 pathB.lineTo(1123, 0);
2827 pathB.lineTo(1123, 23);
2828 pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2829 pathB.quadTo(1120.07104f, 28, 1118, 28);
2830 pathB.lineTo(888, 28);
2831 pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2832 pathB.quadTo(883, 25.0710678f, 883, 23);
2833 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002834 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002835}
2836
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002837static void skpbingoentertainment_net189(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002838 SkPath path;
2839 path.setFillType(SkPath::kEvenOdd_FillType);
2840 path.moveTo(896, 745.38678f);
2841 path.lineTo(896, 873.38678f);
2842 path.lineTo(922.567993f, 876.683716f);
2843 path.lineTo(922.567993f, 748.683716f);
2844 path.lineTo(896, 745.38678f);
2845 path.close();
2846 SkPath pathB;
2847 pathB.setFillType(SkPath::kWinding_FillType);
2848 pathB.moveTo(899.200928f, 745.783997f);
2849 pathB.cubicTo(897.119385f, 745.525696f, 895.432007f, 752.031982f, 895.432007f, 760.316284f);
2850 pathB.lineTo(895.432007f, 858.316284f);
2851 pathB.cubicTo(895.432007f, 866.600586f, 897.119385f, 873.525696f, 899.200928f, 873.783997f);
2852 pathB.lineTo(918.799133f, 876.216003f);
2853 pathB.cubicTo(920.880615f, 876.474304f, 922.567993f, 869.968018f, 922.567993f, 861.683716f);
2854 pathB.lineTo(922.567993f, 763.683716f);
2855 pathB.cubicTo(922.567993f, 755.399414f, 920.880615f, 748.474304f, 918.799133f, 748.216003f);
2856 pathB.lineTo(899.200928f, 745.783997f);
2857 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002858 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002859}
2860
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002861static void skpcarrefour_ro62(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002862 SkPath path;
2863 path.setFillType(SkPath::kEvenOdd_FillType);
2864 path.moveTo(1104, 453);
2865 path.lineTo(399, 453);
2866 path.lineTo(399, 657);
2867 path.cubicTo(399, 661.970581f, 403.029449f, 666, 408, 666);
2868 path.lineTo(1095, 666);
2869 path.cubicTo(1099.97058f, 666, 1104, 661.970581f, 1104, 657);
2870 path.lineTo(1104, 453);
2871 path.close();
2872 SkPath pathB;
2873 pathB.setFillType(SkPath::kInverseWinding_FillType);
2874 pathB.moveTo(400, 453);
2875 pathB.lineTo(1103, 453);
2876 pathB.lineTo(1103, 666);
2877 pathB.lineTo(406, 666);
2878 pathB.cubicTo(402.686279f, 666, 400, 663.313721f, 400, 660);
2879 pathB.lineTo(400, 453);
2880 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002881 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002882}
2883
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002884static void skpcaffelavazzait_com_ua21(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002885 SkPath path;
2886 path.setFillType(SkPath::kEvenOdd_FillType);
2887 path.moveTo(883, 23);
2888 path.lineTo(883, 0);
2889 path.lineTo(1122.5f, 0);
2890 path.lineTo(1122.5f, 25.2136822f);
2891 path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2892 path.quadTo(1120.07104f, 28, 1118, 28);
2893 path.lineTo(888, 28);
2894 path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2895 path.quadTo(883, 25.0710678f, 883, 23);
2896 path.close();
2897 SkPath pathB;
2898 pathB.setFillType(SkPath::kWinding_FillType);
2899 pathB.moveTo(883, 0);
2900 pathB.lineTo(1123, 0);
2901 pathB.lineTo(1123, 23);
2902 pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2903 pathB.quadTo(1120.07104f, 28, 1118, 28);
2904 pathB.lineTo(888, 28);
2905 pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2906 pathB.quadTo(883, 25.0710678f, 883, 23);
2907 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002908 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002909}
2910
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002911static void skpcamcorder_kz21(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002912 SkPath path;
2913 path.setFillType(SkPath::kEvenOdd_FillType);
2914 path.moveTo(883, 23);
2915 path.lineTo(883, 0);
2916 path.lineTo(1122.5f, 0);
2917 path.lineTo(1122.5f, 25.2136822f);
2918 path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2919 path.quadTo(1120.07104f, 28, 1118, 28);
2920 path.lineTo(888, 28);
2921 path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2922 path.quadTo(883, 25.0710678f, 883, 23);
2923 path.close();
2924 SkPath pathB;
2925 pathB.setFillType(SkPath::kWinding_FillType);
2926 pathB.moveTo(883, 0);
2927 pathB.lineTo(1123, 0);
2928 pathB.lineTo(1123, 23);
2929 pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2930 pathB.quadTo(1120.07104f, 28, 1118, 28);
2931 pathB.lineTo(888, 28);
2932 pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2933 pathB.quadTo(883, 25.0710678f, 883, 23);
2934 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002935 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002936}
2937
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002938static void skpcavablar_net563(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002939 SkPath path;
2940 path.setFillType(SkPath::kEvenOdd_FillType);
2941 path.moveTo(160.000488f, 918);
2942 path.cubicTo(159.164749f, 917.37207f, 158.125824f, 917, 157, 917);
2943 path.lineTo(94, 917);
2944 path.cubicTo(92.874176f, 917, 91.8352661f, 917.37207f, 90.9995193f, 918);
2945 path.lineTo(160.000488f, 918);
2946 path.close();
2947 SkPath pathB;
2948 pathB.setFillType(SkPath::kWinding_FillType);
2949 pathB.moveTo(91, 917);
2950 pathB.lineTo(160, 917);
2951 pathB.lineTo(160, 918);
2952 pathB.lineTo(91, 918);
2953 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002954 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002955}
2956
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002957static void skpinsomnia_gr72(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002958 SkPath path;
2959 path.setFillType(SkPath::kEvenOdd_FillType);
2960 path.moveTo(1138, 231);
2961 path.lineTo(1137, 243.625748f);
2962 path.lineTo(1137, 926);
2963 path.lineTo(1139, 926);
2964 path.lineTo(1139, 231);
2965 path.lineTo(1138, 231);
2966 path.close();
2967 SkPath pathB;
2968 pathB.setFillType(SkPath::kWinding_FillType);
2969 pathB.moveTo(1139, 231);
2970 pathB.lineTo(1138, 231);
2971 pathB.lineTo(633, 6101);
2972 pathB.lineTo(1139, 6607);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002973 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002974}
2975
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002976static void cubicOp95u(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002977 SkPath path, pathB;
2978 path.setFillType(SkPath::kEvenOdd_FillType);
2979 path.moveTo(0, 2);
2980 path.cubicTo(2, 3, 5, 1, 3, 2);
2981 path.close();
2982 pathB.setFillType(SkPath::kEvenOdd_FillType);
2983 pathB.moveTo(1, 5);
2984 pathB.cubicTo(2, 3, 2, 0, 3, 2);
2985 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002986 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002987}
2988
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002989static void cubicOp96d(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002990 SkPath path, pathB;
2991 path.setFillType(SkPath::kEvenOdd_FillType);
2992 path.moveTo(1, 6);
2993 path.cubicTo(0, 3, 6, 3, 5, 0);
2994 path.close();
2995 pathB.setFillType(SkPath::kEvenOdd_FillType);
2996 pathB.moveTo(3, 6);
2997 pathB.cubicTo(0, 5, 6, 1, 3, 0);
2998 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002999 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00003000}
3001
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003002static void cubicOp97x(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comf54ad6f2013-11-02 07:02:02 +00003003 SkPath path, pathB;
3004 path.setFillType(SkPath::kEvenOdd_FillType);
3005 path.moveTo(0, 2);
3006 path.cubicTo(0, 6, 2, 1, 2, 1);
3007 path.close();
3008 pathB.setFillType(SkPath::kEvenOdd_FillType);
3009 pathB.moveTo(1, 2);
3010 pathB.cubicTo(1, 2, 2, 0, 6, 0);
3011 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003012 testPathOp(reporter, path, pathB, kXOR_PathOp, filename);
caryclark@google.coma2bbc6e2013-11-01 17:36:03 +00003013}
3014
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003015static void cubicOp98x(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comf54ad6f2013-11-02 07:02:02 +00003016 SkPath path, pathB;
3017 path.setFillType(SkPath::kEvenOdd_FillType);
3018 path.moveTo(0, 3);
3019 path.cubicTo(3, 6, 4, 1, 6, 3);
3020 path.close();
3021 pathB.setFillType(SkPath::kEvenOdd_FillType);
3022 pathB.moveTo(1, 4);
3023 pathB.cubicTo(3, 6, 3, 0, 6, 3);
3024 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003025 testPathOp(reporter, path, pathB, kXOR_PathOp, filename);
caryclark@google.coma2bbc6e2013-11-01 17:36:03 +00003026}
3027
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003028static void cubicOp99(skiatest::Reporter* reporter, const char* filename) {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +00003029 SkPath path, pathB;
3030 path.setFillType(SkPath::kWinding_FillType);
3031 path.moveTo(3,6);
3032 path.cubicTo(0,3, 6,5, 5,4);
3033 path.close();
3034 pathB.setFillType(SkPath::kWinding_FillType);
3035 pathB.moveTo(5,6);
3036 pathB.cubicTo(4,5, 6,3, 3,0);
3037 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003038 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +00003039}
3040
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003041static void cubicOp100(skiatest::Reporter* reporter, const char* filename) {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +00003042 SkPath path, pathB;
3043 path.setFillType(SkPath::kWinding_FillType);
3044 path.moveTo(0,1);
3045 path.cubicTo(0,2, 2,1, 4,2);
3046 path.close();
3047 pathB.setFillType(SkPath::kWinding_FillType);
3048 pathB.moveTo(1,2);
3049 pathB.cubicTo(2,4, 1,0, 2,0);
3050 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003051 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +00003052}
3053
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003054static void cubicOp101(skiatest::Reporter* reporter, const char* filename) {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +00003055 SkPath path, pathB;
3056 path.setFillType(SkPath::kWinding_FillType);
3057 path.moveTo(0, 1);
3058 path.cubicTo(2, 3, 2, 1, 5, 3);
3059 path.close();
3060 pathB.setFillType(SkPath::kWinding_FillType);
3061 pathB.moveTo(1, 2);
3062 pathB.cubicTo(3, 5, 1, 0, 3, 2);
3063 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003064 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +00003065}
3066
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003067static void cubicOp102(skiatest::Reporter* reporter, const char* filename) {
3068 SkPath path, pathB;
3069 path.setFillType(SkPath::kWinding_FillType);
3070 path.moveTo(0,1);
3071 path.cubicTo(1,2, 1,0, 3,0);
3072 path.close();
3073 pathB.setFillType(SkPath::kWinding_FillType);
3074 pathB.moveTo(0,1);
3075 pathB.cubicTo(0,3, 1,0, 2,1);
3076 pathB.close();
3077 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3078}
3079
3080static void cubicOp103(skiatest::Reporter* reporter, const char* filename) {
3081 SkPath path, pathB;
3082 path.setFillType(SkPath::kWinding_FillType);
3083 path.moveTo(0,1);
3084 path.cubicTo(1,5, 2,0, 2,1);
3085 path.close();
3086 pathB.setFillType(SkPath::kWinding_FillType);
3087 pathB.moveTo(0,2);
3088 pathB.cubicTo(1,2, 1,0, 5,1);
3089 pathB.close();
3090 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3091}
3092
3093static void cubicOp104(skiatest::Reporter* reporter, const char* filename) {
3094 SkPath path, pathB;
3095 path.setFillType(SkPath::kWinding_FillType);
3096 path.moveTo(0,1);
3097 path.cubicTo(0,6, 4,0, 6,1);
3098 path.close();
3099 pathB.setFillType(SkPath::kWinding_FillType);
3100 pathB.moveTo(0,4);
3101 pathB.cubicTo(1,6, 1,0, 6,0);
3102 pathB.close();
3103 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3104}
3105
3106static void cubicOp105(skiatest::Reporter* reporter, const char* filename) {
3107 SkPath path, pathB;
3108 path.setFillType(SkPath::kWinding_FillType);
3109 path.moveTo(0,1);
3110 path.cubicTo(0,4, 6,5, 2,0);
3111 path.close();
3112 pathB.setFillType(SkPath::kWinding_FillType);
3113 pathB.moveTo(5,6);
3114 pathB.cubicTo(0,2, 1,0, 4,0);
3115 pathB.close();
3116 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3117}
3118
3119static void cubicOp106(skiatest::Reporter* reporter, const char* filename) {
3120 SkPath path, pathB;
3121 path.setFillType(SkPath::kWinding_FillType);
3122 path.moveTo(0, 1);
3123 path.cubicTo(4, 6, 2, 1, 2, 0);
3124 path.close();
3125 pathB.setFillType(SkPath::kWinding_FillType);
3126 pathB.moveTo(1, 2);
3127 pathB.cubicTo(0, 2, 1, 0, 6, 4);
3128 pathB.close();
3129 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3130}
3131
3132static void cubicOp107(skiatest::Reporter* reporter, const char* filename) {
3133 SkPath path, pathB;
3134 path.setFillType(SkPath::kWinding_FillType);
3135 path.moveTo(0, 1);
3136 path.cubicTo(4, 6, 2, 1, 2, 0);
3137 path.close();
3138 pathB.setFillType(SkPath::kWinding_FillType);
3139 pathB.moveTo(1, 2);
3140 pathB.cubicTo(0, 2, 1, 0, 6, 4);
3141 pathB.close();
3142 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3143}
3144
3145static void cubicOp108(skiatest::Reporter* reporter, const char* filename) {
3146 SkPath path, pathB;
3147 path.setFillType(SkPath::kWinding_FillType);
3148 path.moveTo(0, 1);
3149 path.cubicTo(4, 6, 2, 1, 2, 0);
3150 path.close();
3151 pathB.setFillType(SkPath::kWinding_FillType);
3152 pathB.moveTo(1, 2);
3153 pathB.cubicTo(0, 2, 1, 0, 6, 4);
3154 pathB.close();
3155 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
3156}
3157
3158static void cubicOp109(skiatest::Reporter* reporter, const char* filename) {
3159 SkPath path, pathB;
3160 path.setFillType(SkPath::kWinding_FillType);
3161 path.moveTo(0,1);
3162 path.cubicTo(4,5, 6,3, 5,4);
3163 path.close();
3164 pathB.setFillType(SkPath::kWinding_FillType);
3165 pathB.moveTo(3,6);
3166 pathB.cubicTo(4,5, 1,0, 5,4);
3167 pathB.close();
3168 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3169}
3170
3171static void cubicOp110(skiatest::Reporter* reporter, const char* filename) {
3172 SkPath path, pathB;
3173 path.setFillType(SkPath::kEvenOdd_FillType);
3174 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
3175 path.addRect(0, 0, 4, 4, SkPath::kCW_Direction);
3176 pathB.setFillType(SkPath::kEvenOdd_FillType);
3177 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3178 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3179 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3180}
3181
3182static void cubicOp111(skiatest::Reporter* reporter, const char* filename) {
3183 SkPath path, pathB;
3184 path.setFillType(SkPath::kWinding_FillType);
3185 path.moveTo(1,4);
3186 path.cubicTo(0,5, 4,1, 3,1);
3187 path.close();
3188 pathB.setFillType(SkPath::kWinding_FillType);
3189 pathB.moveTo(1,4);
3190 pathB.cubicTo(1,3, 4,1, 5,0);
3191 pathB.close();
3192 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3193}
3194
3195static void xOp1u(skiatest::Reporter* reporter, const char* filename) {
3196 SkPath path, pathB;
3197 path.setFillType(SkPath::kEvenOdd_FillType);
3198 path.moveTo(1, 4);
3199 path.cubicTo(4, 5, 3, 2, 6, 3);
3200 path.close();
3201 pathB.setFillType(SkPath::kEvenOdd_FillType);
3202 pathB.moveTo(2, 3);
3203 pathB.cubicTo(3, 6, 4, 1, 5, 4);
3204 pathB.close();
3205 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
3206}
3207
3208static void xOp1i(skiatest::Reporter* reporter, const char* filename) {
3209 SkPath path, pathB;
3210 path.setFillType(SkPath::kEvenOdd_FillType);
3211 path.moveTo(1, 4);
3212 path.cubicTo(1, 5, 6, 0, 5, 1);
3213 path.close();
3214 pathB.setFillType(SkPath::kEvenOdd_FillType);
3215 pathB.moveTo(0, 6);
3216 pathB.cubicTo(1, 5, 4, 1, 5, 1);
3217 pathB.close();
3218 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3219}
3220
3221static void xOp2i(skiatest::Reporter* reporter, const char* filename) {
3222 SkPath path, pathB;
3223 path.setFillType(SkPath::kEvenOdd_FillType);
3224 path.moveTo(1, 5);
3225 path.cubicTo(0, 4, 3, 2, 6, 1);
3226 path.close();
3227 pathB.setFillType(SkPath::kEvenOdd_FillType);
3228 pathB.moveTo(2, 3);
3229 pathB.cubicTo(1, 6, 5, 1, 4, 0);
3230 pathB.close();
3231 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3232}
3233
3234static void xOp3i(skiatest::Reporter* reporter, const char* filename) {
3235 SkPath path, pathB;
3236 path.setFillType(SkPath::kWinding_FillType);
3237 path.moveTo(1,4);
3238 path.cubicTo(0,5, 4,1, 3,1);
3239 path.close();
3240 pathB.setFillType(SkPath::kWinding_FillType);
3241 pathB.moveTo(1,4);
3242 pathB.cubicTo(1,3, 4,1, 5,0);
3243 pathB.close();
3244 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3245}
3246
3247static void findFirst1(skiatest::Reporter* reporter, const char* filename) {
3248 SkPath path, pathB;
3249 path.setFillType(SkPath::kWinding_FillType);
3250 path.moveTo(0,1);
3251 path.cubicTo(1,6, 5,0, 2,1);
3252 path.close();
3253 pathB.setFillType(SkPath::kWinding_FillType);
3254 pathB.moveTo(0,5);
3255 pathB.cubicTo(1,2, 1,0, 6,1);
3256 pathB.close();
3257 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3258}
3259
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00003260// triggers addSimpleAngle with non-zero argument
3261static void cubicOp112(skiatest::Reporter* reporter, const char* filename) {
3262 SkPath path, pathB;
3263 path.setFillType(SkPath::kWinding_FillType);
3264 path.moveTo(2,4);
3265 path.cubicTo(2,3, 6,4, 1,0);
3266 path.close();
3267 pathB.setFillType(SkPath::kWinding_FillType);
3268 pathB.moveTo(4,6);
3269 pathB.cubicTo(0,1, 4,2, 3,2);
3270 pathB.close();
3271 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3272}
3273
3274// triggers untested calcLoopSpanCount code path
3275#if 0
3276static void cubicOp113(skiatest::Reporter* reporter, const char* filename) {
3277 SkPath path, pathB;
3278 path.moveTo(2,4);
3279 path.cubicTo(3,5, 2.33333325f,4.33333349f, 3.83333325f,3.83333349f);
3280 path.close();
3281 pathB.moveTo(3,5);
3282 pathB.cubicTo(2.33333325f,4.33333349f, 3.83333325f,3.83333349f, 2,4);
3283 pathB.close();
3284 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3285}
3286#endif
3287
3288static void cubicOp114(skiatest::Reporter* reporter, const char* filename) {
3289 SkPath path, pathB;
3290 path.setFillType(SkPath::kWinding_FillType);
3291 path.moveTo(0, 1);
3292 path.cubicTo(1, 3, -1, 2, 3.5f, 1.33333337f);
3293 path.close();
3294 pathB.setFillType(SkPath::kWinding_FillType);
3295 pathB.moveTo(1, 3);
3296 pathB.cubicTo(-1, 2, 3.5f, 1.33333337f, 0, 1);
3297 pathB.close();
3298 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3299}
3300
3301static void quadOp10i(skiatest::Reporter* reporter, const char* filename) {
3302 SkPath path, pathB;
3303 path.moveTo(0, 0);
3304 path.quadTo(1, 8, 3, 5);
3305 path.lineTo(8, 1);
3306 path.close();
3307 pathB.moveTo(0, 0);
3308 pathB.quadTo(8, 1, 4, 8);
3309 pathB.close();
3310 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3311}
3312
commit-bot@chromium.org91fc81c2014-04-30 13:37:48 +00003313static void kari1(skiatest::Reporter* reporter, const char* filename) {
3314 SkPath path1;
3315 path1.moveTo(39.9375, -5.8359375);
3316 path1.lineTo(40.625, -5.7890625);
3317 path1.lineTo(37.7109375, 1.3515625);
3318 path1.lineTo(37.203125, 0.9609375);
3319 path1.close();
3320
3321 SkPath path2;
3322 path2.moveTo(37.52734375f, -1.44140625f);
3323 path2.cubicTo(37.8736991882324f, -1.69921875f, 38.1640625f, -2.140625f, 38.3984375f, -2.765625f);
3324 path2.lineTo(38.640625f, -2.609375f);
3325 path2.cubicTo(38.53125f, -1.89583337306976f, 38.0664443969727f, -0.154893040657043f, 38.0664443969727f, -0.154893040657043f);
3326 path2.cubicTo(38.0664443969727f, -0.154893040657043f, 37.1809883117676f, -1.18359375f, 37.52734375, -1.44140625f);
3327 path2.close();
3328
3329 testPathOp(reporter, path1, path2, kDifference_PathOp, filename);
3330}
3331
commit-bot@chromium.org2db7fe72014-05-07 15:31:40 +00003332static void issue2504(skiatest::Reporter* reporter, const char* filename) {
3333 SkPath path1;
3334 path1.moveTo(34.2421875, -5.976562976837158203125);
3335 path1.lineTo(35.453121185302734375, 0);
3336 path1.lineTo(31.9375, 0);
3337 path1.close();
3338
3339 SkPath path2;
3340 path2.moveTo(36.71843719482421875, 0.8886508941650390625);
3341 path2.cubicTo(36.71843719482421875, 0.8886508941650390625,
3342 35.123386383056640625, 0.554015457630157470703125,
3343 34.511409759521484375, -0.1152553558349609375);
3344 path2.cubicTo(33.899425506591796875, -0.7845261096954345703125,
3345 34.53484344482421875, -5.6777553558349609375,
3346 34.53484344482421875, -5.6777553558349609375);
3347 path2.close();
3348 testPathOp(reporter, path1, path2, kUnion_PathOp, filename);
3349}
3350
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003351static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0;
3352static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0;
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003353
3354static struct TestDesc tests[] = {
commit-bot@chromium.org2db7fe72014-05-07 15:31:40 +00003355 TEST(issue2504),
commit-bot@chromium.org91fc81c2014-04-30 13:37:48 +00003356 TEST(kari1),
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00003357 TEST(quadOp10i),
3358#if 0 // FIXME: serpentine curve is ordered the wrong way
3359 TEST(cubicOp114),
3360#endif
3361#if 0 // FIXME: currently failing
3362 TEST(cubicOp113),
3363#endif
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00003364#if SKPS_WORKING
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003365 // fails because a cubic/quadratic intersection is missed
3366 // the internal quad/quad is far enough away from the real cubic/quad that it is rejected
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00003367 TEST(skpcarrot_is24),
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00003368#endif
3369#if ISSUE_1417_WORKING_ON_LINUX_32
3370 TEST(issue1417),
3371#endif
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00003372 TEST(cubicOp112),
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003373 TEST(skpadspert_net23),
3374 TEST(skpadspert_de11),
3375 TEST(findFirst1),
3376 TEST(xOp2i),
3377 TEST(xOp3i),
3378 TEST(xOp1u),
3379 TEST(xOp1i),
3380 TEST(cubicOp111),
3381 TEST(cubicOp110),
3382 TEST(cubicOp109),
3383 TEST(cubicOp108),
3384 TEST(cubicOp107),
3385 TEST(cubicOp106),
3386 TEST(cubicOp105),
3387 TEST(cubicOp104),
3388 TEST(cubicOp103),
3389 TEST(cubicOp102),
3390 TEST(cubicOp101),
3391 TEST(cubicOp100),
3392 TEST(cubicOp99),
3393 TEST(issue1435),
caryclark@google.coma2bbc6e2013-11-01 17:36:03 +00003394 TEST(cubicOp98x),
3395 TEST(cubicOp97x),
3396 TEST(skpcarpetplanet_ru22), // cubic/cubic intersect detects unwanted coincidence
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00003397 TEST(cubicOp96d),
3398 TEST(cubicOp95u),
3399 TEST(skpadbox_lt15),
3400 TEST(skpagentxsites_com55),
3401 TEST(skpadventistmission_org572),
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00003402 TEST(skpadoption_org196),
3403 TEST(skpbambootheme_com12),
3404 TEST(skpbakosoft_com10),
3405 TEST(skpakmmos_ru100),
3406 TEST(skpbangalorenest_com4),
3407 TEST(skpbingoentertainment_net189),
3408 TEST(skpbestred_ru37),
3409 TEST(skpbenzoteh_ru152),
3410 TEST(skpcamcorder_kz21),
3411 TEST(skpcaffelavazzait_com_ua21),
3412 TEST(skpcarrefour_ro62),
3413 TEST(skpcavablar_net563),
3414 TEST(skpinsomnia_gr72),
3415 TEST(skpadbox_lt8),
3416 TEST(skpact_com43),
3417 TEST(skpacesoftech_com47),
3418 TEST(skpabcspark_ca103),
3419 TEST(cubicOp94u),
3420 TEST(cubicOp93d),
3421 TEST(cubicOp92i),
3422 TEST(skpadithya_putr4_blogspot_com551),
3423 TEST(skpadindex_de4),
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00003424 TEST(skpaiaigames_com870),
3425 TEST(skpaaalgarve_org53),
3426 TEST(skpkkiste_to716),
caryclark@google.com570863f2013-09-16 15:55:01 +00003427 TEST(cubicOp91u),
3428 TEST(cubicOp90u),
3429 TEST(cubicOp89u),
3430 TEST(cubicOp88u),
3431 TEST(cubicOp87u),
3432 TEST(cubicOp86i),
3433 TEST(loopEdge2),
3434 TEST(loopEdge1),
3435 TEST(rectOp3x),
3436 TEST(rectOp2i),
3437 TEST(rectOp1i),
3438 TEST(issue1418b),
caryclark@google.com4fdbb222013-07-23 15:27:41 +00003439 TEST(cubicOp85i),
caryclark@google.com4fdbb222013-07-23 15:27:41 +00003440 TEST(issue1418),
3441 TEST(skpkkiste_to98),
caryclark@google.comfa2aeee2013-07-15 13:29:13 +00003442 TEST(skpahrefs_com29),
3443 TEST(cubicOp85d),
3444 TEST(skpahrefs_com88),
caryclark@google.com07e97fc2013-07-08 17:17:02 +00003445 TEST(skphealth_com76),
3446 TEST(skpancestry_com1),
3447 TEST(skpbyte_com1),
3448 TEST(skpeldorado_com_ua1),
3449 TEST(skp96prezzi1),
caryclark@google.comcffbcc32013-06-04 17:59:42 +00003450 TEST(skpClip2),
caryclark@google.comcffbcc32013-06-04 17:59:42 +00003451 TEST(skpClip1),
3452 TEST(cubicOp84d),
3453 TEST(cubicOp83i),
reed@google.com277c3f82013-05-31 15:17:50 +00003454 TEST(cubicOp82i),
3455 TEST(cubicOp81d),
3456 TEST(cubicOp80i),
3457 TEST(cubicOp79u),
reed@google.com277c3f82013-05-31 15:17:50 +00003458 TEST(cubicOp78u),
3459 TEST(cubicOp77i),
caryclark@google.comcffbcc32013-06-04 17:59:42 +00003460 TEST(cubicOp76u),
reed@google.com277c3f82013-05-31 15:17:50 +00003461 TEST(cubicOp75d),
caryclark@google.comcffbcc32013-06-04 17:59:42 +00003462 TEST(cubicOp74d),
reed@google.com277c3f82013-05-31 15:17:50 +00003463 TEST(cubicOp73d),
3464 TEST(cubicOp72i),
3465 TEST(cubicOp71d),
caryclark@google.coma5e55922013-05-07 18:51:31 +00003466 TEST(skp5),
3467 TEST(skp4),
3468 TEST(skp3),
3469 TEST(skp2),
3470 TEST(skp1),
caryclark@google.com6dc7df62013-04-25 11:51:54 +00003471 TEST(rRect1),
caryclark@google.coma5e55922013-05-07 18:51:31 +00003472 TEST(cubicOp70d),
caryclark@google.com03610322013-04-18 15:58:21 +00003473 TEST(cubicOp69d),
3474 TEST(cubicOp68u),
caryclark@google.comb3f09212013-04-17 15:49:16 +00003475 TEST(cubicOp67u),
3476 TEST(cubicOp66u),
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003477 TEST(rectOp1d),
3478 TEST(cubicOp65d),
3479 TEST(cubicOp64d),
3480 TEST(cubicOp63d),
3481 TEST(cubicOp62d),
3482 TEST(cubicOp61d),
3483 TEST(cubicOp60d),
3484 TEST(cubicOp59d),
3485 TEST(cubicOp58d),
3486 TEST(cubicOp57d),
3487 TEST(cubicOp56d),
3488 TEST(cubicOp55d),
3489 TEST(cubicOp54d),
3490 TEST(cubicOp53d),
3491 TEST(cubicOp52d),
3492 TEST(cubicOp51d),
3493 TEST(cubicOp50d),
3494 TEST(cubicOp49d),
3495 TEST(cubicOp48d),
3496 TEST(cubicOp47d),
3497 TEST(cubicOp46d),
3498 TEST(cubicOp45d),
3499 TEST(cubicOp44d),
3500 TEST(cubicOp43d),
3501 TEST(cubicOp42d),
3502 TEST(cubicOp41i),
3503 TEST(cubicOp40d),
3504 TEST(cubicOp39d),
3505 TEST(cubicOp38d),
3506 TEST(cubicOp37d),
3507 TEST(cubicOp36u),
3508 TEST(cubicOp35d),
3509 TEST(cubicOp34d),
3510 TEST(cubicOp33i),
3511 TEST(cubicOp32d),
3512 TEST(cubicOp31d),
3513 TEST(cubicOp31x),
3514 TEST(cubicOp31u),
3515 TEST(cubicOp30d),
3516 TEST(cubicOp29d),
3517 TEST(cubicOp28u),
3518 TEST(cubicOp27d),
3519 TEST(cubicOp26d),
3520 TEST(cubicOp25i),
3521 TEST(testOp8d),
3522 TEST(testDiff1),
3523 TEST(testIntersect1),
3524 TEST(testUnion1),
3525 TEST(testXor1),
3526 TEST(testDiff2),
3527 TEST(testIntersect2),
3528 TEST(testUnion2),
3529 TEST(testXor2),
3530 TEST(testOp1d),
3531 TEST(testOp2d),
3532 TEST(testOp3d),
3533 TEST(testOp1u),
3534 TEST(testOp4d),
3535 TEST(testOp5d),
3536 TEST(testOp6d),
3537 TEST(testOp7d),
3538 TEST(testOp2u),
3539
3540 TEST(cubicOp24d),
3541 TEST(cubicOp23d),
3542 TEST(cubicOp22d),
3543 TEST(cubicOp21d),
3544 TEST(cubicOp20d),
3545 TEST(cubicOp19i),
3546 TEST(cubicOp18d),
3547 TEST(cubicOp17d),
3548 TEST(cubicOp16d),
3549 TEST(cubicOp15d),
3550 TEST(cubicOp14d),
3551 TEST(cubicOp13d),
3552 TEST(cubicOp12d),
3553 TEST(cubicOp11d),
3554 TEST(cubicOp10d),
3555 TEST(cubicOp1i),
3556 TEST(cubicOp9d),
3557 TEST(quadOp9d),
3558 TEST(lineOp9d),
3559 TEST(cubicOp8d),
3560 TEST(cubicOp7d),
3561 TEST(cubicOp6d),
3562 TEST(cubicOp5d),
3563 TEST(cubicOp3d),
3564 TEST(cubicOp2d),
3565 TEST(cubicOp1d),
3566};
3567
caryclark@google.comad65a3e2013-04-15 19:13:59 +00003568static const size_t testCount = SK_ARRAY_COUNT(tests);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003569
3570static struct TestDesc subTests[] = {
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00003571 TEST(cubicOp114),
3572 TEST(cubicOp58d),
3573 TEST(cubicOp53d),
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003574};
3575
caryclark@google.comad65a3e2013-04-15 19:13:59 +00003576static const size_t subTestCount = SK_ARRAY_COUNT(subTests);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003577
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003578static void (*firstSubTest)(skiatest::Reporter* , const char* filename) = 0;
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003579
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003580static bool runSubTests = false;
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003581static bool runSubTestsFirst = false;
3582static bool runReverse = false;
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003583
tfarina@chromium.org78e7b4e2014-01-02 21:45:03 +00003584DEF_TEST(PathOpsOp, reporter) {
caryclark@google.com07e97fc2013-07-08 17:17:02 +00003585#if DEBUG_SHOW_TEST_NAME
3586 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
3587#endif
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003588 if (runSubTests && runSubTestsFirst) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003589 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, runReverse);
3590 }
3591 RunTestSet(reporter, tests, testCount, firstTest, stopTest, runReverse);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003592 if (runSubTests && !runSubTestsFirst) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003593 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, runReverse);
3594 }
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003595}
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003596
3597static void bufferOverflow(skiatest::Reporter* reporter, const char* filename) {
3598 SkPath path;
3599 path.addRect(0,0, 300,170141183460469231731687303715884105728.f);
3600 SkPath pathB;
3601 pathB.addRect(0,0, 300,16);
3602 testPathFailOp(reporter, path, pathB, kUnion_PathOp, filename);
3603}
3604
3605static struct TestDesc failTests[] = {
3606 TEST(bufferOverflow),
3607};
3608
3609static const size_t failTestCount = SK_ARRAY_COUNT(failTests);
3610
3611DEF_TEST(PathOpsFailOp, reporter) {
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003612#if DEBUG_SHOW_TEST_NAME
3613 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
3614#endif
3615 RunTestSet(reporter, failTests, failTestCount, 0, 0, false);
3616}