blob: 531779292200a58991bf26bd2f2586d9f11a21a0 [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
caryclarkdac1d172014-06-17 05:15:38 -07002068#define ISSUE_1435_FIXED 0
2069#if ISSUE_1435_FIXED
2070// this fails to generate two interior line segments
2071// an earlier pathops succeeded, but still failed to generate one interior line segment
2072// (but was saved by assemble, which works around a single line missing segment)
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002073static void issue1435(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002074 SkPath path1;
2075 path1.moveTo(160, 60);
2076 path1.lineTo(220, 230);
2077 path1.lineTo(60, 120);
2078 path1.lineTo(260, 120);
2079 path1.lineTo(90, 230);
2080 path1.lineTo(160, 60);
2081 path1.close();
2082 path1.setFillType(SkPath::kEvenOdd_FillType);
2083
caryclark@google.com570863f2013-09-16 15:55:01 +00002084 SkPath path2;
2085 path2.moveTo(142.589081f, 102.283646f);
2086 path2.quadTo(149.821579f, 100, 158, 100);
2087 path2.quadTo(167.156921f, 100, 175.128036f, 102.862793f);
2088 path2.lineTo(181.176468f, 120);
2089 path2.lineTo(135.294128f, 120);
2090 path2.lineTo(142.589081f, 102.283646f);
2091 path2.close();
2092 path2.moveTo(118.681946f, 160.343842f);
2093 path2.lineTo(135.294128f, 120);
2094 path2.lineTo(117.933762f, 120);
2095 path2.quadTo(108, 132.942657f, 108, 150);
2096 path2.quadTo(108, 151.54483f, 108.08149f, 153.05603f);
2097 path2.lineTo(118.681946f, 160.343842f);
2098 path2.close();
2099 path2.moveTo(156.969696f, 186.666672f);
2100 path2.lineTo(118.681946f, 160.343842f);
2101 path2.lineTo(113.458946f, 173.028259f);
2102 path2.quadTo(116.94117f, 179.651855f, 122.644661f, 185.355347f);
2103 path2.quadTo(130.792465f, 193.503143f, 140.817978f, 197.117783f);
2104 path2.lineTo(156.969696f, 186.666672f);
2105 path2.close();
2106 path2.moveTo(195.830978f, 161.521133f);
2107 path2.lineTo(156.969696f, 186.666672f);
2108 path2.lineTo(173.157288f, 197.795639f);
2109 path2.quadTo(184.392426f, 194.318268f, 193.355347f, 185.355347f);
2110 path2.quadTo(197.805817f, 180.904861f, 200.903809f, 175.894165f);
2111 path2.lineTo(195.830978f, 161.521133f);
2112 path2.close();
2113 path2.moveTo(195.830978f, 161.521133f);
2114 path2.lineTo(207.878281f, 153.725815f);
2115 path2.quadTo(208, 151.888062f, 208, 150);
2116 path2.quadTo(208, 132.942657f, 198.066238f, 120);
2117 path2.lineTo(181.176468f, 120);
2118 path2.lineTo(195.830978f, 161.521133f);
2119 path2.close();
2120 path2.setFillType(SkPath::kEvenOdd_FillType);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002121 testPathOp(reporter, path1, path2, kIntersect_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002122}
caryclarkdac1d172014-06-17 05:15:38 -07002123#endif
caryclark@google.com570863f2013-09-16 15:55:01 +00002124
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002125static void skpkkiste_to716(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.com7f1af502013-07-24 07:01:12 +00002126 SkPath path;
2127 path.setFillType(SkPath::kEvenOdd_FillType);
2128 path.moveTo(1173, 284);
2129 path.cubicTo(1173, 285.125824f, 1173.37207f, 286.164734f, 1174, 287.000488f);
2130 path.lineTo(1174, 123.999496f);
2131 path.cubicTo(1173.37207f, 124.835243f, 1173, 125.874168f, 1173, 127);
2132 path.lineTo(1173, 284);
2133 path.close();
2134 SkPath pathB;
2135 pathB.setFillType(SkPath::kWinding_FillType);
2136 pathB.moveTo(1340, 122);
2137 pathB.cubicTo(1342.76147f, 122, 1345, 124.238579f, 1345, 127);
2138 pathB.lineTo(1345, 284);
2139 pathB.cubicTo(1345, 286.761414f, 1342.76147f, 289, 1340, 289);
2140 pathB.lineTo(1178, 289);
2141 pathB.cubicTo(1175.23853f, 289, 1173, 286.761414f, 1173, 284);
2142 pathB.lineTo(1173, 127);
2143 pathB.cubicTo(1173, 124.238579f, 1175.23853f, 122, 1178, 122);
2144 pathB.lineTo(1340, 122);
2145 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002146 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.com7f1af502013-07-24 07:01:12 +00002147}
caryclark@google.com3dd27842013-07-15 15:00:58 +00002148
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002149static void loopEdge1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002150 SkPath path;
2151 path.setFillType(SkPath::kEvenOdd_FillType);
2152 path.moveTo(0,0);
2153 path.lineTo(3,0);
2154 path.lineTo(3,2);
2155 path.lineTo(1,2);
2156 path.lineTo(1,1);
2157 path.lineTo(2,1);
2158 path.lineTo(2,3);
2159 path.lineTo(0,3);
2160 path.close();
2161 SkPath pathB;
2162 pathB.setFillType(SkPath::kEvenOdd_FillType);
2163 pathB.moveTo(1,2);
2164 pathB.lineTo(2,2);
2165 pathB.lineTo(2,4);
2166 pathB.lineTo(1,4);
2167 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002168 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002169}
2170
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002171static void loopEdge2(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002172 SkPath path;
2173 path.setFillType(SkPath::kEvenOdd_FillType);
2174 path.moveTo(0,0);
2175 path.lineTo(3,0);
2176 path.lineTo(3,2);
2177 path.lineTo(1,2);
2178 path.lineTo(1,1);
2179 path.lineTo(2,1);
2180 path.lineTo(2,3);
2181 path.lineTo(0,3);
2182 path.close();
2183 SkPath pathB;
2184 pathB.setFillType(SkPath::kEvenOdd_FillType);
2185 pathB.moveTo(1 - 1e-6f,2);
2186 pathB.lineTo(2 - 1e-6f,2);
2187 pathB.lineTo(2 - 1e-6f,4);
2188 pathB.lineTo(1 - 1e-6f,4);
2189 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002190 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002191}
2192
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002193static void cubicOp86i(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002194 SkPath path, pathB;
2195 path.setFillType(SkPath::kWinding_FillType);
2196 path.moveTo(0, 4);
2197 path.cubicTo(3, 4, 6, 2, 5, 2);
2198 path.close();
2199 pathB.setFillType(SkPath::kEvenOdd_FillType);
2200 pathB.moveTo(2, 6);
2201 pathB.cubicTo(2, 5, 4, 0, 4, 3);
2202 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002203 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002204}
2205
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002206static void cubicOp87u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002207 SkPath path, pathB;
2208 path.setFillType(SkPath::kWinding_FillType);
2209 path.moveTo(0,1);
2210 path.cubicTo(0,2, 2,0, 6,4);
2211 path.close();
2212 pathB.setFillType(SkPath::kWinding_FillType);
2213 pathB.moveTo(0,2);
2214 pathB.cubicTo(4,6, 1,0, 2,0);
2215 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002216 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002217}
2218
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002219static void cubicOp88u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002220 SkPath path, pathB;
2221 path.setFillType(SkPath::kWinding_FillType);
2222 path.moveTo(0,1);
2223 path.cubicTo(2,5, 5,0, 6,4);
2224 path.close();
2225 pathB.setFillType(SkPath::kWinding_FillType);
2226 pathB.moveTo(0,5);
2227 pathB.cubicTo(4,6, 1,0, 5,2);
2228 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002229 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002230}
2231
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002232static void cubicOp89u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002233 SkPath path, pathB;
2234 path.setFillType(SkPath::kWinding_FillType);
2235 path.moveTo(0, 3);
2236 path.cubicTo(1, 6, 5, 0, 6, 3);
2237 path.close();
2238 pathB.setFillType(SkPath::kWinding_FillType);
2239 pathB.moveTo(0, 5);
2240 pathB.cubicTo(3, 6, 3, 0, 6, 1);
2241 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002242 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002243}
2244
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002245static void cubicOp90u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002246 SkPath path, pathB;
2247 path.setFillType(SkPath::kEvenOdd_FillType);
2248 path.moveTo(0, 5);
2249 path.cubicTo(1, 2, 5, 2, 4, 1);
2250 path.close();
2251 pathB.setFillType(SkPath::kEvenOdd_FillType);
2252 pathB.moveTo(2, 5);
2253 pathB.cubicTo(1, 4, 5, 0, 2, 1);
2254 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002255 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002256}
2257
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002258static void cubicOp91u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002259 SkPath path, pathB;
2260 path.setFillType(SkPath::kWinding_FillType);
2261 path.moveTo(1, 6);
2262 path.cubicTo(0, 3, 6, 3, 5, 0);
2263 path.close();
2264 pathB.setFillType(SkPath::kWinding_FillType);
2265 pathB.moveTo(3, 6);
2266 pathB.cubicTo(0, 5, 6, 1, 3, 0);
2267 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002268 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002269}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002270
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002271static void skpaaalgarve_org53(skiatest::Reporter* reporter, const char* filename) { // add t cancel
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002272 SkPath path;
2273 path.setFillType(SkPath::kEvenOdd_FillType);
2274 path.moveTo(-1.24344979e-014f, 348);
2275 path.lineTo(258, 348);
2276 path.lineTo(258, 322);
2277 path.quadTo(258, 317.857849f, 255.072006f, 314.928009f);
2278 path.quadTo(252.142136f, 312, 248, 312);
2279 path.lineTo(1.77635684e-015f, 312);
2280 path.lineTo(-1.24344979e-014f, 348);
2281 path.close();
2282 SkPath pathB;
2283 pathB.setFillType(SkPath::kWinding_FillType);
2284 pathB.moveTo(0, 312);
2285 pathB.lineTo(258, 312);
2286 pathB.lineTo(258, 348);
2287 pathB.lineTo(0, 348);
2288 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002289 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002290}
2291
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002292static void skpabcspark_ca103(skiatest::Reporter* reporter, const char* filename) { // add t cancel
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002293 SkPath path;
2294 path.setFillType(SkPath::kEvenOdd_FillType);
2295 path.moveTo(1.99840144e-015f, 494);
2296 path.lineTo(97, 494);
2297 path.quadTo(100.313705f, 494, 102.6576f, 491.657593f);
2298 path.quadTo(105, 489.313721f, 105, 486);
2299 path.lineTo(105, 425);
2300 path.quadTo(105, 421.686279f, 102.6576f, 419.342407f);
2301 path.quadTo(100.313705f, 417, 97, 417);
2302 path.lineTo(2.22044605e-016f, 417);
2303 path.lineTo(1.99840144e-015f, 494);
2304 path.close();
2305 SkPath pathB;
2306 pathB.setFillType(SkPath::kWinding_FillType);
2307 pathB.moveTo(0, 417);
2308 pathB.lineTo(105, 417);
2309 pathB.lineTo(105, 494);
2310 pathB.lineTo(0, 494);
2311 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002312 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002313}
2314
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002315static void skpacesoftech_com47(skiatest::Reporter* reporter, const char* filename) { // partial coincidence
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002316 SkPath path;
2317 path.setFillType(SkPath::kEvenOdd_FillType);
2318 path.moveTo(670.537415f, 285);
2319 path.lineTo(670.387451f, 285);
2320 path.lineTo(596.315186f, 314.850708f);
2321 path.lineTo(626.19696f, 389);
2322 path.lineTo(626.346863f, 389);
2323 path.lineTo(700.419189f, 359.149261f);
2324 path.lineTo(670.537415f, 285);
2325 path.close();
2326 SkPath pathB;
2327 pathB.setFillType(SkPath::kWinding_FillType);
2328 pathB.moveTo(663.318542f, 374.100616f);
2329 pathB.quadTo(647.950989f, 380.293671f, 632.705322f, 373.806305f);
2330 pathB.quadTo(617.459595f, 367.318909f, 611.266541f, 351.951355f);
2331 pathB.quadTo(605.073486f, 336.58374f, 611.560913f, 321.338074f);
2332 pathB.quadTo(618.048279f, 306.092407f, 633.415833f, 299.899353f);
2333 pathB.quadTo(648.783447f, 293.706299f, 664.029114f, 300.193665f);
2334 pathB.quadTo(679.27478f, 306.68103f, 685.467834f, 322.048645f);
2335 pathB.quadTo(691.660889f, 337.416199f, 685.173523f, 352.661896f);
2336 pathB.quadTo(678.686157f, 367.907562f, 663.318542f, 374.100616f);
2337 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002338 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002339}
2340
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002341static void skpact_com43(skiatest::Reporter* reporter, const char* filename) { // bridge op
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002342 SkPath path;
2343 path.setFillType(SkPath::kEvenOdd_FillType);
2344 path.moveTo(1.45716772e-016f, 924.336121f);
2345 path.lineTo(-1.11022302e-016f, 920);
2346 path.lineTo(6, 920);
2347 path.lineTo(6, 926);
2348 path.lineTo(1.66389287f, 926);
2349 path.quadTo(1.18842196f, 925.674561f, 0.756800175f, 925.243225f);
2350 path.quadTo(0.325406998f, 924.811523f, 1.45716772e-016f, 924.336121f);
2351 path.close();
2352 path.moveTo(1, 921);
2353 path.lineTo(5, 921);
2354 path.lineTo(5, 925);
2355 path.cubicTo(2.79086018f, 925, 1, 923.209167f, 1, 921);
2356 path.close();
2357 SkPath pathB;
2358 pathB.setFillType(SkPath::kWinding_FillType);
2359 pathB.moveTo(-1, 920);
2360 pathB.lineTo(0, 920);
2361 pathB.lineTo(3, 927);
2362 pathB.lineTo(-1, 927);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002363 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002364}
2365
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002366static void skpadbox_lt8(skiatest::Reporter* reporter, const char* filename) { // zero span
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002367 SkPath path;
2368 path.setFillType(SkPath::kEvenOdd_FillType);
2369 path.moveTo(320.097229f, 628.573669f);
2370 path.lineTo(610.227173f, 85.7786865f);
2371 path.lineTo(946.652588f, 265.601807f);
2372 path.lineTo(656.522644f, 808.39679f);
2373 path.lineTo(320.097229f, 628.573669f);
2374 path.close();
2375 SkPath pathB;
2376 pathB.setFillType(SkPath::kInverseWinding_FillType);
2377 pathB.moveTo(333.866608f, 623.496155f);
2378 pathB.lineTo(613.368042f, 100.585754f);
2379 pathB.cubicTo(613.685303f, 99.9921265f, 614.423767f, 99.7681885f, 615.017395f, 100.085449f);
2380 pathB.lineTo(932.633057f, 269.854553f);
2381 pathB.cubicTo(933.226685f, 270.171875f, 933.450623f, 270.910278f, 933.133301f, 271.503906f);
2382 pathB.lineTo(653.631897f, 794.414307f);
2383 pathB.cubicTo(653.314636f, 795.007935f, 652.576172f, 795.231934f, 651.982544f, 794.914612f);
2384 pathB.lineTo(334.366943f, 625.145508f);
2385 pathB.cubicTo(333.773315f, 624.828247f, 333.549286f, 624.089783f, 333.866608f, 623.496155f);
2386 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002387 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002388}
2389
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002390static void skpadindex_de4(skiatest::Reporter* reporter, const char* filename) { // find chase op
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002391 SkPath path;
2392 path.setFillType(SkPath::kEvenOdd_FillType);
2393 path.moveTo(0, 926);
2394 path.lineTo(0, 0);
2395 path.lineTo(1280, 0);
2396 path.lineTo(1280, 926);
2397 path.lineTo(0, 926);
2398 path.close();
2399 SkPath pathB;
2400 pathB.setFillType(SkPath::kWinding_FillType);
2401 pathB.moveTo(0, 312);
2402 pathB.lineTo(8.20486257e-015f, 178);
2403 pathB.lineTo(49, 178);
2404 pathB.lineTo(49, 312);
2405 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002406 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002407}
2408
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002409static void skpadithya_putr4_blogspot_com551(skiatest::Reporter* reporter, const char* filename) { // calc common
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002410 SkPath path;
2411 path.setFillType(SkPath::kEvenOdd_FillType);
2412 path.moveTo(205.605804f, 142.334625f);
2413 path.lineTo(254.665359f, 85.6058044f);
2414 path.lineTo(311.394196f, 134.665359f);
2415 path.lineTo(262.334625f, 191.39418f);
2416 path.lineTo(205.605804f, 142.334625f);
2417 path.close();
2418 SkPath pathB;
2419 pathB.setFillType(SkPath::kWinding_FillType);
2420 pathB.moveTo(283.407959f, 110.462646f);
2421 pathB.cubicTo(298.864319f, 123.829437f, 300.558258f, 147.195221f, 287.191467f, 162.651581f);
2422 pathB.lineTo(286.537354f, 163.407959f);
2423 pathB.cubicTo(273.170563f, 178.864334f, 249.804779f, 180.558258f, 234.348419f, 167.191467f);
2424 pathB.lineTo(233.592026f, 166.537338f);
2425 pathB.cubicTo(218.135666f, 153.170547f, 216.441727f, 129.804779f, 229.808517f, 114.348412f);
2426 pathB.lineTo(230.462646f, 113.592026f);
2427 pathB.cubicTo(243.829437f, 98.1356659f, 267.195221f, 96.4417267f, 282.651581f, 109.808517f);
2428 pathB.lineTo(283.407959f, 110.462646f);
2429 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002430 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002431}
2432
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002433static void skpadspert_de11(skiatest::Reporter* reporter, const char* filename) { // mark and chase winding
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002434 SkPath path;
2435 path.setFillType(SkPath::kEvenOdd_FillType);
2436 path.moveTo(-4.4408921e-016f, 682.5f);
2437 path.lineTo(30.5f, 682.5f);
2438 path.cubicTo(32.709137f, 682.5f, 34.5f, 680.709167f, 34.5f, 678.5f);
2439 path.lineTo(34.5f, 486.5f);
2440 path.cubicTo(34.5f, 484.290863f, 32.709137f, 482.5f, 30.5f, 482.5f);
2441 path.lineTo(0, 482.5f);
2442 path.lineTo(-4.4408921e-016f, 682.5f);
2443 path.close();
2444 SkPath pathB;
2445 pathB.setFillType(SkPath::kWinding_FillType);
2446 pathB.moveTo(0, 482);
2447 pathB.lineTo(35, 482);
2448 pathB.lineTo(35, 683);
2449 pathB.lineTo(0, 683);
2450 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002451 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002452}
2453
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002454static void skpaiaigames_com870(skiatest::Reporter* reporter, const char* filename) { // cubic/cubic intersect
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002455 SkPath path;
2456 path.setFillType(SkPath::kEvenOdd_FillType);
2457 path.moveTo(324.071075f, 845.071045f);
2458 path.cubicTo(324.405151f, 844.737f, 324.715668f, 844.379395f, 325, 844.000977f);
2459 path.lineTo(325, 842.127197f);
2460 path.cubicTo(324.571411f, 842.956238f, 324.017761f, 843.710144f, 323.363953f, 844.363953f);
2461 path.lineTo(324.071075f, 845.071045f);
2462 path.close();
2463 path.moveTo(323.363953f, 714.636047f);
2464 path.lineTo(324.071075f, 713.928955f);
2465 path.cubicTo(324.405151f, 714.263f, 324.715668f, 714.620605f, 325, 714.999023f);
2466 path.lineTo(325, 716.872803f);
2467 path.cubicTo(324.571411f, 716.043762f, 324.017761f, 715.289856f, 323.363953f, 714.636047f);
2468 path.close();
2469 SkPath pathB;
2470 pathB.setFillType(SkPath::kWinding_FillType);
2471 pathB.moveTo(317, 711);
2472 pathB.cubicTo(322.522858f, 711, 327, 715.477173f, 327, 721);
2473 pathB.lineTo(327, 838);
2474 pathB.cubicTo(327, 843.522827f, 322.522858f, 848, 317, 848);
2475 pathB.lineTo(155, 848);
2476 pathB.cubicTo(149.477158f, 848, 145, 843.522827f, 145, 838);
2477 pathB.lineTo(145, 721);
2478 pathB.cubicTo(145, 715.477173f, 149.477158f, 711, 155, 711);
2479 pathB.lineTo(317, 711);
2480 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002481 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002482}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002483
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002484static void cubicOp92i(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002485 SkPath path, pathB;
2486 path.setFillType(SkPath::kWinding_FillType);
2487 path.moveTo(0, 1);
2488 path.cubicTo(2, 6, 4, 1, 5, 4);
2489 path.close();
2490 pathB.setFillType(SkPath::kWinding_FillType);
2491 pathB.moveTo(1, 4);
2492 pathB.cubicTo(4, 5, 1, 0, 6, 2);
2493 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002494 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002495}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002496
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002497static void cubicOp93d(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002498 SkPath path, pathB;
2499 path.setFillType(SkPath::kWinding_FillType);
2500 path.moveTo(0, 1);
2501 path.cubicTo(1, 6, 4, 1, 4, 3);
2502 path.close();
2503 pathB.setFillType(SkPath::kWinding_FillType);
2504 pathB.moveTo(1, 4);
2505 pathB.cubicTo(3, 4, 1, 0, 6, 1);
2506 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002507 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002508}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002509
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002510static void cubicOp94u(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002511 SkPath path, pathB;
2512 path.setFillType(SkPath::kEvenOdd_FillType);
2513 path.moveTo(0, 3);
2514 path.cubicTo(2, 3, 5, 0, 5, 3);
2515 path.close();
2516 pathB.setFillType(SkPath::kEvenOdd_FillType);
2517 pathB.moveTo(0, 5);
2518 pathB.cubicTo(3, 5, 3, 0, 3, 2);
2519 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002520 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002521}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002522
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002523static void skpadbox_lt15(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002524 SkPath path;
2525 path.setFillType(SkPath::kEvenOdd_FillType);
2526 path.moveTo(333.292084f, 624.570984f);
2527 path.lineTo(614.229797f, 98.9735107f);
2528 path.lineTo(933.457764f, 269.604431f);
2529 path.lineTo(652.52002f, 795.201904f);
2530 path.lineTo(333.292084f, 624.570984f);
2531 path.close();
2532 SkPath pathB;
2533 pathB.setFillType(SkPath::kWinding_FillType);
2534 pathB.moveTo(613.368042f, 100.585754f);
2535 pathB.cubicTo(613.685303f, 99.9921265f, 614.423767f, 99.7681885f, 615.017395f, 100.085449f);
2536 pathB.lineTo(932.633057f, 269.854553f);
2537 pathB.cubicTo(933.226685f, 270.171875f, 933.450623f, 270.910278f, 933.133301f, 271.503906f);
2538 pathB.lineTo(653.631897f, 794.414307f);
2539 pathB.cubicTo(653.314636f, 795.007935f, 652.576172f, 795.231934f, 651.982544f, 794.914612f);
2540 pathB.lineTo(334.366943f, 625.145508f);
2541 pathB.cubicTo(333.773315f, 624.828247f, 333.549286f, 624.089783f, 333.866608f, 623.496155f);
2542 pathB.lineTo(613.368042f, 100.585754f);
2543 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002544 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002545}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002546
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002547static void skpadoption_org196(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002548 SkPath path;
2549 path.setFillType(SkPath::kEvenOdd_FillType);
2550 path.moveTo(802, 367);
2551 path.lineTo(802, 324);
2552 path.lineTo(956, 324);
2553 path.lineTo(956, 371);
2554 path.quadTo(956, 373.071075f, 954.536011f, 374.536011f);
2555 path.quadTo(953.071045f, 376, 951, 376);
2556 path.lineTo(811, 376);
2557 path.cubicTo(806.029419f, 376, 802, 371.970551f, 802, 367);
2558 path.close();
2559 SkPath pathB;
2560 pathB.setFillType(SkPath::kInverseWinding_FillType);
2561 pathB.moveTo(803, 326);
2562 pathB.lineTo(955, 326);
2563 pathB.lineTo(955, 370);
2564 pathB.cubicTo(955, 372.761414f, 952.761414f, 375, 950, 375);
2565 pathB.lineTo(808, 375);
2566 pathB.cubicTo(805.238586f, 375, 803, 372.761414f, 803, 370);
2567 pathB.lineTo(803, 326);
2568 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002569 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002570}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002571
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002572static void skpadspert_net23(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002573 SkPath path;
2574 path.setFillType(SkPath::kEvenOdd_FillType);
2575 path.moveTo(-2.220446e-018f, 483.5f);
2576 path.lineTo(0, 482.5f);
2577 path.lineTo(30.5f, 482.5f);
2578 path.cubicTo(32.709137f, 482.5f, 34.5f, 484.290863f, 34.5f, 486.5f);
2579 path.lineTo(34.5f, 678.5f);
2580 path.cubicTo(34.5f, 680.709167f, 32.709137f, 682.5f, 30.5f, 682.5f);
2581 path.lineTo(-4.4408921e-016f, 682.5f);
2582 path.lineTo(-4.41868766e-016f, 681.5f);
2583 path.lineTo(30.5f, 681.5f);
2584 path.cubicTo(32.1568565f, 681.5f, 33.5f, 680.15686f, 33.5f, 678.5f);
2585 path.lineTo(33.5f, 486.5f);
2586 path.cubicTo(33.5f, 484.84314f, 32.1568565f, 483.5f, 30.5f, 483.5f);
2587 path.lineTo(-2.220446e-018f, 483.5f);
2588 path.close();
2589 SkPath pathB;
2590 pathB.setFillType(SkPath::kWinding_FillType);
2591 pathB.moveTo(0, 482);
2592 pathB.lineTo(35, 482);
2593 pathB.lineTo(35, 683);
2594 pathB.lineTo(0, 683);
2595 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002596 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002597}
2598
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002599static void skpadventistmission_org572(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002600 SkPath path;
2601 path.setFillType(SkPath::kEvenOdd_FillType);
2602 path.moveTo(1182.00037f, 926);
2603 path.cubicTo(1181.08813f, 924.785583f, 1179.63586f, 924, 1178, 924);
2604 path.lineTo(938, 924);
2605 path.cubicTo(936.364197f, 924, 934.911865f, 924.785583f, 933.999634f, 926);
2606 path.lineTo(1182.00037f, 926);
2607 path.close();
2608 SkPath pathB;
2609 pathB.setFillType(SkPath::kWinding_FillType);
2610 pathB.moveTo(934, 924);
2611 pathB.lineTo(1182, 924);
2612 pathB.lineTo(1182, 926);
2613 pathB.lineTo(934, 926);
2614 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002615 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002616}
2617
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002618static void skpagentxsites_com55(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002619 SkPath path;
2620 path.setFillType(SkPath::kEvenOdd_FillType);
2621 path.moveTo(925, 27);
2622 path.cubicTo(924.447693f, 27, 924, 27.4477158f, 924, 28);
2623 path.lineTo(924, 55);
2624 path.cubicTo(924, 55.5522842f, 924.447693f, 56, 925, 56);
2625 path.lineTo(1103, 56);
2626 path.cubicTo(1103.55225f, 56, 1104, 55.5522842f, 1104, 55);
2627 path.lineTo(1104, 28);
2628 path.cubicTo(1104, 27.4477158f, 1103.55225f, 27, 1103, 27);
2629 path.lineTo(925, 27);
2630 path.close();
2631 SkPath pathB;
2632 pathB.setFillType(SkPath::kWinding_FillType);
2633 pathB.moveTo(1103, 27);
2634 pathB.cubicTo(1104.10461f, 27, 1105, 27.8954315f, 1105, 29);
2635 pathB.lineTo(1105, 54);
2636 pathB.cubicTo(1105, 55.1045685f, 1104.10461f, 56, 1103, 56);
2637 pathB.lineTo(926, 56);
2638 pathB.cubicTo(924.895447f, 56, 924, 55.1045685f, 924, 54);
2639 pathB.lineTo(924, 29);
2640 pathB.cubicTo(924, 27.8954315f, 924.895447f, 27, 926, 27);
2641 pathB.lineTo(1103, 27);
2642 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002643 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002644}
2645
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002646static void skpbakosoft_com10(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002647 SkPath path;
2648 path.setFillType(SkPath::kEvenOdd_FillType);
2649 path.moveTo(190, 170);
2650 path.cubicTo(178.9543f, 170, 170, 178.9543f, 170, 190);
2651 path.cubicTo(170, 201.0457f, 178.9543f, 210, 190, 210);
2652 path.lineTo(370, 210);
2653 path.cubicTo(381.045685f, 210, 390, 201.0457f, 390, 190);
2654 path.cubicTo(390, 178.9543f, 381.045685f, 170, 370, 170);
2655 path.lineTo(190, 170);
2656 path.close();
2657 SkPath pathB;
2658 pathB.setFillType(SkPath::kWinding_FillType);
2659 pathB.moveTo(210, 190);
2660 pathB.quadTo(210, 198.284271f, 204.142136f, 204.142136f);
2661 pathB.quadTo(198.284271f, 210, 190, 210);
2662 pathB.quadTo(181.715729f, 210, 175.857864f, 204.142136f);
2663 pathB.quadTo(170, 198.284271f, 170, 190);
2664 pathB.quadTo(170, 181.715729f, 175.857864f, 175.857864f);
2665 pathB.quadTo(181.715729f, 170, 190, 170);
2666 pathB.quadTo(198.284271f, 170, 204.142136f, 175.857864f);
2667 pathB.quadTo(210, 181.715729f, 210, 190);
2668 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002669 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002670}
2671
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002672static void skpbambootheme_com12(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002673 SkPath path;
2674 path.setFillType(SkPath::kEvenOdd_FillType);
2675 path.moveTo(47.8780937f, 58);
2676 path.lineTo(0, 58);
2677 path.lineTo(-8.65973959e-015f, 96.9914017f);
2678 path.quadTo(20.0654926f, 96.6451874f, 34.3553391f, 82.3553391f);
2679 path.quadTo(44.9466133f, 71.764061f, 47.8780937f, 58);
2680 path.close();
2681 SkPath pathB;
2682 pathB.setFillType(SkPath::kEvenOdd_FillType);
2683 pathB.moveTo(-1, -3);
2684 pathB.lineTo(-1, -3);
2685 pathB.cubicTo(26.6142502f, -3, 49, 19.3857498f, 49, 47);
2686 pathB.lineTo(49, 47);
2687 pathB.cubicTo(49, 74.6142502f, 26.6142502f, 97, -1, 97);
2688 pathB.lineTo(-1, 97);
2689 pathB.cubicTo(-28.6142502f, 97, -51, 74.6142502f, -51, 47);
2690 pathB.lineTo(-51, 47);
2691 pathB.cubicTo(-51, 19.3857498f, -28.6142502f, -3, -1, -3);
2692 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002693 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002694}
2695
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002696static void skpakmmos_ru100(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002697 SkPath path;
2698 path.setFillType(SkPath::kEvenOdd_FillType);
2699 path.moveTo(693.000488f, 926);
2700 path.cubicTo(692.164734f, 925.37207f, 691.125793f, 925, 690, 925);
2701 path.lineTo(578, 925);
2702 path.cubicTo(576.874207f, 925, 575.835266f, 925.37207f, 574.999512f, 926);
2703 path.lineTo(693.000488f, 926);
2704 path.close();
2705 SkPath pathB;
2706 pathB.setFillType(SkPath::kWinding_FillType);
2707 pathB.moveTo(575, 925);
2708 pathB.lineTo(693, 925);
2709 pathB.lineTo(693, 926);
2710 pathB.lineTo(575, 926);
2711 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002712 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002713}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002714
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002715static void skpcarpetplanet_ru22(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002716 SkPath path;
2717 path.setFillType(SkPath::kEvenOdd_FillType);
2718 path.moveTo(195, 785);
2719 path.cubicTo(124.307556f, 785, 67, 841.859863f, 67, 912);
2720 path.lineTo(67, 913);
2721 path.cubicTo(67, 917.388916f, 67.2243805f, 921.725769f, 67.662384f, 926);
2722 path.lineTo(322, 926);
2723 path.lineTo(322, 896.048035f);
2724 path.cubicTo(314.09201f, 833.437622f, 260.247131f, 785, 195, 785);
2725 path.close();
2726 SkPath pathB;
2727 pathB.setFillType(SkPath::kWinding_FillType);
2728 pathB.moveTo(195, 785);
2729 pathB.cubicTo(265.140167f, 785, 322, 842.307556f, 322, 913);
2730 pathB.cubicTo(322, 983.692444f, 265.140167f, 1041, 195, 1041);
2731 pathB.lineTo(194, 1041);
2732 pathB.cubicTo(123.85984f, 1041, 67, 983.692444f, 67, 913);
2733 pathB.cubicTo(67, 842.307556f, 123.85984f, 785, 194, 785);
2734 pathB.lineTo(195, 785);
2735 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002736 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002737}
2738
caryclark@google.coma2bbc6e2013-11-01 17:36:03 +00002739#define SKPS_WORKING 0
2740#if SKPS_WORKING
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002741// this fails because cubic/quad misses an intersection (failure is isolated in c/q int test)
2742static void skpcarrot_is24(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002743 SkPath path;
2744 path.setFillType(SkPath::kEvenOdd_FillType);
2745 path.moveTo(945, 597);
2746 path.quadTo(913.93396f, 597, 891.96698f, 618.96698f);
2747 path.quadTo(870, 640.93396f, 870, 672);
2748 path.quadTo(870, 703.06604f, 891.96698f, 725.03302f);
2749 path.quadTo(913.93396f, 747, 945, 747);
2750 path.quadTo(976.06604f, 747, 998.03302f, 725.03302f);
2751 path.quadTo(1020, 703.06604f, 1020, 672);
2752 path.quadTo(1020, 640.93396f, 998.03302f, 618.96698f);
2753 path.quadTo(976.06604f, 597, 945, 597);
2754 path.close();
2755 SkPath pathB;
2756 pathB.setFillType(SkPath::kWinding_FillType);
2757 pathB.moveTo(945.080994f, 597.161987f);
2758 pathB.cubicTo(903.659973f, 597.161987f, 870.080994f, 630.73999f, 870.080994f, 672.161987f);
2759 pathB.cubicTo(870.080994f, 676.096008f, 870.387024f, 679.957031f, 870.971008f, 683.726013f);
2760 pathB.cubicTo(876.53302f, 719.656006f, 907.593994f, 747.161987f, 945.080994f, 747.161987f);
2761 pathB.cubicTo(982.567993f, 747.161987f, 1013.62903f, 719.656006f, 1019.19104f, 683.726013f);
2762 pathB.cubicTo(1019.77502f, 679.955017f, 1020.08099f, 676.094971f, 1020.08099f, 672.161987f);
2763 pathB.cubicTo(1020.08002f, 630.73999f, 986.502014f, 597.161987f, 945.080994f, 597.161987f);
2764 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002765 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002766}
2767
2768#endif
2769
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002770static void skpbangalorenest_com4(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002771 SkPath path;
2772 path.setFillType(SkPath::kEvenOdd_FillType);
2773 path.moveTo(0, 926);
2774 path.lineTo(0, 0);
2775 path.lineTo(1265, 0);
2776 path.lineTo(1265, 926);
2777 path.lineTo(0, 926);
2778 path.close();
2779 SkPath pathB;
2780 pathB.setFillType(SkPath::kWinding_FillType);
2781 pathB.moveTo(0, 290);
2782 pathB.lineTo(-2.64514972e-014f, 146);
2783 pathB.lineTo(30, 146);
2784 pathB.lineTo(30, 290);
2785 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002786 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002787}
2788
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002789static void skpbenzoteh_ru152(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002790 SkPath path;
2791 path.setFillType(SkPath::kEvenOdd_FillType);
2792 path.moveTo(883, 23);
2793 path.lineTo(883, 0);
2794 path.lineTo(1122.5f, 0);
2795 path.lineTo(1122.5f, 25.2136822f);
2796 path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2797 path.quadTo(1120.07104f, 28, 1118, 28);
2798 path.lineTo(888, 28);
2799 path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2800 path.quadTo(883, 25.0710678f, 883, 23);
2801 path.close();
2802 SkPath pathB;
2803 pathB.setFillType(SkPath::kWinding_FillType);
2804 pathB.moveTo(883, 0);
2805 pathB.lineTo(1123, 0);
2806 pathB.lineTo(1123, 23);
2807 pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2808 pathB.quadTo(1120.07104f, 28, 1118, 28);
2809 pathB.lineTo(888, 28);
2810 pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2811 pathB.quadTo(883, 25.0710678f, 883, 23);
2812 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002813 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002814}
2815
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002816static void skpbestred_ru37(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002817 SkPath path;
2818 path.setFillType(SkPath::kEvenOdd_FillType);
2819 path.moveTo(883, 23);
2820 path.lineTo(883, 0);
2821 path.lineTo(1122.5f, 0);
2822 path.lineTo(1122.5f, 25.2136822f);
2823 path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2824 path.quadTo(1120.07104f, 28, 1118, 28);
2825 path.lineTo(888, 28);
2826 path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2827 path.quadTo(883, 25.0710678f, 883, 23);
2828 path.close();
2829 SkPath pathB;
2830 pathB.setFillType(SkPath::kWinding_FillType);
2831 pathB.moveTo(883, 0);
2832 pathB.lineTo(1123, 0);
2833 pathB.lineTo(1123, 23);
2834 pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2835 pathB.quadTo(1120.07104f, 28, 1118, 28);
2836 pathB.lineTo(888, 28);
2837 pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2838 pathB.quadTo(883, 25.0710678f, 883, 23);
2839 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002840 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002841}
2842
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002843static void skpbingoentertainment_net189(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002844 SkPath path;
2845 path.setFillType(SkPath::kEvenOdd_FillType);
2846 path.moveTo(896, 745.38678f);
2847 path.lineTo(896, 873.38678f);
2848 path.lineTo(922.567993f, 876.683716f);
2849 path.lineTo(922.567993f, 748.683716f);
2850 path.lineTo(896, 745.38678f);
2851 path.close();
2852 SkPath pathB;
2853 pathB.setFillType(SkPath::kWinding_FillType);
2854 pathB.moveTo(899.200928f, 745.783997f);
2855 pathB.cubicTo(897.119385f, 745.525696f, 895.432007f, 752.031982f, 895.432007f, 760.316284f);
2856 pathB.lineTo(895.432007f, 858.316284f);
2857 pathB.cubicTo(895.432007f, 866.600586f, 897.119385f, 873.525696f, 899.200928f, 873.783997f);
2858 pathB.lineTo(918.799133f, 876.216003f);
2859 pathB.cubicTo(920.880615f, 876.474304f, 922.567993f, 869.968018f, 922.567993f, 861.683716f);
2860 pathB.lineTo(922.567993f, 763.683716f);
2861 pathB.cubicTo(922.567993f, 755.399414f, 920.880615f, 748.474304f, 918.799133f, 748.216003f);
2862 pathB.lineTo(899.200928f, 745.783997f);
2863 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002864 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002865}
2866
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002867static void skpcarrefour_ro62(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002868 SkPath path;
2869 path.setFillType(SkPath::kEvenOdd_FillType);
2870 path.moveTo(1104, 453);
2871 path.lineTo(399, 453);
2872 path.lineTo(399, 657);
2873 path.cubicTo(399, 661.970581f, 403.029449f, 666, 408, 666);
2874 path.lineTo(1095, 666);
2875 path.cubicTo(1099.97058f, 666, 1104, 661.970581f, 1104, 657);
2876 path.lineTo(1104, 453);
2877 path.close();
2878 SkPath pathB;
2879 pathB.setFillType(SkPath::kInverseWinding_FillType);
2880 pathB.moveTo(400, 453);
2881 pathB.lineTo(1103, 453);
2882 pathB.lineTo(1103, 666);
2883 pathB.lineTo(406, 666);
2884 pathB.cubicTo(402.686279f, 666, 400, 663.313721f, 400, 660);
2885 pathB.lineTo(400, 453);
2886 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002887 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002888}
2889
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002890static void skpcaffelavazzait_com_ua21(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002891 SkPath path;
2892 path.setFillType(SkPath::kEvenOdd_FillType);
2893 path.moveTo(883, 23);
2894 path.lineTo(883, 0);
2895 path.lineTo(1122.5f, 0);
2896 path.lineTo(1122.5f, 25.2136822f);
2897 path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2898 path.quadTo(1120.07104f, 28, 1118, 28);
2899 path.lineTo(888, 28);
2900 path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2901 path.quadTo(883, 25.0710678f, 883, 23);
2902 path.close();
2903 SkPath pathB;
2904 pathB.setFillType(SkPath::kWinding_FillType);
2905 pathB.moveTo(883, 0);
2906 pathB.lineTo(1123, 0);
2907 pathB.lineTo(1123, 23);
2908 pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2909 pathB.quadTo(1120.07104f, 28, 1118, 28);
2910 pathB.lineTo(888, 28);
2911 pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2912 pathB.quadTo(883, 25.0710678f, 883, 23);
2913 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002914 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002915}
2916
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002917static void skpcamcorder_kz21(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002918 SkPath path;
2919 path.setFillType(SkPath::kEvenOdd_FillType);
2920 path.moveTo(883, 23);
2921 path.lineTo(883, 0);
2922 path.lineTo(1122.5f, 0);
2923 path.lineTo(1122.5f, 25.2136822f);
2924 path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2925 path.quadTo(1120.07104f, 28, 1118, 28);
2926 path.lineTo(888, 28);
2927 path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2928 path.quadTo(883, 25.0710678f, 883, 23);
2929 path.close();
2930 SkPath pathB;
2931 pathB.setFillType(SkPath::kWinding_FillType);
2932 pathB.moveTo(883, 0);
2933 pathB.lineTo(1123, 0);
2934 pathB.lineTo(1123, 23);
2935 pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2936 pathB.quadTo(1120.07104f, 28, 1118, 28);
2937 pathB.lineTo(888, 28);
2938 pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2939 pathB.quadTo(883, 25.0710678f, 883, 23);
2940 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002941 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002942}
2943
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002944static void skpcavablar_net563(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002945 SkPath path;
2946 path.setFillType(SkPath::kEvenOdd_FillType);
2947 path.moveTo(160.000488f, 918);
2948 path.cubicTo(159.164749f, 917.37207f, 158.125824f, 917, 157, 917);
2949 path.lineTo(94, 917);
2950 path.cubicTo(92.874176f, 917, 91.8352661f, 917.37207f, 90.9995193f, 918);
2951 path.lineTo(160.000488f, 918);
2952 path.close();
2953 SkPath pathB;
2954 pathB.setFillType(SkPath::kWinding_FillType);
2955 pathB.moveTo(91, 917);
2956 pathB.lineTo(160, 917);
2957 pathB.lineTo(160, 918);
2958 pathB.lineTo(91, 918);
2959 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002960 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002961}
2962
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002963static void skpinsomnia_gr72(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002964 SkPath path;
2965 path.setFillType(SkPath::kEvenOdd_FillType);
2966 path.moveTo(1138, 231);
2967 path.lineTo(1137, 243.625748f);
2968 path.lineTo(1137, 926);
2969 path.lineTo(1139, 926);
2970 path.lineTo(1139, 231);
2971 path.lineTo(1138, 231);
2972 path.close();
2973 SkPath pathB;
2974 pathB.setFillType(SkPath::kWinding_FillType);
2975 pathB.moveTo(1139, 231);
2976 pathB.lineTo(1138, 231);
2977 pathB.lineTo(633, 6101);
2978 pathB.lineTo(1139, 6607);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002979 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002980}
2981
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002982static void cubicOp95u(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002983 SkPath path, pathB;
2984 path.setFillType(SkPath::kEvenOdd_FillType);
2985 path.moveTo(0, 2);
2986 path.cubicTo(2, 3, 5, 1, 3, 2);
2987 path.close();
2988 pathB.setFillType(SkPath::kEvenOdd_FillType);
2989 pathB.moveTo(1, 5);
2990 pathB.cubicTo(2, 3, 2, 0, 3, 2);
2991 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002992 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002993}
2994
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002995static void cubicOp96d(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002996 SkPath path, pathB;
2997 path.setFillType(SkPath::kEvenOdd_FillType);
2998 path.moveTo(1, 6);
2999 path.cubicTo(0, 3, 6, 3, 5, 0);
3000 path.close();
3001 pathB.setFillType(SkPath::kEvenOdd_FillType);
3002 pathB.moveTo(3, 6);
3003 pathB.cubicTo(0, 5, 6, 1, 3, 0);
3004 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003005 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00003006}
3007
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003008static void cubicOp97x(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comf54ad6f2013-11-02 07:02:02 +00003009 SkPath path, pathB;
3010 path.setFillType(SkPath::kEvenOdd_FillType);
3011 path.moveTo(0, 2);
3012 path.cubicTo(0, 6, 2, 1, 2, 1);
3013 path.close();
3014 pathB.setFillType(SkPath::kEvenOdd_FillType);
3015 pathB.moveTo(1, 2);
3016 pathB.cubicTo(1, 2, 2, 0, 6, 0);
3017 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003018 testPathOp(reporter, path, pathB, kXOR_PathOp, filename);
caryclark@google.coma2bbc6e2013-11-01 17:36:03 +00003019}
3020
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003021static void cubicOp98x(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comf54ad6f2013-11-02 07:02:02 +00003022 SkPath path, pathB;
3023 path.setFillType(SkPath::kEvenOdd_FillType);
3024 path.moveTo(0, 3);
3025 path.cubicTo(3, 6, 4, 1, 6, 3);
3026 path.close();
3027 pathB.setFillType(SkPath::kEvenOdd_FillType);
3028 pathB.moveTo(1, 4);
3029 pathB.cubicTo(3, 6, 3, 0, 6, 3);
3030 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003031 testPathOp(reporter, path, pathB, kXOR_PathOp, filename);
caryclark@google.coma2bbc6e2013-11-01 17:36:03 +00003032}
3033
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003034static void cubicOp99(skiatest::Reporter* reporter, const char* filename) {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +00003035 SkPath path, pathB;
3036 path.setFillType(SkPath::kWinding_FillType);
3037 path.moveTo(3,6);
3038 path.cubicTo(0,3, 6,5, 5,4);
3039 path.close();
3040 pathB.setFillType(SkPath::kWinding_FillType);
3041 pathB.moveTo(5,6);
3042 pathB.cubicTo(4,5, 6,3, 3,0);
3043 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003044 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +00003045}
3046
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003047static void cubicOp100(skiatest::Reporter* reporter, const char* filename) {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +00003048 SkPath path, pathB;
3049 path.setFillType(SkPath::kWinding_FillType);
3050 path.moveTo(0,1);
3051 path.cubicTo(0,2, 2,1, 4,2);
3052 path.close();
3053 pathB.setFillType(SkPath::kWinding_FillType);
3054 pathB.moveTo(1,2);
3055 pathB.cubicTo(2,4, 1,0, 2,0);
3056 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003057 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +00003058}
3059
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003060static void cubicOp101(skiatest::Reporter* reporter, const char* filename) {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +00003061 SkPath path, pathB;
3062 path.setFillType(SkPath::kWinding_FillType);
3063 path.moveTo(0, 1);
3064 path.cubicTo(2, 3, 2, 1, 5, 3);
3065 path.close();
3066 pathB.setFillType(SkPath::kWinding_FillType);
3067 pathB.moveTo(1, 2);
3068 pathB.cubicTo(3, 5, 1, 0, 3, 2);
3069 pathB.close();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003070 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +00003071}
3072
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003073static void cubicOp102(skiatest::Reporter* reporter, const char* filename) {
3074 SkPath path, pathB;
3075 path.setFillType(SkPath::kWinding_FillType);
3076 path.moveTo(0,1);
3077 path.cubicTo(1,2, 1,0, 3,0);
3078 path.close();
3079 pathB.setFillType(SkPath::kWinding_FillType);
3080 pathB.moveTo(0,1);
3081 pathB.cubicTo(0,3, 1,0, 2,1);
3082 pathB.close();
3083 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3084}
3085
3086static void cubicOp103(skiatest::Reporter* reporter, const char* filename) {
3087 SkPath path, pathB;
3088 path.setFillType(SkPath::kWinding_FillType);
3089 path.moveTo(0,1);
3090 path.cubicTo(1,5, 2,0, 2,1);
3091 path.close();
3092 pathB.setFillType(SkPath::kWinding_FillType);
3093 pathB.moveTo(0,2);
3094 pathB.cubicTo(1,2, 1,0, 5,1);
3095 pathB.close();
3096 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3097}
3098
3099static void cubicOp104(skiatest::Reporter* reporter, const char* filename) {
3100 SkPath path, pathB;
3101 path.setFillType(SkPath::kWinding_FillType);
3102 path.moveTo(0,1);
3103 path.cubicTo(0,6, 4,0, 6,1);
3104 path.close();
3105 pathB.setFillType(SkPath::kWinding_FillType);
3106 pathB.moveTo(0,4);
3107 pathB.cubicTo(1,6, 1,0, 6,0);
3108 pathB.close();
3109 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3110}
3111
3112static void cubicOp105(skiatest::Reporter* reporter, const char* filename) {
3113 SkPath path, pathB;
3114 path.setFillType(SkPath::kWinding_FillType);
3115 path.moveTo(0,1);
3116 path.cubicTo(0,4, 6,5, 2,0);
3117 path.close();
3118 pathB.setFillType(SkPath::kWinding_FillType);
3119 pathB.moveTo(5,6);
3120 pathB.cubicTo(0,2, 1,0, 4,0);
3121 pathB.close();
3122 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3123}
3124
3125static void cubicOp106(skiatest::Reporter* reporter, const char* filename) {
3126 SkPath path, pathB;
3127 path.setFillType(SkPath::kWinding_FillType);
3128 path.moveTo(0, 1);
3129 path.cubicTo(4, 6, 2, 1, 2, 0);
3130 path.close();
3131 pathB.setFillType(SkPath::kWinding_FillType);
3132 pathB.moveTo(1, 2);
3133 pathB.cubicTo(0, 2, 1, 0, 6, 4);
3134 pathB.close();
3135 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3136}
3137
3138static void cubicOp107(skiatest::Reporter* reporter, const char* filename) {
3139 SkPath path, pathB;
3140 path.setFillType(SkPath::kWinding_FillType);
3141 path.moveTo(0, 1);
3142 path.cubicTo(4, 6, 2, 1, 2, 0);
3143 path.close();
3144 pathB.setFillType(SkPath::kWinding_FillType);
3145 pathB.moveTo(1, 2);
3146 pathB.cubicTo(0, 2, 1, 0, 6, 4);
3147 pathB.close();
3148 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3149}
3150
3151static void cubicOp108(skiatest::Reporter* reporter, const char* filename) {
3152 SkPath path, pathB;
3153 path.setFillType(SkPath::kWinding_FillType);
3154 path.moveTo(0, 1);
3155 path.cubicTo(4, 6, 2, 1, 2, 0);
3156 path.close();
3157 pathB.setFillType(SkPath::kWinding_FillType);
3158 pathB.moveTo(1, 2);
3159 pathB.cubicTo(0, 2, 1, 0, 6, 4);
3160 pathB.close();
3161 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
3162}
3163
3164static void cubicOp109(skiatest::Reporter* reporter, const char* filename) {
3165 SkPath path, pathB;
3166 path.setFillType(SkPath::kWinding_FillType);
3167 path.moveTo(0,1);
3168 path.cubicTo(4,5, 6,3, 5,4);
3169 path.close();
3170 pathB.setFillType(SkPath::kWinding_FillType);
3171 pathB.moveTo(3,6);
3172 pathB.cubicTo(4,5, 1,0, 5,4);
3173 pathB.close();
3174 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3175}
3176
3177static void cubicOp110(skiatest::Reporter* reporter, const char* filename) {
3178 SkPath path, pathB;
3179 path.setFillType(SkPath::kEvenOdd_FillType);
3180 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
3181 path.addRect(0, 0, 4, 4, SkPath::kCW_Direction);
3182 pathB.setFillType(SkPath::kEvenOdd_FillType);
3183 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3184 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3185 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3186}
3187
3188static void cubicOp111(skiatest::Reporter* reporter, const char* filename) {
3189 SkPath path, pathB;
3190 path.setFillType(SkPath::kWinding_FillType);
3191 path.moveTo(1,4);
3192 path.cubicTo(0,5, 4,1, 3,1);
3193 path.close();
3194 pathB.setFillType(SkPath::kWinding_FillType);
3195 pathB.moveTo(1,4);
3196 pathB.cubicTo(1,3, 4,1, 5,0);
3197 pathB.close();
3198 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3199}
3200
3201static void xOp1u(skiatest::Reporter* reporter, const char* filename) {
3202 SkPath path, pathB;
3203 path.setFillType(SkPath::kEvenOdd_FillType);
3204 path.moveTo(1, 4);
3205 path.cubicTo(4, 5, 3, 2, 6, 3);
3206 path.close();
3207 pathB.setFillType(SkPath::kEvenOdd_FillType);
3208 pathB.moveTo(2, 3);
3209 pathB.cubicTo(3, 6, 4, 1, 5, 4);
3210 pathB.close();
3211 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
3212}
3213
3214static void xOp1i(skiatest::Reporter* reporter, const char* filename) {
3215 SkPath path, pathB;
3216 path.setFillType(SkPath::kEvenOdd_FillType);
3217 path.moveTo(1, 4);
3218 path.cubicTo(1, 5, 6, 0, 5, 1);
3219 path.close();
3220 pathB.setFillType(SkPath::kEvenOdd_FillType);
3221 pathB.moveTo(0, 6);
3222 pathB.cubicTo(1, 5, 4, 1, 5, 1);
3223 pathB.close();
3224 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3225}
3226
3227static void xOp2i(skiatest::Reporter* reporter, const char* filename) {
3228 SkPath path, pathB;
3229 path.setFillType(SkPath::kEvenOdd_FillType);
3230 path.moveTo(1, 5);
3231 path.cubicTo(0, 4, 3, 2, 6, 1);
3232 path.close();
3233 pathB.setFillType(SkPath::kEvenOdd_FillType);
3234 pathB.moveTo(2, 3);
3235 pathB.cubicTo(1, 6, 5, 1, 4, 0);
3236 pathB.close();
3237 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3238}
3239
3240static void xOp3i(skiatest::Reporter* reporter, const char* filename) {
3241 SkPath path, pathB;
3242 path.setFillType(SkPath::kWinding_FillType);
3243 path.moveTo(1,4);
3244 path.cubicTo(0,5, 4,1, 3,1);
3245 path.close();
3246 pathB.setFillType(SkPath::kWinding_FillType);
3247 pathB.moveTo(1,4);
3248 pathB.cubicTo(1,3, 4,1, 5,0);
3249 pathB.close();
3250 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3251}
3252
3253static void findFirst1(skiatest::Reporter* reporter, const char* filename) {
3254 SkPath path, pathB;
3255 path.setFillType(SkPath::kWinding_FillType);
3256 path.moveTo(0,1);
3257 path.cubicTo(1,6, 5,0, 2,1);
3258 path.close();
3259 pathB.setFillType(SkPath::kWinding_FillType);
3260 pathB.moveTo(0,5);
3261 pathB.cubicTo(1,2, 1,0, 6,1);
3262 pathB.close();
3263 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3264}
3265
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00003266// triggers addSimpleAngle with non-zero argument
3267static void cubicOp112(skiatest::Reporter* reporter, const char* filename) {
3268 SkPath path, pathB;
3269 path.setFillType(SkPath::kWinding_FillType);
3270 path.moveTo(2,4);
3271 path.cubicTo(2,3, 6,4, 1,0);
3272 path.close();
3273 pathB.setFillType(SkPath::kWinding_FillType);
3274 pathB.moveTo(4,6);
3275 pathB.cubicTo(0,1, 4,2, 3,2);
3276 pathB.close();
3277 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3278}
3279
3280// triggers untested calcLoopSpanCount code path
3281#if 0
3282static void cubicOp113(skiatest::Reporter* reporter, const char* filename) {
3283 SkPath path, pathB;
3284 path.moveTo(2,4);
3285 path.cubicTo(3,5, 2.33333325f,4.33333349f, 3.83333325f,3.83333349f);
3286 path.close();
3287 pathB.moveTo(3,5);
3288 pathB.cubicTo(2.33333325f,4.33333349f, 3.83333325f,3.83333349f, 2,4);
3289 pathB.close();
3290 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3291}
3292#endif
3293
3294static void cubicOp114(skiatest::Reporter* reporter, const char* filename) {
3295 SkPath path, pathB;
3296 path.setFillType(SkPath::kWinding_FillType);
3297 path.moveTo(0, 1);
3298 path.cubicTo(1, 3, -1, 2, 3.5f, 1.33333337f);
3299 path.close();
3300 pathB.setFillType(SkPath::kWinding_FillType);
3301 pathB.moveTo(1, 3);
3302 pathB.cubicTo(-1, 2, 3.5f, 1.33333337f, 0, 1);
3303 pathB.close();
3304 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3305}
3306
3307static void quadOp10i(skiatest::Reporter* reporter, const char* filename) {
3308 SkPath path, pathB;
3309 path.moveTo(0, 0);
3310 path.quadTo(1, 8, 3, 5);
3311 path.lineTo(8, 1);
3312 path.close();
3313 pathB.moveTo(0, 0);
3314 pathB.quadTo(8, 1, 4, 8);
3315 pathB.close();
3316 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3317}
3318
commit-bot@chromium.org91fc81c2014-04-30 13:37:48 +00003319static void kari1(skiatest::Reporter* reporter, const char* filename) {
3320 SkPath path1;
3321 path1.moveTo(39.9375, -5.8359375);
3322 path1.lineTo(40.625, -5.7890625);
3323 path1.lineTo(37.7109375, 1.3515625);
3324 path1.lineTo(37.203125, 0.9609375);
3325 path1.close();
3326
3327 SkPath path2;
3328 path2.moveTo(37.52734375f, -1.44140625f);
3329 path2.cubicTo(37.8736991882324f, -1.69921875f, 38.1640625f, -2.140625f, 38.3984375f, -2.765625f);
3330 path2.lineTo(38.640625f, -2.609375f);
3331 path2.cubicTo(38.53125f, -1.89583337306976f, 38.0664443969727f, -0.154893040657043f, 38.0664443969727f, -0.154893040657043f);
3332 path2.cubicTo(38.0664443969727f, -0.154893040657043f, 37.1809883117676f, -1.18359375f, 37.52734375, -1.44140625f);
3333 path2.close();
3334
3335 testPathOp(reporter, path1, path2, kDifference_PathOp, filename);
3336}
3337
commit-bot@chromium.org2db7fe72014-05-07 15:31:40 +00003338static void issue2504(skiatest::Reporter* reporter, const char* filename) {
3339 SkPath path1;
3340 path1.moveTo(34.2421875, -5.976562976837158203125);
3341 path1.lineTo(35.453121185302734375, 0);
3342 path1.lineTo(31.9375, 0);
3343 path1.close();
3344
3345 SkPath path2;
3346 path2.moveTo(36.71843719482421875, 0.8886508941650390625);
3347 path2.cubicTo(36.71843719482421875, 0.8886508941650390625,
3348 35.123386383056640625, 0.554015457630157470703125,
3349 34.511409759521484375, -0.1152553558349609375);
3350 path2.cubicTo(33.899425506591796875, -0.7845261096954345703125,
3351 34.53484344482421875, -5.6777553558349609375,
3352 34.53484344482421875, -5.6777553558349609375);
3353 path2.close();
3354 testPathOp(reporter, path1, path2, kUnion_PathOp, filename);
3355}
3356
caryclarkdac1d172014-06-17 05:15:38 -07003357#define TEST_2540 0
3358#if TEST_2540 // FIXME: extends cubic arm for sorting, marks extension with wrong winding?
3359static void issue2540(skiatest::Reporter* reporter, const char* filename) {
3360 SkPath path1;
3361 path1.moveTo(26.5054988861083984375, 85.73960113525390625);
3362 path1.cubicTo(84.19739532470703125, 17.77140045166015625, 16.93920135498046875, 101.86199951171875, 12.631000518798828125, 105.24700164794921875);
3363 path1.cubicTo(11.0819997787475585937500000, 106.46399688720703125, 11.5260000228881835937500000, 104.464996337890625, 11.5260000228881835937500000, 104.464996337890625);
3364 path1.lineTo(23.1654987335205078125, 89.72879791259765625);
3365 path1.cubicTo(23.1654987335205078125, 89.72879791259765625, -10.1713008880615234375, 119.9160003662109375, -17.1620006561279296875, 120.8249969482421875);
3366 path1.cubicTo(-19.1149997711181640625, 121.07900238037109375, -18.0380001068115234375, 119.79299163818359375, -18.0380001068115234375, 119.79299163818359375);
3367 path1.cubicTo(-18.0380001068115234375, 119.79299163818359375, 14.22100067138671875, 90.60700225830078125, 26.5054988861083984375, 85.73960113525390625);
3368 path1.close();
3369
3370 SkPath path2;
3371 path2.moveTo(-25.077999114990234375, 124.9120025634765625);
3372 path2.cubicTo(-25.077999114990234375, 124.9120025634765625, -25.9509983062744140625, 125.95400238037109375, -24.368999481201171875, 125.7480010986328125);
3373 path2.cubicTo(-16.06999969482421875, 124.66899871826171875, 1.2680000066757202148437500, 91.23999786376953125, 37.264003753662109375, 95.35400390625);
3374 path2.cubicTo(37.264003753662109375, 95.35400390625, 11.3710002899169921875, 83.7339935302734375, -25.077999114990234375, 124.9120025634765625);
3375 path2.close();
3376 testPathOp(reporter, path1, path2, kUnion_PathOp, filename);
3377}
3378#endif
3379
3380static void rects1(skiatest::Reporter* reporter, const char* filename) {
3381 SkPath path, pathB;
3382 path.setFillType(SkPath::kEvenOdd_FillType);
3383 path.moveTo(0, 0);
3384 path.lineTo(1, 0);
3385 path.lineTo(1, 1);
3386 path.lineTo(0, 1);
3387 path.close();
3388 path.moveTo(0, 0);
3389 path.lineTo(6, 0);
3390 path.lineTo(6, 6);
3391 path.lineTo(0, 6);
3392 path.close();
3393 pathB.setFillType(SkPath::kEvenOdd_FillType);
3394 pathB.moveTo(0, 0);
3395 pathB.lineTo(1, 0);
3396 pathB.lineTo(1, 1);
3397 pathB.lineTo(0, 1);
3398 pathB.close();
3399 pathB.moveTo(0, 0);
3400 pathB.lineTo(2, 0);
3401 pathB.lineTo(2, 2);
3402 pathB.lineTo(0, 2);
3403 pathB.close();
3404 testPathOp(reporter, path, pathB, kUnion_PathOp, filename);
3405}
3406
3407static void rects2(skiatest::Reporter* reporter, const char* filename) {
3408 SkPath path, pathB;
3409 path.setFillType(SkPath::kEvenOdd_FillType);
3410 path.moveTo(0, 0);
3411 path.lineTo(4, 0);
3412 path.lineTo(4, 4);
3413 path.lineTo(0, 4);
3414 path.close();
3415 path.moveTo(3, 3);
3416 path.lineTo(4, 3);
3417 path.lineTo(4, 4);
3418 path.lineTo(3, 4);
3419 path.close();
3420 pathB.setFillType(SkPath::kWinding_FillType);
3421 pathB.moveTo(3, 3);
3422 pathB.lineTo(6, 3);
3423 pathB.lineTo(6, 6);
3424 pathB.lineTo(3, 6);
3425 pathB.close();
3426 pathB.moveTo(3, 3);
3427 pathB.lineTo(4, 3);
3428 pathB.lineTo(4, 4);
3429 pathB.lineTo(3, 4);
3430 pathB.close();
3431 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3432}
3433
3434static void rects3(skiatest::Reporter* reporter, const char* filename) {
3435 SkPath path, pathB;
3436 path.setFillType(SkPath::kEvenOdd_FillType);
3437 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
3438 path.addRect(0, 0, 4, 4, SkPath::kCW_Direction);
3439 pathB.setFillType(SkPath::kWinding_FillType);
3440 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3441 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3442 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3443}
3444
3445static void rects4(skiatest::Reporter* reporter, const char* filename) {
3446 SkPath path, pathB;
3447 path.setFillType(SkPath::kEvenOdd_FillType);
3448 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
3449 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3450 pathB.setFillType(SkPath::kWinding_FillType);
3451 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3452 pathB.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
3453 testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
3454}
3455
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003456static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0;
3457static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0;
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003458
3459static struct TestDesc tests[] = {
caryclarkdac1d172014-06-17 05:15:38 -07003460 TEST(rects4),
3461 TEST(rects3),
3462 TEST(rects2),
3463 TEST(rects1),
3464#if TEST_2540 // FIXME: extends cubic arm for sorting, marks extension with wrong winding?
3465 TEST(issue2540),
3466#endif
commit-bot@chromium.org2db7fe72014-05-07 15:31:40 +00003467 TEST(issue2504),
commit-bot@chromium.org91fc81c2014-04-30 13:37:48 +00003468 TEST(kari1),
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00003469 TEST(quadOp10i),
3470#if 0 // FIXME: serpentine curve is ordered the wrong way
3471 TEST(cubicOp114),
3472#endif
3473#if 0 // FIXME: currently failing
3474 TEST(cubicOp113),
3475#endif
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00003476#if SKPS_WORKING
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003477 // fails because a cubic/quadratic intersection is missed
3478 // 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 +00003479 TEST(skpcarrot_is24),
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00003480#endif
3481#if ISSUE_1417_WORKING_ON_LINUX_32
3482 TEST(issue1417),
3483#endif
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00003484 TEST(cubicOp112),
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003485 TEST(skpadspert_net23),
3486 TEST(skpadspert_de11),
3487 TEST(findFirst1),
3488 TEST(xOp2i),
3489 TEST(xOp3i),
3490 TEST(xOp1u),
3491 TEST(xOp1i),
3492 TEST(cubicOp111),
3493 TEST(cubicOp110),
3494 TEST(cubicOp109),
3495 TEST(cubicOp108),
3496 TEST(cubicOp107),
3497 TEST(cubicOp106),
3498 TEST(cubicOp105),
3499 TEST(cubicOp104),
3500 TEST(cubicOp103),
3501 TEST(cubicOp102),
3502 TEST(cubicOp101),
3503 TEST(cubicOp100),
3504 TEST(cubicOp99),
caryclarkdac1d172014-06-17 05:15:38 -07003505#if ISSUE_1435_FIXED
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003506 TEST(issue1435),
caryclarkdac1d172014-06-17 05:15:38 -07003507#endif
caryclark@google.coma2bbc6e2013-11-01 17:36:03 +00003508 TEST(cubicOp98x),
3509 TEST(cubicOp97x),
3510 TEST(skpcarpetplanet_ru22), // cubic/cubic intersect detects unwanted coincidence
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00003511 TEST(cubicOp96d),
3512 TEST(cubicOp95u),
3513 TEST(skpadbox_lt15),
3514 TEST(skpagentxsites_com55),
3515 TEST(skpadventistmission_org572),
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00003516 TEST(skpadoption_org196),
3517 TEST(skpbambootheme_com12),
3518 TEST(skpbakosoft_com10),
3519 TEST(skpakmmos_ru100),
3520 TEST(skpbangalorenest_com4),
3521 TEST(skpbingoentertainment_net189),
3522 TEST(skpbestred_ru37),
3523 TEST(skpbenzoteh_ru152),
3524 TEST(skpcamcorder_kz21),
3525 TEST(skpcaffelavazzait_com_ua21),
3526 TEST(skpcarrefour_ro62),
3527 TEST(skpcavablar_net563),
3528 TEST(skpinsomnia_gr72),
3529 TEST(skpadbox_lt8),
3530 TEST(skpact_com43),
3531 TEST(skpacesoftech_com47),
3532 TEST(skpabcspark_ca103),
3533 TEST(cubicOp94u),
3534 TEST(cubicOp93d),
3535 TEST(cubicOp92i),
3536 TEST(skpadithya_putr4_blogspot_com551),
3537 TEST(skpadindex_de4),
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00003538 TEST(skpaiaigames_com870),
3539 TEST(skpaaalgarve_org53),
3540 TEST(skpkkiste_to716),
caryclark@google.com570863f2013-09-16 15:55:01 +00003541 TEST(cubicOp91u),
3542 TEST(cubicOp90u),
3543 TEST(cubicOp89u),
3544 TEST(cubicOp88u),
3545 TEST(cubicOp87u),
3546 TEST(cubicOp86i),
3547 TEST(loopEdge2),
3548 TEST(loopEdge1),
3549 TEST(rectOp3x),
3550 TEST(rectOp2i),
3551 TEST(rectOp1i),
3552 TEST(issue1418b),
caryclark@google.com4fdbb222013-07-23 15:27:41 +00003553 TEST(cubicOp85i),
caryclark@google.com4fdbb222013-07-23 15:27:41 +00003554 TEST(issue1418),
3555 TEST(skpkkiste_to98),
caryclark@google.comfa2aeee2013-07-15 13:29:13 +00003556 TEST(skpahrefs_com29),
3557 TEST(cubicOp85d),
3558 TEST(skpahrefs_com88),
caryclark@google.com07e97fc2013-07-08 17:17:02 +00003559 TEST(skphealth_com76),
3560 TEST(skpancestry_com1),
3561 TEST(skpbyte_com1),
3562 TEST(skpeldorado_com_ua1),
3563 TEST(skp96prezzi1),
caryclark@google.comcffbcc32013-06-04 17:59:42 +00003564 TEST(skpClip2),
caryclark@google.comcffbcc32013-06-04 17:59:42 +00003565 TEST(skpClip1),
3566 TEST(cubicOp84d),
3567 TEST(cubicOp83i),
reed@google.com277c3f82013-05-31 15:17:50 +00003568 TEST(cubicOp82i),
3569 TEST(cubicOp81d),
3570 TEST(cubicOp80i),
3571 TEST(cubicOp79u),
reed@google.com277c3f82013-05-31 15:17:50 +00003572 TEST(cubicOp78u),
3573 TEST(cubicOp77i),
caryclark@google.comcffbcc32013-06-04 17:59:42 +00003574 TEST(cubicOp76u),
reed@google.com277c3f82013-05-31 15:17:50 +00003575 TEST(cubicOp75d),
caryclark@google.comcffbcc32013-06-04 17:59:42 +00003576 TEST(cubicOp74d),
reed@google.com277c3f82013-05-31 15:17:50 +00003577 TEST(cubicOp73d),
3578 TEST(cubicOp72i),
3579 TEST(cubicOp71d),
caryclark@google.coma5e55922013-05-07 18:51:31 +00003580 TEST(skp5),
3581 TEST(skp4),
3582 TEST(skp3),
3583 TEST(skp2),
3584 TEST(skp1),
caryclark@google.com6dc7df62013-04-25 11:51:54 +00003585 TEST(rRect1),
caryclark@google.coma5e55922013-05-07 18:51:31 +00003586 TEST(cubicOp70d),
caryclark@google.com03610322013-04-18 15:58:21 +00003587 TEST(cubicOp69d),
3588 TEST(cubicOp68u),
caryclark@google.comb3f09212013-04-17 15:49:16 +00003589 TEST(cubicOp67u),
3590 TEST(cubicOp66u),
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003591 TEST(rectOp1d),
3592 TEST(cubicOp65d),
3593 TEST(cubicOp64d),
3594 TEST(cubicOp63d),
3595 TEST(cubicOp62d),
3596 TEST(cubicOp61d),
3597 TEST(cubicOp60d),
3598 TEST(cubicOp59d),
3599 TEST(cubicOp58d),
3600 TEST(cubicOp57d),
3601 TEST(cubicOp56d),
3602 TEST(cubicOp55d),
3603 TEST(cubicOp54d),
3604 TEST(cubicOp53d),
3605 TEST(cubicOp52d),
3606 TEST(cubicOp51d),
3607 TEST(cubicOp50d),
3608 TEST(cubicOp49d),
3609 TEST(cubicOp48d),
3610 TEST(cubicOp47d),
3611 TEST(cubicOp46d),
3612 TEST(cubicOp45d),
3613 TEST(cubicOp44d),
3614 TEST(cubicOp43d),
3615 TEST(cubicOp42d),
3616 TEST(cubicOp41i),
3617 TEST(cubicOp40d),
3618 TEST(cubicOp39d),
3619 TEST(cubicOp38d),
3620 TEST(cubicOp37d),
3621 TEST(cubicOp36u),
3622 TEST(cubicOp35d),
3623 TEST(cubicOp34d),
3624 TEST(cubicOp33i),
3625 TEST(cubicOp32d),
3626 TEST(cubicOp31d),
3627 TEST(cubicOp31x),
3628 TEST(cubicOp31u),
3629 TEST(cubicOp30d),
3630 TEST(cubicOp29d),
3631 TEST(cubicOp28u),
3632 TEST(cubicOp27d),
3633 TEST(cubicOp26d),
3634 TEST(cubicOp25i),
3635 TEST(testOp8d),
3636 TEST(testDiff1),
3637 TEST(testIntersect1),
3638 TEST(testUnion1),
3639 TEST(testXor1),
3640 TEST(testDiff2),
3641 TEST(testIntersect2),
3642 TEST(testUnion2),
3643 TEST(testXor2),
3644 TEST(testOp1d),
3645 TEST(testOp2d),
3646 TEST(testOp3d),
3647 TEST(testOp1u),
3648 TEST(testOp4d),
3649 TEST(testOp5d),
3650 TEST(testOp6d),
3651 TEST(testOp7d),
3652 TEST(testOp2u),
3653
3654 TEST(cubicOp24d),
3655 TEST(cubicOp23d),
3656 TEST(cubicOp22d),
3657 TEST(cubicOp21d),
3658 TEST(cubicOp20d),
3659 TEST(cubicOp19i),
3660 TEST(cubicOp18d),
3661 TEST(cubicOp17d),
3662 TEST(cubicOp16d),
3663 TEST(cubicOp15d),
3664 TEST(cubicOp14d),
3665 TEST(cubicOp13d),
3666 TEST(cubicOp12d),
3667 TEST(cubicOp11d),
3668 TEST(cubicOp10d),
3669 TEST(cubicOp1i),
3670 TEST(cubicOp9d),
3671 TEST(quadOp9d),
3672 TEST(lineOp9d),
3673 TEST(cubicOp8d),
3674 TEST(cubicOp7d),
3675 TEST(cubicOp6d),
3676 TEST(cubicOp5d),
3677 TEST(cubicOp3d),
3678 TEST(cubicOp2d),
3679 TEST(cubicOp1d),
3680};
3681
caryclark@google.comad65a3e2013-04-15 19:13:59 +00003682static const size_t testCount = SK_ARRAY_COUNT(tests);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003683
3684static struct TestDesc subTests[] = {
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00003685 TEST(cubicOp114),
3686 TEST(cubicOp58d),
3687 TEST(cubicOp53d),
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003688};
3689
caryclark@google.comad65a3e2013-04-15 19:13:59 +00003690static const size_t subTestCount = SK_ARRAY_COUNT(subTests);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003691
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003692static void (*firstSubTest)(skiatest::Reporter* , const char* filename) = 0;
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003693
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003694static bool runSubTests = false;
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003695static bool runSubTestsFirst = false;
3696static bool runReverse = false;
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003697
tfarina@chromium.org78e7b4e2014-01-02 21:45:03 +00003698DEF_TEST(PathOpsOp, reporter) {
caryclark@google.com07e97fc2013-07-08 17:17:02 +00003699#if DEBUG_SHOW_TEST_NAME
3700 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
3701#endif
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003702 if (runSubTests && runSubTestsFirst) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003703 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, runReverse);
3704 }
3705 RunTestSet(reporter, tests, testCount, firstTest, stopTest, runReverse);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003706 if (runSubTests && !runSubTestsFirst) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003707 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, runReverse);
3708 }
caryclark@google.com818b0cc2013-04-08 11:50:46 +00003709}
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003710
3711static void bufferOverflow(skiatest::Reporter* reporter, const char* filename) {
3712 SkPath path;
3713 path.addRect(0,0, 300,170141183460469231731687303715884105728.f);
3714 SkPath pathB;
3715 pathB.addRect(0,0, 300,16);
3716 testPathFailOp(reporter, path, pathB, kUnion_PathOp, filename);
3717}
3718
3719static struct TestDesc failTests[] = {
3720 TEST(bufferOverflow),
3721};
3722
3723static const size_t failTestCount = SK_ARRAY_COUNT(failTests);
3724
3725DEF_TEST(PathOpsFailOp, reporter) {
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003726#if DEBUG_SHOW_TEST_NAME
3727 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
3728#endif
3729 RunTestSet(reporter, failTests, failTestCount, 0, 0, false);
3730}