blob: 54f7576f137ebe0a66ac76408acb5304417df240 [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"
caryclarke4097e32014-06-18 07:24:19 -07008#include "PathOpsTestCommon.h"
caryclark@google.com818b0cc2013-04-08 11:50:46 +00009
10#define TEST(name) { name, #name }
11
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000012static void cubicOp1d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +000013 SkPath path, pathB;
14 path.setFillType(SkPath::kWinding_FillType);
15 path.moveTo(0,1);
16 path.cubicTo(0,2, 1,0, 1,0);
17 path.close();
18 pathB.setFillType(SkPath::kWinding_FillType);
19 pathB.moveTo(0,1);
20 pathB.cubicTo(0,1, 1,0, 2,0);
21 pathB.close();
caryclark54359292015-03-26 07:52:43 -070022 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +000023}
24
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000025static void cubicOp2d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +000026 SkPath path, pathB;
27 path.setFillType(SkPath::kWinding_FillType);
28 path.moveTo(0,2);
29 path.cubicTo(0,1, 1,0, 1,0);
30 path.close();
31 pathB.setFillType(SkPath::kWinding_FillType);
32 pathB.moveTo(0,1);
33 pathB.cubicTo(0,1, 2,0, 1,0);
34 pathB.close();
caryclark54359292015-03-26 07:52:43 -070035 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +000036}
37
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000038static void cubicOp3d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +000039 SkPath path, pathB;
40 path.setFillType(SkPath::kWinding_FillType);
41 path.moveTo(0,1);
42 path.cubicTo(2,3, 1,0, 1,0);
43 path.close();
44 pathB.setFillType(SkPath::kWinding_FillType);
45 pathB.moveTo(0,1);
46 pathB.cubicTo(0,1, 1,0, 3,2);
47 pathB.close();
caryclark54359292015-03-26 07:52:43 -070048 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +000049}
50
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000051static void cubicOp5d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +000052 SkPath path, pathB;
53 path.setFillType(SkPath::kWinding_FillType);
54 path.moveTo(0,1);
55 path.cubicTo(0,2, 1,0, 2,0);
56 path.close();
57 pathB.setFillType(SkPath::kWinding_FillType);
58 pathB.moveTo(0,1);
59 pathB.cubicTo(0,2, 1,0, 2,0);
60 pathB.close();
caryclark54359292015-03-26 07:52:43 -070061 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +000062}
63
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000064static void cubicOp6d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +000065 SkPath path, pathB;
66 path.setFillType(SkPath::kWinding_FillType);
67 path.moveTo(0,1);
68 path.cubicTo(0,6, 1,0, 3,0);
69 path.close();
70 pathB.setFillType(SkPath::kWinding_FillType);
71 pathB.moveTo(0,1);
72 pathB.cubicTo(0,3, 1,0, 6,0);
73 pathB.close();
caryclark54359292015-03-26 07:52:43 -070074 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +000075}
76
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000077static void cubicOp7d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +000078 SkPath path, pathB;
79 path.setFillType(SkPath::kWinding_FillType);
80 path.moveTo(0,1);
81 path.cubicTo(3,4, 1,0, 3,0);
82 path.close();
83 pathB.setFillType(SkPath::kWinding_FillType);
84 pathB.moveTo(0,1);
85 pathB.cubicTo(0,3, 1,0, 4,3);
86 pathB.close();
caryclark54359292015-03-26 07:52:43 -070087 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +000088}
89
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000090static void cubicOp8d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +000091 SkPath path, pathB;
92 path.setFillType(SkPath::kWinding_FillType);
93 path.moveTo(0,1);
94 path.cubicTo(0,5, 1,0, 4,0);
95 path.close();
96 pathB.setFillType(SkPath::kWinding_FillType);
97 pathB.moveTo(0,1);
98 pathB.cubicTo(0,4, 1,0, 5,0);
99 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700100 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000101}
102
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000103static void cubicOp9d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000104 SkPath path, pathB;
105 path.setFillType(SkPath::kWinding_FillType);
106 path.moveTo(0,1);
107 path.cubicTo(1,6, 1,0, 2,1);
108 path.close();
109 pathB.setFillType(SkPath::kWinding_FillType);
110 pathB.moveTo(0,1);
111 pathB.cubicTo(1,2, 1,0, 6,1);
112 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700113 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000114}
115
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000116static void quadOp9d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000117 SkPath path, pathB;
118 path.setFillType(SkPath::kWinding_FillType);
119 path.moveTo(0,1);
120 path.quadTo(1,6, 1.5f,1);
121 path.quadTo(1.5f,0.5f, 2,1);
122 path.close();
123 pathB.setFillType(SkPath::kWinding_FillType);
124 pathB.moveTo(0,1);
125 pathB.quadTo(1,2, 1.4f,1);
126 pathB.quadTo(3,0.4f, 6,1);
127 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700128 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000129}
130
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000131static void lineOp9d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000132 SkPath path, pathB;
133 path.setFillType(SkPath::kWinding_FillType);
134 path.moveTo(0,1);
135 path.lineTo(1,6);
136 path.lineTo(1.5f,1);
137 path.lineTo(1.8f,0.8f);
138 path.lineTo(2,1);
139 path.close();
140 pathB.setFillType(SkPath::kWinding_FillType);
141 pathB.moveTo(0,1);
142 pathB.lineTo(1,2);
143 pathB.lineTo(1.4f,1);
144 pathB.lineTo(3,0.4f);
145 pathB.lineTo(6,1);
146 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700147 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000148}
149
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000150static void cubicOp1i(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000151 SkPath path, pathB;
152 path.setFillType(SkPath::kWinding_FillType);
153 path.moveTo(0,1);
154 path.cubicTo(1,2, 1,0, 2,1);
155 path.close();
156 pathB.setFillType(SkPath::kWinding_FillType);
157 pathB.moveTo(0,1);
158 pathB.cubicTo(1,2, 1,0, 2,1);
159 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700160 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000161}
162
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000163static void cubicOp10d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000164 SkPath path, pathB;
165 path.setFillType(SkPath::kWinding_FillType);
166 path.moveTo(0,1);
167 path.cubicTo(1,3, 1,0, 4,1);
168 path.close();
169 pathB.setFillType(SkPath::kWinding_FillType);
170 pathB.moveTo(0,1);
171 pathB.cubicTo(1,4, 1,0, 3,1);
172 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700173 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000174}
175
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000176static void cubicOp11d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000177 SkPath path, pathB;
178 path.setFillType(SkPath::kWinding_FillType);
179 path.moveTo(0,1);
180 path.cubicTo(3,4, 1,0, 5,1);
181 path.close();
182 pathB.setFillType(SkPath::kWinding_FillType);
183 pathB.moveTo(0,1);
184 pathB.cubicTo(1,5, 1,0, 4,3);
185 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700186 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000187}
188
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000189static void cubicOp12d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000190 SkPath path, pathB;
191 path.setFillType(SkPath::kWinding_FillType);
192 path.moveTo(0,1);
193 path.cubicTo(1,6, 1,0, 1,0);
194 path.close();
195 pathB.setFillType(SkPath::kWinding_FillType);
196 pathB.moveTo(0,1);
197 pathB.cubicTo(0,1, 1,0, 6,1);
198 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700199 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000200}
201
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000202static void cubicOp13d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000203 SkPath path, pathB;
204 path.setFillType(SkPath::kWinding_FillType);
205 path.moveTo(0,1);
206 path.cubicTo(4,5, 1,0, 5,3);
207 path.close();
208 pathB.setFillType(SkPath::kWinding_FillType);
209 pathB.moveTo(0,1);
210 pathB.cubicTo(3,5, 1,0, 5,4);
211 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700212 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000213}
214
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000215static void cubicOp14d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000216 SkPath path, pathB;
217 path.setFillType(SkPath::kWinding_FillType);
218 path.moveTo(0,1);
219 path.cubicTo(0,2, 2,0, 2,1);
220 path.close();
221 pathB.setFillType(SkPath::kWinding_FillType);
222 pathB.moveTo(0,2);
223 pathB.cubicTo(1,2, 1,0, 2,0);
224 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700225 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000226}
227
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000228static void cubicOp15d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000229 SkPath path, pathB;
230 path.setFillType(SkPath::kWinding_FillType);
231 path.moveTo(0,1);
232 path.cubicTo(3,6, 2,0, 2,1);
233 path.close();
234 pathB.setFillType(SkPath::kWinding_FillType);
235 pathB.moveTo(0,2);
236 pathB.cubicTo(1,2, 1,0, 6,3);
237 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700238 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000239}
240
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000241static void cubicOp16d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000242 SkPath path, pathB;
243 path.setFillType(SkPath::kWinding_FillType);
244 path.moveTo(0,2);
245 path.cubicTo(0,1, 3,0, 1,0);
246 path.close();
247 pathB.setFillType(SkPath::kWinding_FillType);
248 pathB.moveTo(0,3);
249 pathB.cubicTo(0,1, 2,0, 1,0);
250 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700251 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000252}
253
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000254static void cubicOp17d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000255 SkPath path, pathB;
256 path.setFillType(SkPath::kWinding_FillType);
257 path.moveTo(0,2);
258 path.cubicTo(0,2, 4,0, 2,1);
259 path.close();
260 pathB.setFillType(SkPath::kWinding_FillType);
261 pathB.moveTo(0,4);
262 pathB.cubicTo(1,2, 2,0, 2,0);
263 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700264 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000265}
266
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000267static void cubicOp18d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000268 SkPath path, pathB;
269 path.setFillType(SkPath::kWinding_FillType);
270 path.moveTo(0,1);
271 path.cubicTo(3,5, 2,0, 2,1);
272 path.close();
273 pathB.setFillType(SkPath::kWinding_FillType);
274 pathB.moveTo(0,2);
275 pathB.cubicTo(1,2, 1,0, 5,3);
276 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700277 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000278}
279
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000280static void cubicOp19i(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000281 SkPath path, pathB;
282 path.setFillType(SkPath::kWinding_FillType);
283 path.moveTo(0,2);
284 path.cubicTo(0,1, 2,1, 6,2);
285 path.close();
286 pathB.setFillType(SkPath::kWinding_FillType);
287 pathB.moveTo(1,2);
288 pathB.cubicTo(2,6, 2,0, 1,0);
289 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700290 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000291}
292
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000293static void cubicOp20d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000294 SkPath path, pathB;
295 path.setFillType(SkPath::kWinding_FillType);
296 path.moveTo(0,1);
297 path.cubicTo(0,1, 6,0, 2,1);
298 path.close();
299 pathB.setFillType(SkPath::kWinding_FillType);
300 pathB.moveTo(0,6);
301 pathB.cubicTo(1,2, 1,0, 1,0);
302 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700303 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000304}
305
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000306static void cubicOp21d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000307 SkPath path, pathB;
308 path.setFillType(SkPath::kWinding_FillType);
309 path.moveTo(0,1);
310 path.cubicTo(0,1, 2,1, 6,5);
311 path.close();
312 pathB.setFillType(SkPath::kWinding_FillType);
313 pathB.moveTo(1,2);
314 pathB.cubicTo(5,6, 1,0, 1,0);
315 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700316 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000317}
318
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000319static void cubicOp22d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000320 SkPath path, pathB;
321 path.setFillType(SkPath::kWinding_FillType);
322 path.moveTo(0,1);
323 path.cubicTo(2,3, 3,0, 2,1);
324 path.close();
325 pathB.setFillType(SkPath::kWinding_FillType);
326 pathB.moveTo(0,3);
327 pathB.cubicTo(1,2, 1,0, 3,2);
328 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700329 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000330}
331
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000332static void cubicOp23d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000333 SkPath path, pathB;
334 path.setFillType(SkPath::kWinding_FillType);
335 path.moveTo(0,1);
336 path.cubicTo(1,2, 4,0, 2,1);
337 path.close();
338 pathB.setFillType(SkPath::kWinding_FillType);
339 pathB.moveTo(0,4);
340 pathB.cubicTo(1,2, 1,0, 2,1);
341 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700342 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000343}
344
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000345static void cubicOp24d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000346 SkPath path, pathB;
347 path.setFillType(SkPath::kWinding_FillType);
348 path.moveTo(0,1);
349 path.cubicTo(1,2, 2,0, 3,2);
350 path.close();
351 pathB.setFillType(SkPath::kWinding_FillType);
352 pathB.moveTo(0,2);
353 pathB.cubicTo(2,3, 1,0, 2,1);
354 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700355 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000356}
357
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000358static void testIntersect1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000359 SkPath one, two;
360 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
361 two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -0700362 testPathOp(reporter, one, two, kIntersect_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000363}
364
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000365static void testUnion1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000366 SkPath one, two;
367 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
368 two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -0700369 testPathOp(reporter, one, two, kUnion_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000370}
371
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000372static void testDiff1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000373 SkPath one, two;
374 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
375 two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -0700376 testPathOp(reporter, one, two, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000377}
378
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000379static void testXor1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000380 SkPath one, two;
381 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
382 two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -0700383 testPathOp(reporter, one, two, kXOR_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000384}
385
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000386static void testIntersect2(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000387 SkPath one, two;
388 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
389 two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -0700390 testPathOp(reporter, one, two, kIntersect_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000391}
392
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000393static void testUnion2(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000394 SkPath one, two;
395 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
396 two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -0700397 testPathOp(reporter, one, two, kUnion_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000398}
399
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000400static void testDiff2(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000401 SkPath one, two;
402 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
403 two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -0700404 testPathOp(reporter, one, two, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000405}
406
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000407static void testXor2(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000408 SkPath one, two;
409 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
410 two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -0700411 testPathOp(reporter, one, two, kXOR_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000412}
413
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000414static void testOp1d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000415 SkPath path, pathB;
416 path.setFillType(SkPath::kWinding_FillType);
417 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
418 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
419 pathB.setFillType(SkPath::kWinding_FillType);
420 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
421 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -0700422 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000423}
424
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000425static void testOp2d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000426 SkPath path, pathB;
427 path.setFillType(SkPath::kWinding_FillType);
428 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
429 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
430 pathB.setFillType(SkPath::kEvenOdd_FillType);
431 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
432 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -0700433 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000434}
435
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000436static void testOp3d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000437 SkPath path, pathB;
438 path.setFillType(SkPath::kWinding_FillType);
439 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
440 path.addRect(1, 1, 2, 2, SkPath::kCW_Direction);
441 pathB.setFillType(SkPath::kWinding_FillType);
442 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
443 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -0700444 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000445}
446
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000447static void testOp1u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000448 SkPath path, pathB;
449 path.setFillType(SkPath::kWinding_FillType);
450 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
451 path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
452 pathB.setFillType(SkPath::kWinding_FillType);
453 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
454 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -0700455 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000456}
457
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000458static void testOp4d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000459 SkPath path, pathB;
460 path.setFillType(SkPath::kWinding_FillType);
461 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
462 path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
463 pathB.setFillType(SkPath::kWinding_FillType);
464 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
465 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -0700466 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000467}
468
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000469static void testOp5d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000470 SkPath path, pathB;
471 path.setFillType(SkPath::kEvenOdd_FillType);
472 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
473 path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
474 pathB.setFillType(SkPath::kEvenOdd_FillType);
475 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
476 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -0700477 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000478}
479
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000480static void testOp6d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000481 SkPath path, pathB;
482 path.setFillType(SkPath::kEvenOdd_FillType);
483 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
484 path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
485 pathB.setFillType(SkPath::kWinding_FillType);
486 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
487 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -0700488 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000489}
490
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000491static void testOp7d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000492 SkPath path, pathB;
493 path.setFillType(SkPath::kEvenOdd_FillType);
494 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
495 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
496 pathB.setFillType(SkPath::kEvenOdd_FillType);
497 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
498 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -0700499 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000500}
501
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000502static void testOp2u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000503 SkPath path, pathB;
504 path.setFillType(SkPath::kEvenOdd_FillType);
505 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
506 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
507 pathB.setFillType(SkPath::kWinding_FillType);
508 pathB.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
509 pathB.addRect(1, 1, 2, 2, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -0700510 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000511}
512
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000513static void testOp8d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000514 SkPath path, pathB;
515 path.addRect(0, 0, 640, 480);
516 pathB.moveTo(577330, 1971.72f);
517 pathB.cubicTo(10.7082f, -116.596f, 262.057f, 45.6468f, 294.694f, 1.96237f);
518 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700519 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000520}
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000521static void cubicOp25i(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000522 SkPath path, pathB;
523 path.setFillType(SkPath::kWinding_FillType);
524 path.moveTo(0,1);
525 path.cubicTo(2,4, 5,0, 3,2);
526 path.close();
527 pathB.setFillType(SkPath::kWinding_FillType);
528 pathB.moveTo(0,5);
529 pathB.cubicTo(2,3, 1,0, 4,2);
530 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700531 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000532}
533
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000534static void cubicOp26d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000535 SkPath path, pathB;
536 path.setFillType(SkPath::kWinding_FillType);
537 path.moveTo(0,1);
538 path.cubicTo(3,4, 4,0, 3,2);
539 path.close();
540 pathB.setFillType(SkPath::kWinding_FillType);
541 pathB.moveTo(0,4);
542 pathB.cubicTo(2,3, 1,0, 4,3);
543 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700544 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000545}
546
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000547static void cubicOp27d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000548 SkPath path, pathB;
549 path.setFillType(SkPath::kWinding_FillType);
550 path.moveTo(0,1);
551 path.cubicTo(3,6, 1,0, 5,2);
552 path.close();
553 pathB.setFillType(SkPath::kWinding_FillType);
554 pathB.moveTo(0,1);
555 pathB.cubicTo(2,5, 1,0, 6,3);
556 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700557 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000558}
559
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000560static void cubicOp28u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000561 SkPath path, pathB;
562 path.setFillType(SkPath::kWinding_FillType);
563 path.moveTo(0,1);
564 path.cubicTo(1,4, 6,0, 3,2);
565 path.close();
566 pathB.setFillType(SkPath::kWinding_FillType);
567 pathB.moveTo(0,6);
568 pathB.cubicTo(2,3, 1,0, 4,1);
569 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700570 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000571}
572
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000573static void cubicOp29d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000574 SkPath path, pathB;
575 path.setFillType(SkPath::kWinding_FillType);
576 path.moveTo(0,1);
577 path.cubicTo(2,5, 6,0, 4,2);
578 path.close();
579 pathB.setFillType(SkPath::kWinding_FillType);
580 pathB.moveTo(0,6);
581 pathB.cubicTo(2,4, 1,0, 5,2);
582 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700583 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000584}
585
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000586static void cubicOp30d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000587 SkPath path, pathB;
588 path.setFillType(SkPath::kWinding_FillType);
589 path.moveTo(0,1);
590 path.cubicTo(2,5, 6,0, 5,3);
591 path.close();
592 pathB.setFillType(SkPath::kWinding_FillType);
593 pathB.moveTo(0,6);
594 pathB.cubicTo(3,5, 1,0, 5,2);
595 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700596 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000597}
598
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000599static void cubicOp31d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000600 SkPath path, pathB;
601 path.setFillType(SkPath::kWinding_FillType);
602 path.moveTo(0,2);
603 path.cubicTo(0,3, 2,1, 4,0);
604 path.close();
605 pathB.setFillType(SkPath::kWinding_FillType);
606 pathB.moveTo(1,2);
607 pathB.cubicTo(0,4, 2,0, 3,0);
608 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700609 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000610}
611
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000612static void cubicOp31u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000613 SkPath path, pathB;
614 path.setFillType(SkPath::kWinding_FillType);
615 path.moveTo(0,2);
616 path.cubicTo(0,3, 2,1, 4,0);
617 path.close();
618 pathB.setFillType(SkPath::kWinding_FillType);
619 pathB.moveTo(1,2);
620 pathB.cubicTo(0,4, 2,0, 3,0);
621 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700622 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000623}
624
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000625static void cubicOp31x(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000626 SkPath path, pathB;
627 path.setFillType(SkPath::kWinding_FillType);
628 path.moveTo(0,2);
629 path.cubicTo(0,3, 2,1, 4,0);
630 path.close();
631 pathB.setFillType(SkPath::kWinding_FillType);
632 pathB.moveTo(1,2);
633 pathB.cubicTo(0,4, 2,0, 3,0);
634 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700635 testPathOp(reporter, path, pathB, kXOR_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000636}
637
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000638static void cubicOp32d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000639 SkPath path, pathB;
640 path.setFillType(SkPath::kWinding_FillType);
641 path.moveTo(0,1);
642 path.cubicTo(1,2, 6,0, 3,1);
643 path.close();
644 pathB.setFillType(SkPath::kWinding_FillType);
645 pathB.moveTo(0,6);
646 pathB.cubicTo(1,3, 1,0, 2,1);
647 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700648 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000649}
650
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000651static void cubicOp33i(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000652 SkPath path, pathB;
653 path.setFillType(SkPath::kWinding_FillType);
654 path.moveTo(0,1);
655 path.cubicTo(1,2, 6,0, 3,1);
656 path.close();
657 pathB.setFillType(SkPath::kWinding_FillType);
658 pathB.moveTo(0,6);
659 pathB.cubicTo(1,3, 1,0, 2,1);
660 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700661 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000662}
663
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000664static void cubicOp34d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000665 SkPath path, pathB;
666 path.setFillType(SkPath::kWinding_FillType);
667 path.moveTo(0,1);
668 path.cubicTo(3,5, 2,1, 3,1);
669 path.close();
670 pathB.setFillType(SkPath::kWinding_FillType);
671 pathB.moveTo(1,2);
672 pathB.cubicTo(1,3, 1,0, 5,3);
673 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700674 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000675}
676
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000677static void cubicOp35d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000678 SkPath path, pathB;
679 path.setFillType(SkPath::kWinding_FillType);
680 path.moveTo(0,1);
681 path.cubicTo(1,5, 2,1, 4,0);
682 path.close();
683 pathB.setFillType(SkPath::kWinding_FillType);
684 pathB.moveTo(1,2);
685 pathB.cubicTo(0,4, 1,0, 5,1);
686 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700687 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000688}
689
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000690static void cubicOp36u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000691 SkPath path, pathB;
692 path.setFillType(SkPath::kWinding_FillType);
693 path.moveTo(0,1);
694 path.cubicTo(1,6, 2,0, 5,1);
695 path.close();
696 pathB.setFillType(SkPath::kWinding_FillType);
697 pathB.moveTo(0,2);
698 pathB.cubicTo(1,5, 1,0, 6,1);
699 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700700 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000701}
702
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000703static void cubicOp37d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000704 SkPath path, pathB;
705 path.setFillType(SkPath::kWinding_FillType);
706 path.moveTo(0,1);
707 path.cubicTo(2,6, 6,1, 4,3);
708 path.close();
709 pathB.setFillType(SkPath::kWinding_FillType);
710 pathB.moveTo(1,6);
711 pathB.cubicTo(3,4, 1,0, 6,2);
712 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700713 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000714}
715
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000716static void cubicOp38d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000717 SkPath path, pathB;
718 path.setFillType(SkPath::kWinding_FillType);
719 path.moveTo(0,1);
720 path.cubicTo(0,6, 3,2, 4,1);
721 path.close();
722 pathB.setFillType(SkPath::kWinding_FillType);
723 pathB.moveTo(2,3);
724 pathB.cubicTo(1,4, 1,0, 6,0);
725 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700726 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000727}
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000728
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000729static void cubicOp39d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000730 SkPath path, pathB;
731 path.setFillType(SkPath::kWinding_FillType);
732 path.moveTo(0,1);
733 path.cubicTo(2,3, 5,1, 4,3);
734 path.close();
735 pathB.setFillType(SkPath::kWinding_FillType);
736 pathB.moveTo(1,5);
737 pathB.cubicTo(3,4, 1,0, 3,2);
738 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700739 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000740}
741
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000742static void cubicOp40d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000743 SkPath path, pathB;
744 path.setFillType(SkPath::kWinding_FillType);
745 path.moveTo(0,1);
746 path.cubicTo(1,5, 3,2, 4,2);
747 path.close();
748 pathB.setFillType(SkPath::kWinding_FillType);
749 pathB.moveTo(2,3);
750 pathB.cubicTo(2,4, 1,0, 5,1);
751 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700752 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000753}
754
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000755static void cubicOp41i(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000756 SkPath path, pathB;
757 path.setFillType(SkPath::kWinding_FillType);
758 path.moveTo(0,1);
759 path.cubicTo(2,6, 4,3, 6,4);
760 path.close();
761 pathB.setFillType(SkPath::kWinding_FillType);
762 pathB.moveTo(3,4);
763 pathB.cubicTo(4,6, 1,0, 6,2);
764 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700765 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000766}
767
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000768static void cubicOp42d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000769 SkPath path, pathB;
770 path.setFillType(SkPath::kWinding_FillType);
771 path.moveTo(0,1);
772 path.cubicTo(1,2, 6,5, 5,4);
773 path.close();
774 pathB.setFillType(SkPath::kWinding_FillType);
775 pathB.moveTo(5,6);
776 pathB.cubicTo(4,5, 1,0, 2,1);
777 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700778 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000779}
780
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000781static void cubicOp43d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000782 SkPath path, pathB;
783 path.setFillType(SkPath::kWinding_FillType);
784 path.moveTo(0,2);
785 path.cubicTo(1,2, 4,0, 3,1);
786 path.close();
787 pathB.setFillType(SkPath::kWinding_FillType);
788 pathB.moveTo(0,4);
789 pathB.cubicTo(1,3, 2,0, 2,1);
790 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700791 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000792}
793
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000794static void cubicOp44d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000795 SkPath path, pathB;
796 path.setFillType(SkPath::kWinding_FillType);
797 path.moveTo(0,2);
798 path.cubicTo(3,6, 4,0, 3,2);
799 path.close();
800 pathB.setFillType(SkPath::kWinding_FillType);
801 pathB.moveTo(0,4);
802 pathB.cubicTo(2,3, 2,0, 6,3);
803 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700804 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000805}
806
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000807static void cubicOp45d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000808 SkPath path, pathB;
809 path.setFillType(SkPath::kWinding_FillType);
810 path.moveTo(0,2);
811 path.cubicTo(2,4, 4,0, 3,2);
812 path.close();
813 pathB.setFillType(SkPath::kWinding_FillType);
814 pathB.moveTo(0,4);
815 pathB.cubicTo(2,3, 2,0, 4,2);
816 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700817 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000818}
819
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000820static void cubicOp46d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000821 SkPath path, pathB;
822 path.setFillType(SkPath::kWinding_FillType);
823 path.moveTo(0,2);
824 path.cubicTo(3,5, 5,0, 4,2);
825 path.close();
826 pathB.setFillType(SkPath::kWinding_FillType);
827 pathB.moveTo(0,5);
828 pathB.cubicTo(2,4, 2,0, 5,3);
829 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700830 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000831}
832
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000833static void cubicOp47d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000834 SkPath path, pathB;
835 path.setFillType(SkPath::kWinding_FillType);
836 path.moveTo(0,1);
837 path.cubicTo(1,6, 6,2, 5,4);
838 path.close();
839 pathB.setFillType(SkPath::kWinding_FillType);
840 pathB.moveTo(2,6);
841 pathB.cubicTo(4,5, 1,0, 6,1);
842 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700843 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000844}
845
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000846static void cubicOp48d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000847 SkPath path, pathB;
848 path.setFillType(SkPath::kWinding_FillType);
849 path.moveTo(0,2);
850 path.cubicTo(2,3, 5,1, 3,2);
851 path.close();
852 pathB.setFillType(SkPath::kWinding_FillType);
853 pathB.moveTo(1,5);
854 pathB.cubicTo(2,3, 2,0, 3,2);
855 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700856 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000857}
858
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000859static void cubicOp49d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000860 SkPath path, pathB;
861 path.setFillType(SkPath::kWinding_FillType);
862 path.moveTo(0,2);
863 path.cubicTo(1,5, 3,2, 4,1);
864 path.close();
865 pathB.setFillType(SkPath::kWinding_FillType);
866 pathB.moveTo(2,3);
867 pathB.cubicTo(1,4, 2,0, 5,1);
868 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700869 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000870}
871
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000872static void cubicOp50d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000873 SkPath path, pathB;
874 path.setFillType(SkPath::kWinding_FillType);
875 path.moveTo(0,3);
876 path.cubicTo(1,6, 5,0, 5,1);
877 path.close();
878 pathB.setFillType(SkPath::kWinding_FillType);
879 pathB.moveTo(0,5);
880 pathB.cubicTo(1,5, 3,0, 6,1);
881 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700882 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000883}
884
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000885static void cubicOp51d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000886 SkPath path, pathB;
887 path.setFillType(SkPath::kWinding_FillType);
888 path.moveTo(0,3);
889 path.cubicTo(1,2, 4,1, 6,0);
890 path.close();
891 pathB.setFillType(SkPath::kWinding_FillType);
892 pathB.moveTo(1,4);
893 pathB.cubicTo(0,6, 3,0, 2,1);
894 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700895 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000896}
897
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000898static void cubicOp52d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000899 SkPath path, pathB;
900 path.setFillType(SkPath::kWinding_FillType);
901 path.moveTo(0,2);
902 path.cubicTo(1,2, 5,4, 4,3);
903 path.close();
904 pathB.setFillType(SkPath::kWinding_FillType);
905 pathB.moveTo(4,5);
906 pathB.cubicTo(3,4, 2,0, 2,1);
907 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700908 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000909}
910
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000911static void cubicOp53d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000912 SkPath path, pathB;
913 path.setFillType(SkPath::kWinding_FillType);
914 path.moveTo(0,3);
915 path.cubicTo(1,2, 5,3, 2,1);
916 path.close();
917 pathB.setFillType(SkPath::kWinding_FillType);
918 pathB.moveTo(3,5);
919 pathB.cubicTo(1,2, 3,0, 2,1);
920 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700921 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000922}
923
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000924static void cubicOp54d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000925 SkPath path, pathB;
926 path.setFillType(SkPath::kWinding_FillType);
927 path.moveTo(0,4);
928 path.cubicTo(1,3, 5,4, 4,2);
929 path.close();
930 pathB.setFillType(SkPath::kWinding_FillType);
931 pathB.moveTo(4,5);
932 pathB.cubicTo(2,4, 4,0, 3,1);
933 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700934 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000935}
936
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000937static void cubicOp55d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000938 SkPath path, pathB;
939 path.setFillType(SkPath::kWinding_FillType);
940 path.moveTo(0,5);
941 path.cubicTo(1,3, 3,2, 5,0);
942 path.close();
943 pathB.setFillType(SkPath::kWinding_FillType);
944 pathB.moveTo(2,3);
945 pathB.cubicTo(0,5, 5,0, 3,1);
946 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700947 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000948}
949
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000950static void cubicOp56d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000951 SkPath path, pathB;
952 path.setFillType(SkPath::kWinding_FillType);
953 path.moveTo(0,1);
954 path.cubicTo(2,6, 5,0, 2,1);
955 path.close();
956 pathB.setFillType(SkPath::kWinding_FillType);
957 pathB.moveTo(0,5);
958 pathB.cubicTo(1,2, 1,0, 6,2);
959 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700960 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000961}
962
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000963static void cubicOp57d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000964 SkPath path, pathB;
965 path.setFillType(SkPath::kWinding_FillType);
966 path.moveTo(0,5);
967 path.cubicTo(0,5, 5,4, 6,4);
968 path.close();
969 pathB.setFillType(SkPath::kWinding_FillType);
970 pathB.moveTo(4,5);
971 pathB.cubicTo(4,6, 5,0, 5,0);
972 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700973 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000974}
975
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000976static void cubicOp58d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000977 SkPath path, pathB;
978 path.setFillType(SkPath::kWinding_FillType);
979 path.moveTo(0,5);
980 path.cubicTo(3,4, 6,5, 5,3);
981 path.close();
982 pathB.setFillType(SkPath::kWinding_FillType);
983 pathB.moveTo(5,6);
984 pathB.cubicTo(3,5, 5,0, 4,3);
985 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700986 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000987}
988
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000989static void cubicOp59d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +0000990 SkPath path, pathB;
991 path.setFillType(SkPath::kWinding_FillType);
992 path.moveTo(0,1);
993 path.cubicTo(5,6, 4,0, 4,1);
994 path.close();
995 pathB.setFillType(SkPath::kWinding_FillType);
996 pathB.moveTo(0,4);
997 pathB.cubicTo(1,4, 1,0, 6,5);
998 pathB.close();
caryclark54359292015-03-26 07:52:43 -0700999 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001000}
1001
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001002static void cubicOp60d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001003 SkPath path, pathB;
1004 path.setFillType(SkPath::kWinding_FillType);
1005 path.moveTo(0,2);
1006 path.cubicTo(4,6, 6,0, 5,2);
1007 path.close();
1008 pathB.setFillType(SkPath::kWinding_FillType);
1009 pathB.moveTo(0,6);
1010 pathB.cubicTo(2,5, 2,0, 6,4);
1011 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001012 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001013}
1014
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001015static void cubicOp61d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001016 SkPath path, pathB;
1017 path.setFillType(SkPath::kWinding_FillType);
1018 path.moveTo(1,2);
1019 path.cubicTo(0,5, 3,2, 6,1);
1020 path.close();
1021 pathB.setFillType(SkPath::kWinding_FillType);
1022 pathB.moveTo(2,3);
1023 pathB.cubicTo(1,6, 2,1, 5,0);
1024 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001025 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001026}
1027
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001028static void cubicOp62d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001029 SkPath path, pathB;
1030 path.setFillType(SkPath::kWinding_FillType);
1031 path.moveTo(1,3);
1032 path.cubicTo(5,6, 5,3, 5,4);
1033 path.close();
1034 pathB.setFillType(SkPath::kWinding_FillType);
1035 pathB.moveTo(3,5);
1036 pathB.cubicTo(4,5, 3,1, 6,5);
1037 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001038 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001039}
1040
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001041static void cubicOp63d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001042 SkPath path, pathB;
1043 path.setFillType(SkPath::kWinding_FillType);
1044 path.moveTo(2,3);
1045 path.cubicTo(0,4, 3,2, 5,3);
1046 path.close();
1047 pathB.setFillType(SkPath::kWinding_FillType);
1048 pathB.moveTo(2,3);
1049 pathB.cubicTo(3,5, 3,2, 4,0);
1050 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001051 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001052}
1053
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001054static void cubicOp64d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001055 SkPath path, pathB;
1056 path.moveTo(0,1);
1057 path.cubicTo(0,1, 1,0, 3,0);
1058 path.lineTo(0,1);
1059 path.close();
1060 pathB.moveTo(0,1);
1061 pathB.cubicTo(0,3, 1,0, 1,0);
1062 pathB.lineTo(0,1);
1063 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001064 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001065}
1066
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001067static void cubicOp65d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001068 SkPath path, pathB;
1069 path.moveTo(0,1);
1070 path.cubicTo(1,5, 1,0, 1,0);
1071 path.lineTo(0,1);
1072 path.close();
1073 pathB.moveTo(0,1);
1074 pathB.cubicTo(0,1, 1,0, 5,1);
1075 pathB.lineTo(0,1);
1076 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001077 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001078}
1079
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001080static void rectOp1d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001081 SkPath path, pathB;
1082 path.moveTo(0,1);
1083 path.cubicTo(0,1, 1,0, 3,0);
1084 path.lineTo(0,1);
1085 path.close();
1086 pathB.moveTo(0,1);
1087 pathB.cubicTo(0,3, 1,0, 1,0);
1088 pathB.lineTo(0,1);
1089 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001090 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001091}
1092
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001093static void cubicOp66u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.comb3f09212013-04-17 15:49:16 +00001094 SkPath path, pathB;
1095 path.setFillType(SkPath::kWinding_FillType);
1096 path.moveTo(0,1);
1097 path.cubicTo(2,6, 4,2, 5,3);
1098 path.close();
1099 pathB.setFillType(SkPath::kWinding_FillType);
1100 pathB.moveTo(2,4);
1101 pathB.cubicTo(3,5, 1,0, 6,2);
1102 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001103 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
caryclark@google.comb3f09212013-04-17 15:49:16 +00001104}
1105
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001106static void cubicOp67u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.comb3f09212013-04-17 15:49:16 +00001107 SkPath path, pathB;
1108 path.moveTo(3,5);
1109 path.cubicTo(1,6, 5,0, 3,1);
1110 path.lineTo(3,5);
1111 path.close();
1112 pathB.moveTo(0,5);
1113 pathB.cubicTo(1,3, 5,3, 6,1);
1114 pathB.lineTo(0,5);
1115 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001116 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
caryclark@google.comb3f09212013-04-17 15:49:16 +00001117}
1118
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001119static void cubicOp68u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com03610322013-04-18 15:58:21 +00001120 SkPath path, pathB;
1121 path.moveTo(0,5);
1122 path.cubicTo(4,5, 4,1, 5,0);
1123 path.close();
1124 pathB.moveTo(1,4);
1125 pathB.cubicTo(0,5, 5,0, 5,4);
1126 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001127 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
caryclark@google.com03610322013-04-18 15:58:21 +00001128}
1129
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001130static void cubicOp69d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com03610322013-04-18 15:58:21 +00001131 SkPath path, pathB;
1132 path.moveTo(1,3);
1133 path.cubicTo(0,1, 3,1, 2,0);
1134 path.close();
1135 pathB.moveTo(1,3);
1136 pathB.cubicTo(0,2, 3,1, 1,0);
1137 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001138 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com03610322013-04-18 15:58:21 +00001139}
1140
caryclark@google.com6dc7df62013-04-25 11:51:54 +00001141SkPathOp ops[] = {
caryclark54359292015-03-26 07:52:43 -07001142 kUnion_SkPathOp,
1143 kXOR_SkPathOp,
1144 kReverseDifference_SkPathOp,
1145 kXOR_SkPathOp,
1146 kReverseDifference_SkPathOp,
caryclark@google.com6dc7df62013-04-25 11:51:54 +00001147};
1148
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001149static void rRect1(skiatest::Reporter* reporter, const char* filename) {
commit-bot@chromium.org4b413c82013-11-25 19:44:07 +00001150 SkScalar xA = 0.65f;
1151 SkScalar xB = 10.65f;
1152 SkScalar xC = 20.65f;
1153 SkScalar xD = 30.65f;
1154 SkScalar xE = 40.65f;
1155 SkScalar xF = 50.65f;
caryclark@google.com6dc7df62013-04-25 11:51:54 +00001156
commit-bot@chromium.org4b413c82013-11-25 19:44:07 +00001157 SkScalar yA = 0.65f;
1158 SkScalar yB = 10.65f;
1159 SkScalar yC = 20.65f;
1160 SkScalar yD = 30.65f;
1161 SkScalar yE = 40.65f;
1162 SkScalar yF = 50.65f;
caryclark@google.coma5e55922013-05-07 18:51:31 +00001163 SkPath paths[5];
1164 SkRect rects[5];
1165 rects[0].set(xB, yB, xE, yE);
1166 paths[0].addRoundRect(rects[0], SkIntToScalar(5), SkIntToScalar(5)); // red
1167 rects[1].set(xA, yA, xD, yD);
1168 paths[1].addRoundRect(rects[1], SkIntToScalar(5), SkIntToScalar(5)); // green
1169 rects[2].set(xC, yA, xF, yD);
1170 paths[2].addRoundRect(rects[2], SkIntToScalar(5), SkIntToScalar(5)); // blue
1171 rects[3].set(xA, yC, xD, yF);
1172 paths[3].addRoundRect(rects[3], SkIntToScalar(5), SkIntToScalar(5)); // yellow
1173 rects[4].set(xC, yC, xF, yF);
1174 paths[4].addRoundRect(rects[4], SkIntToScalar(5), SkIntToScalar(5)); // cyan
1175 SkPath path;
1176 path.setFillType(SkPath::kInverseEvenOdd_FillType);
1177 for (int index = 0; index < 5; ++index) {
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001178 testPathOp(reporter, path, paths[index], ops[index], filename);
caryclark@google.coma5e55922013-05-07 18:51:31 +00001179 Op(path, paths[index], ops[index], &path);
1180 }
1181}
1182
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001183static void skp1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.coma5e55922013-05-07 18:51:31 +00001184 SkPath path;
1185 path.setFillType(SkPath::kEvenOdd_FillType);
1186 path.moveTo(189,7);
1187 path.cubicTo(189,5.34314585f, 190.34314f,4, 192,4);
1188 path.lineTo(243,4);
1189 path.cubicTo(244.65686f,4, 246,5.34314585f, 246,7);
1190 path.lineTo(246,21);
1191 path.cubicTo(246,22.6568546f, 244.65686f,24, 243,24);
1192 path.lineTo(192,24);
1193 path.cubicTo(190.34314f,24, 189,22.6568546f, 189,21);
1194 path.lineTo(189,7);
1195 path.close();
1196 path.moveTo(191,8);
1197 path.cubicTo(191,6.89543009f, 191.895432f,6, 193,6);
1198 path.lineTo(242,6);
1199 path.cubicTo(243.104568f,6, 244,6.89543009f, 244,8);
1200 path.lineTo(244,20);
1201 path.cubicTo(244,21.1045704f, 243.104568f,22, 242,22);
1202 path.lineTo(193,22);
1203 path.cubicTo(191.895432f,22, 191,21.1045704f, 191,20);
1204 path.lineTo(191,8);
1205 path.close();
1206 SkPath pathB;
1207 pathB.setFillType(SkPath::kWinding_FillType);
1208 pathB.moveTo(189,4);
1209 pathB.lineTo(199,14);
1210 pathB.lineTo(236,14);
1211 pathB.lineTo(246,4);
1212 pathB.lineTo(189,4);
1213 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001214 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.coma5e55922013-05-07 18:51:31 +00001215}
1216
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001217static void skp2(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.coma5e55922013-05-07 18:51:31 +00001218 SkPath path;
1219 path.setFillType(SkPath::kEvenOdd_FillType);
1220 path.moveTo(253.000000f, 11757.0000f);
1221 path.lineTo(253.000000f, 222.000000f);
1222 path.lineTo(823.000000f, 222.000000f);
1223 path.lineTo(823.000000f, 11757.0000f);
1224 path.lineTo(253.000000f, 11757.0000f);
1225 path.close();
1226 SkPath pathB;
1227 pathB.setFillType(SkPath::kWinding_FillType);
1228 pathB.moveTo(258.000000f, 1028.00000f);
1229 pathB.lineTo(258.000000f, 1027.00000f);
1230 pathB.lineTo(823.000000f, 1027.00000f);
1231 pathB.lineTo(823.000000f, 1028.00000f);
1232 pathB.lineTo(258.000000f, 1028.00000f);
1233 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001234 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.coma5e55922013-05-07 18:51:31 +00001235}
1236
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001237static void skp3(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.coma5e55922013-05-07 18:51:31 +00001238 SkPath path;
1239 path.setFillType(SkPath::kEvenOdd_FillType);
1240 path.moveTo(717.000000f, 507.000000f);
1241 path.lineTo(717.000000f, 425.000000f);
1242 path.lineTo(973.000000f, 425.000000f);
1243 path.lineTo(973.000000f, 507.000000f);
1244 path.quadTo(973.000000f, 508.242645f, 972.121582f, 509.121613f);
1245 path.quadTo(971.242615f, 510.000000f, 970.000000f, 510.000000f);
1246 path.lineTo(720.000000f, 510.000000f);
1247 path.quadTo(718.757385f, 510.000000f, 717.878418f, 509.121613f);
1248 path.quadTo(717.000000f, 508.242645f, 717.000000f, 507.000000f);
1249 path.close();
1250 path.moveTo(719.000000f, 426.000000f);
1251 path.lineTo(971.000000f, 426.000000f);
1252 path.lineTo(971.000000f, 506.000000f);
1253 path.cubicTo(971.000000f, 507.104584f, 970.104553f, 508.000000f, 969.000000f, 508.000000f);
1254 path.lineTo(721.000000f, 508.000000f);
1255 path.cubicTo(719.895447f, 508.000000f, 719.000000f, 507.104584f, 719.000000f, 506.000000f);
1256 path.lineTo(719.000000f, 426.000000f);
1257 path.close();
1258 SkPath pathB;
1259 pathB.setFillType(SkPath::kWinding_FillType);
1260 pathB.moveTo(717.000000f, 510.000000f);
1261 pathB.lineTo(760.000000f, 467.000000f);
1262 pathB.lineTo(930.000000f, 467.000000f);
1263 pathB.lineTo(973.000000f, 510.000000f);
1264 pathB.lineTo(717.000000f, 510.000000f);
1265 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001266 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.coma5e55922013-05-07 18:51:31 +00001267}
1268
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001269static void skp4(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.coma5e55922013-05-07 18:51:31 +00001270 SkPath path;
1271 path.setFillType(SkPath::kEvenOdd_FillType);
1272 path.moveTo(230.756805f, 591.756775f);
1273 path.quadTo(232.514725f, 590.000000f, 235.000000f, 590.000000f);
1274 path.lineTo(300.000000f, 590.000000f);
1275 path.quadTo(302.485291f, 590.000000f, 304.243195f, 591.756775f);
1276 path.quadTo(306.000000f, 593.514709f, 306.000000f, 596.000000f);
1277 path.lineTo(306.000000f, 617.000000f);
1278 path.lineTo(229.000000f, 617.000000f);
1279 path.lineTo(229.000000f, 596.000000f);
1280 path.quadTo(229.000000f, 593.514709f, 230.756805f, 591.756775f);
1281 path.close();
1282 path.moveTo(231.000000f, 597.000000f);
1283 path.cubicTo(231.000000f, 594.238586f, 233.238571f, 592.000000f, 236.000000f, 592.000000f);
1284 path.lineTo(299.000000f, 592.000000f);
1285 path.cubicTo(301.761414f, 592.000000f, 304.000000f, 594.238586f, 304.000000f, 597.000000f);
1286 path.lineTo(304.000000f, 616.000000f);
1287 path.lineTo(231.000000f, 616.000000f);
1288 path.lineTo(231.000000f, 597.000000f);
1289 path.close();
1290 SkPath pathB;
1291 pathB.setFillType(SkPath::kWinding_FillType);
1292 pathB.moveTo(306.000000f, 590.000000f);
1293 pathB.lineTo(292.000000f, 604.000000f);
1294 pathB.lineTo(305.000000f, 617.000000f);
1295 pathB.lineTo(306.000000f, 617.000000f);
1296 pathB.lineTo(306.000000f, 590.000000f);
1297 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001298 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.coma5e55922013-05-07 18:51:31 +00001299}
1300
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001301static void skp5(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.coma5e55922013-05-07 18:51:31 +00001302 SkPath path;
1303 path.setFillType(SkPath::kEvenOdd_FillType);
1304 path.moveTo(18.0000000f, 226.000000f);
1305 path.quadTo(14.6862917f, 226.000000f, 12.3423996f, 228.342407f);
1306 path.quadTo(10.0000000f, 230.686295f, 10.0000000f, 234.000000f);
1307 path.lineTo(10.0000000f, 253.000000f);
1308 path.lineTo(1247.00000f, 253.000000f);
1309 path.lineTo(1247.00000f, 234.000000f);
1310 path.quadTo(1247.00000f, 230.686295f, 1244.65759f, 228.342407f);
1311 path.quadTo(1242.31372f, 226.000000f, 1239.00000f, 226.000000f);
1312 path.lineTo(18.0000000f, 226.000000f);
1313 path.close();
1314 SkPath pathB;
1315 pathB.setFillType(SkPath::kInverseWinding_FillType);
1316 pathB.moveTo(18.0000000f, 226.000000f);
1317 pathB.lineTo(1239.00000f, 226.000000f);
1318 pathB.cubicTo(1243.41833f, 226.000000f, 1247.00000f, 229.581726f, 1247.00000f, 234.000000f);
1319 pathB.lineTo(1247.00000f, 252.000000f);
1320 pathB.lineTo(10.0000000f, 252.000000f);
1321 pathB.lineTo(10.0000000f, 234.000000f);
1322 pathB.cubicTo(10.0000000f, 229.581726f, 13.5817204f, 226.000000f, 18.0000000f, 226.000000f);
1323 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001324 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.coma5e55922013-05-07 18:51:31 +00001325}
1326
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001327static void cubicOp70d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.coma5e55922013-05-07 18:51:31 +00001328 SkPath path, pathB;
1329 path.setFillType(SkPath::kWinding_FillType);
1330 path.moveTo(0,1);
1331 path.cubicTo(0,5, 4,0, 5,0);
1332 path.close();
1333 pathB.setFillType(SkPath::kWinding_FillType);
1334 pathB.moveTo(0,4);
1335 pathB.cubicTo(0,5, 1,0, 5,0);
1336 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001337 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com6dc7df62013-04-25 11:51:54 +00001338}
1339
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001340static void cubicOp71d(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001341 SkPath path, pathB;
1342 path.setFillType(SkPath::kWinding_FillType);
1343 path.moveTo(0,1);
1344 path.cubicTo(0,5, 4,1, 6,4);
1345 path.close();
1346 pathB.setFillType(SkPath::kWinding_FillType);
1347 pathB.moveTo(1,4);
1348 pathB.cubicTo(4,6, 1,0, 5,0);
1349 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001350 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001351}
1352
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001353static void cubicOp72i(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001354 SkPath path, pathB;
1355 path.setFillType(SkPath::kWinding_FillType);
1356 path.moveTo(0,1);
1357 path.cubicTo(0,5, 5,2, 5,4);
1358 path.close();
1359 pathB.setFillType(SkPath::kWinding_FillType);
1360 pathB.moveTo(2,5);
1361 pathB.cubicTo(4,5, 1,0, 5,0);
1362 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001363 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001364}
1365
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001366static void cubicOp73d(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001367 SkPath path, pathB;
1368 path.setFillType(SkPath::kWinding_FillType);
1369 path.moveTo(0,1);
1370 path.cubicTo(3,4, 4,0, 6,4);
1371 path.lineTo(0,1);
1372 path.close();
1373 pathB.setFillType(SkPath::kWinding_FillType);
1374 pathB.moveTo(0,4);
1375 pathB.cubicTo(4,6, 1,0, 4,3);
1376 pathB.lineTo(0,4);
1377 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001378 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001379}
1380
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001381static void cubicOp74d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001382 SkPath path, pathB;
1383 path.setFillType(SkPath::kWinding_FillType);
1384 path.moveTo(0,1);
1385 path.cubicTo(1,5, 5,1, 5,1);
1386 path.lineTo(0,1);
1387 path.close();
1388 pathB.setFillType(SkPath::kWinding_FillType);
1389 pathB.moveTo(1,5);
1390 pathB.cubicTo(1,5, 1,0, 5,1);
1391 pathB.lineTo(1,5);
1392 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001393 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001394}
1395
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001396static void cubicOp75d(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001397 SkPath path, pathB;
1398 path.setFillType(SkPath::kWinding_FillType);
1399 path.moveTo(0,1);
1400 path.cubicTo(0,4, 5,1, 6,4);
1401 path.lineTo(0,1);
1402 path.close();
1403 pathB.setFillType(SkPath::kWinding_FillType);
1404 pathB.moveTo(1,5);
1405 pathB.cubicTo(4,6, 1,0, 4,0);
1406 pathB.lineTo(1,5);
1407 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001408 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001409}
1410
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001411static void cubicOp76u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001412 SkPath path, pathB;
1413 path.setFillType(SkPath::kWinding_FillType);
1414 path.moveTo(0,1);
1415 path.cubicTo(0,2, 2,0, 5,3);
1416 path.close();
1417 pathB.setFillType(SkPath::kWinding_FillType);
1418 pathB.moveTo(0,2);
1419 pathB.cubicTo(3,5, 1,0, 2,0);
1420 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001421 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001422}
1423
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001424static void cubicOp77i(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001425 SkPath path, pathB;
1426 path.setFillType(SkPath::kEvenOdd_FillType);
1427 path.moveTo(0,1);
1428 path.cubicTo(1,3, 2,0, 3,2);
1429 path.lineTo(0,1);
1430 path.close();
1431 pathB.setFillType(SkPath::kEvenOdd_FillType);
1432 pathB.moveTo(0,2);
1433 pathB.cubicTo(2,3, 1,0, 3,1);
1434 pathB.lineTo(0,2);
1435 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001436 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001437}
1438
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001439static void cubicOp78u(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001440 SkPath path, pathB;
1441 path.setFillType(SkPath::kEvenOdd_FillType);
1442 path.moveTo(1,6);
1443 path.cubicTo(1,6, 5,0, 6,1);
1444 path.lineTo(1,6);
1445 path.close();
1446 pathB.setFillType(SkPath::kEvenOdd_FillType);
1447 pathB.moveTo(0,5);
1448 pathB.cubicTo(1,6, 6,1, 6,1);
1449 pathB.lineTo(0,5);
1450 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001451 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001452}
1453
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001454static void cubicOp79u(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001455 SkPath path, pathB;
1456 path.setFillType(SkPath::kWinding_FillType);
1457 path.moveTo(0,1);
1458 path.cubicTo(1,3, 1,0, 6,4);
1459 path.close();
1460 pathB.setFillType(SkPath::kWinding_FillType);
1461 pathB.moveTo(0,1);
1462 pathB.cubicTo(4,6, 1,0, 3,1);
1463 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001464 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001465}
1466
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001467static void cubicOp80i(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001468 SkPath path, pathB;
1469 path.setFillType(SkPath::kWinding_FillType);
1470 path.moveTo(0,1);
1471 path.cubicTo(2,3, 2,1, 4,3);
1472 path.lineTo(0,1);
1473 path.close();
1474 pathB.setFillType(SkPath::kWinding_FillType);
1475 pathB.moveTo(1,2);
1476 pathB.cubicTo(3,4, 1,0, 3,2);
1477 pathB.lineTo(1,2);
1478 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001479 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001480}
1481
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001482static void cubicOp81d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001483 SkPath path, pathB;
1484 path.setFillType(SkPath::kWinding_FillType);
1485 path.moveTo(0,1);
1486 path.cubicTo(4,6, 4,3, 5,4);
1487 path.close();
1488 pathB.setFillType(SkPath::kWinding_FillType);
1489 pathB.moveTo(3,4);
1490 pathB.cubicTo(4,5, 1,0, 6,4);
1491 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001492 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001493}
1494
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001495static void cubicOp82i(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001496 SkPath path, pathB;
1497 path.setFillType(SkPath::kEvenOdd_FillType);
1498 path.moveTo(0,1);
1499 path.cubicTo(2,3, 5,2, 3,0);
1500 path.lineTo(0,1);
1501 path.close();
1502 pathB.setFillType(SkPath::kWinding_FillType);
1503 pathB.moveTo(2,5);
1504 pathB.cubicTo(0,3, 1,0, 3,2);
1505 pathB.lineTo(2,5);
1506 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001507 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001508}
1509
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001510static void cubicOp83i(skiatest::Reporter* reporter, const char* filename) {
reed@google.com277c3f82013-05-31 15:17:50 +00001511 SkPath path, pathB;
1512 path.setFillType(SkPath::kWinding_FillType);
1513 path.moveTo(0,1);
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001514 path.cubicTo(0,3, 2,1, 4,1);
1515 path.lineTo(0,1);
reed@google.com277c3f82013-05-31 15:17:50 +00001516 path.close();
1517 pathB.setFillType(SkPath::kWinding_FillType);
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001518 pathB.moveTo(1,2);
1519 pathB.cubicTo(1,4, 1,0, 3,0);
1520 pathB.lineTo(1,2);
1521 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001522 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001523}
1524
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001525static void cubicOp84d(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001526 SkPath path, pathB;
1527 path.setFillType(SkPath::kWinding_FillType);
1528 path.moveTo(0,4);
1529 path.cubicTo(2,3, 6,3, 3,2);
1530 path.close();
1531 pathB.setFillType(SkPath::kWinding_FillType);
1532 pathB.moveTo(3,6);
1533 pathB.cubicTo(2,3, 4,0, 3,2);
reed@google.com277c3f82013-05-31 15:17:50 +00001534 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001535 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
reed@google.com277c3f82013-05-31 15:17:50 +00001536}
1537
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001538static void skpClip1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001539 SkPath path;
1540 path.setFillType(SkPath::kEvenOdd_FillType);
1541 path.moveTo(1126.17114f, 877.171204f);
1542 path.quadTo(1127.34314f, 876.000000f, 1129.00000f, 876.000000f);
1543 path.lineTo(1243.00000f, 876.000000f);
1544 path.quadTo(1244.65686f, 876.000000f, 1245.82886f, 877.171204f);
1545 path.quadTo(1247.00000f, 878.343140f, 1247.00000f, 880.000000f);
1546 path.lineTo(1247.00000f, 907.000000f);
1547 path.lineTo(1246.00000f, 907.000000f);
1548 path.lineTo(1246.00000f, 880.000000f);
1549 path.cubicTo(1246.00000f, 878.343140f, 1244.65686f, 877.000000f, 1243.00000f, 877.000000f);
1550 path.lineTo(1129.00000f, 877.000000f);
1551 path.cubicTo(1127.34314f, 877.000000f, 1126.00000f, 878.343140f, 1126.00000f, 880.000000f);
1552 path.lineTo(1126.00000f, 907.000000f);
1553 path.lineTo(1125.00000f, 907.000000f);
1554 path.lineTo(1125.00000f, 880.000000f);
1555 path.quadTo(1125.00000f, 878.343140f, 1126.17114f, 877.171204f);
1556 path.close();
1557 SkPath pathB;
1558 pathB.setFillType(SkPath::kWinding_FillType);
1559 pathB.moveTo(1247.00000f, 876.000000f);
1560 pathB.lineTo(1231.00000f, 892.000000f);
1561 pathB.lineTo(1246.00000f, 907.000000f);
1562 pathB.lineTo(1247.00000f, 907.000000f);
1563 pathB.lineTo(1247.00000f, 876.000000f);
1564 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001565 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001566}
1567
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001568static void skpClip2(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001569 SkPath path;
1570 path.setFillType(SkPath::kEvenOdd_FillType);
1571 path.moveTo(134.000000f, 11414.0000f);
1572 path.cubicTo(131.990234f, 11414.0000f, 130.326660f, 11415.4824f, 130.042755f, 11417.4131f);
1573 path.cubicTo(130.233124f, 11418.3193f, 131.037079f, 11419.0000f, 132.000000f, 11419.0000f);
1574 path.lineTo(806.000000f, 11419.0000f);
1575 path.cubicTo(806.962891f, 11419.0000f, 807.766907f, 11418.3193f, 807.957275f, 11417.4131f);
1576 path.cubicTo(807.673401f, 11415.4824f, 806.009766f, 11414.0000f, 804.000000f, 11414.0000f);
1577 path.lineTo(134.000000f, 11414.0000f);
1578 path.close();
1579 SkPath pathB;
1580 pathB.setFillType(SkPath::kInverseWinding_FillType);
1581 pathB.moveTo(132.000000f, 11415.0000f);
1582 pathB.lineTo(806.000000f, 11415.0000f);
1583 pathB.cubicTo(807.104553f, 11415.0000f, 808.000000f, 11415.4473f, 808.000000f, 11416.0000f);
1584 pathB.lineTo(808.000000f, 11417.0000f);
1585 pathB.cubicTo(808.000000f, 11418.1045f, 807.104553f, 11419.0000f, 806.000000f, 11419.0000f);
1586 pathB.lineTo(132.000000f, 11419.0000f);
1587 pathB.cubicTo(130.895432f, 11419.0000f, 130.000000f, 11418.1045f, 130.000000f, 11417.0000f);
1588 pathB.lineTo(130.000000f, 11416.0000f);
1589 pathB.cubicTo(130.000000f, 11415.4473f, 130.895432f, 11415.0000f, 132.000000f, 11415.0000f);
1590 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001591 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001592}
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001593
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001594static void skp96prezzi1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001595 SkPath path;
1596 path.setFillType(SkPath::kEvenOdd_FillType);
1597 path.moveTo(157.464005f, 670.463989f);
1598 path.quadTo(158.928925f, 669.000000f, 161.000000f, 669.000000f);
1599 path.lineTo(248.000000f, 669.000000f);
1600 path.quadTo(250.071075f, 669.000000f, 251.535995f, 670.463989f);
1601 path.quadTo(253.000000f, 671.928955f, 253.000000f, 674.000000f);
1602 path.lineTo(253.000000f, 706.000000f);
1603 path.lineTo(251.000000f, 706.000000f);
1604 path.lineTo(251.000000f, 675.000000f);
1605 path.cubicTo(251.000000f, 672.790833f, 249.209137f, 671.000000f, 247.000000f, 671.000000f);
1606 path.lineTo(162.000000f, 671.000000f);
1607 path.cubicTo(159.790863f, 671.000000f, 158.000000f, 672.790833f, 158.000000f, 675.000000f);
1608 path.lineTo(158.000000f, 706.000000f);
1609 path.lineTo(156.000000f, 706.000000f);
1610 path.lineTo(156.000000f, 674.000000f);
1611 path.quadTo(156.000000f, 671.928955f, 157.464005f, 670.463989f);
1612 path.close();
1613 SkPath pathB;
1614 pathB.setFillType(SkPath::kWinding_FillType);
1615 pathB.moveTo(156.000000f, 669.000000f);
1616 pathB.lineTo(178.500000f, 691.500000f);
1617 pathB.lineTo(230.500000f, 691.500000f);
1618 pathB.lineTo(253.000000f, 669.000000f);
1619 pathB.lineTo(156.000000f, 669.000000f);
1620 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001621 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001622}
1623
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001624static void skpancestry_com1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001625 SkPath path;
1626 path.setFillType(SkPath::kEvenOdd_FillType);
1627 path.moveTo(161.000000f, 925.000000f);
1628 path.cubicTo(159.874390f, 925.000000f, 158.835663f, 925.371948f, 158.000000f, 925.999634f);
1629 path.lineTo(158.000000f, 926.000000f);
1630 path.lineTo(1108.00000f, 926.000000f);
1631 path.lineTo(1108.00000f, 925.999634f);
1632 path.cubicTo(1107.16443f, 925.371948f, 1106.12561f, 925.000000f, 1105.00000f, 925.000000f);
1633 path.lineTo(161.000000f, 925.000000f);
1634 path.close();
1635 SkPath pathB;
1636 pathB.setFillType(SkPath::kEvenOdd_FillType);
1637 pathB.moveTo(161.000000f, 926.000000f);
1638 pathB.lineTo(1105.00000f, 926.000000f);
1639 pathB.cubicTo(1107.20911f, 926.000000f, 1109.00000f, 927.790833f, 1109.00000f, 930.000000f);
1640 pathB.lineTo(1109.00000f, 956.000000f);
1641 pathB.cubicTo(1109.00000f, 958.209167f, 1107.20911f, 960.000000f, 1105.00000f, 960.000000f);
1642 pathB.lineTo(161.000000f, 960.000000f);
1643 pathB.cubicTo(158.790863f, 960.000000f, 157.000000f, 958.209167f, 157.000000f, 956.000000f);
1644 pathB.lineTo(157.000000f, 930.000000f);
1645 pathB.cubicTo(157.000000f, 927.790833f, 158.790863f, 926.000000f, 161.000000f, 926.000000f);
1646 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001647 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001648}
1649
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001650static void skpeldorado_com_ua1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001651 SkPath path;
1652 path.setFillType(SkPath::kEvenOdd_FillType);
1653 path.moveTo(286.695129f, 291.000000f);
1654 path.lineTo(229.304855f, 561.000000f);
1655 path.lineTo(979.304871f, 561.000000f);
1656 path.lineTo(1036.69507f, 291.000000f);
1657 path.lineTo(286.695129f, 291.000000f);
1658 path.close();
1659 SkPath pathB;
1660 pathB.setFillType(SkPath::kWinding_FillType);
1661 pathB.moveTo(1006.69513f, 291.000000f);
1662 pathB.cubicTo(1023.26367f, 291.000000f, 1033.84021f, 304.431458f, 1030.31836f, 321.000000f);
1663 pathB.lineTo(985.681519f, 531.000000f);
1664 pathB.cubicTo(982.159790f, 547.568542f, 965.873413f, 561.000000f, 949.304871f, 561.000000f);
1665 pathB.lineTo(259.304871f, 561.000000f);
1666 pathB.cubicTo(242.736313f, 561.000000f, 232.159805f, 547.568542f, 235.681549f, 531.000000f);
1667 pathB.lineTo(280.318420f, 321.000000f);
1668 pathB.cubicTo(283.840179f, 304.431458f, 300.126587f, 291.000000f, 316.695129f, 291.000000f);
1669 pathB.lineTo(1006.69513f, 291.000000f);
1670 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001671 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001672}
1673
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001674static void skpbyte_com1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001675 SkPath path;
1676 path.setFillType(SkPath::kEvenOdd_FillType);
1677 path.moveTo(968.000000f, 14.0000000f);
1678 path.cubicTo(965.238586f, 14.0000000f, 963.000000f, 16.2385769f, 963.000000f, 19.0000000f);
1679 path.lineTo(963.000000f, 32.0000000f);
1680 path.cubicTo(963.000000f, 34.7614250f, 965.238586f, 37.0000000f, 968.000000f, 37.0000000f);
1681 path.lineTo(1034.00000f, 37.0000000f);
1682 path.cubicTo(1036.76147f, 37.0000000f, 1039.00000f, 34.7614250f, 1039.00000f, 32.0000000f);
1683 path.lineTo(1039.00000f, 19.0000000f);
1684 path.cubicTo(1039.00000f, 16.2385769f, 1036.76147f, 14.0000000f, 1034.00000f, 14.0000000f);
1685 path.lineTo(968.000000f, 14.0000000f);
1686 path.close();
1687 SkPath pathB;
1688 pathB.setFillType(SkPath::kInverseWinding_FillType);
1689 pathB.moveTo(968.000000f, 14.0000000f);
1690 pathB.lineTo(1034.00000f, 14.0000000f);
1691 pathB.cubicTo(1036.76147f, 14.0000000f, 1039.00000f, 16.2385750f, 1039.00000f, 19.0000000f);
1692 pathB.lineTo(1039.00000f, 32.0000000f);
1693 pathB.cubicTo(1039.00000f, 34.2091408f, 1036.76147f, 36.0000000f, 1034.00000f, 36.0000000f);
1694 pathB.lineTo(968.000000f, 36.0000000f);
1695 pathB.cubicTo(965.238586f, 36.0000000f, 963.000000f, 34.2091408f, 963.000000f, 32.0000000f);
1696 pathB.lineTo(963.000000f, 19.0000000f);
1697 pathB.cubicTo(963.000000f, 16.2385750f, 965.238586f, 14.0000000f, 968.000000f, 14.0000000f);
1698 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001699 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001700}
1701
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001702static void skphealth_com76(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001703 SkPath path;
1704 path.setFillType(SkPath::kEvenOdd_FillType);
1705 path.moveTo(708.099182f, 7.09919119f);
1706 path.lineTo(708.099182f, 7.09920025f);
1707 path.quadTo(704.000000f, 11.2010098f, 704.000000f, 17.0000000f);
1708 path.lineTo(704.000000f, 33.0000000f);
1709 path.lineTo(705.000000f, 33.0000000f);
1710 path.lineTo(705.000000f, 17.0000000f);
1711 path.cubicTo(705.000000f, 13.4101496f, 706.455078f, 10.1601505f, 708.807617f, 7.80761385f);
1712 path.lineTo(708.099182f, 7.09919119f);
1713 path.close();
1714 SkPath pathB;
1715 pathB.setFillType(SkPath::kWinding_FillType);
1716 pathB.moveTo(704.000000f, 3.00000000f);
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001717 pathB.lineTo(704.000000f, 33.0000000f);
1718 pathB.lineTo(705.000000f, 33.0000000f);
1719 pathB.lineTo(719.500000f, 3.00000000f);
caryclark54359292015-03-26 07:52:43 -07001720 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com07e97fc2013-07-08 17:17:02 +00001721}
caryclark@google.comcffbcc32013-06-04 17:59:42 +00001722
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001723static void skpahrefs_com88(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001724 SkPath path;
1725 path.setFillType(SkPath::kEvenOdd_FillType);
1726 path.moveTo(1099.82886f, 7.17117119f);
1727 path.lineTo(1099.12134f, 7.87867832f);
1728 path.cubicTo(1099.66418f, 8.42157173f, 1100.00000f, 9.17157173f, 1100.00000f, 10.0000000f);
1729 path.lineTo(1100.00000f, 28.0000000f);
1730 path.cubicTo(1100.00000f, 29.6568546f, 1098.65686f, 31.0000000f, 1097.00000f, 31.0000000f);
1731 path.lineTo(1088.00000f, 31.0000000f);
1732 path.lineTo(1088.00000f, 32.0000000f);
1733 path.lineTo(1097.00000f, 32.0000000f);
1734 path.quadTo(1098.65686f, 32.0000000f, 1099.82886f, 30.8288002f);
1735 path.quadTo(1101.00000f, 29.6568546f, 1101.00000f, 28.0000000f);
1736 path.lineTo(1101.00000f, 10.0000000f);
1737 path.quadTo(1101.00000f, 8.34314537f, 1099.82886f, 7.17119980f);
1738 path.lineTo(1099.82886f, 7.17117119f);
1739 path.close();
1740 SkPath pathB;
1741 pathB.setFillType(SkPath::kWinding_FillType);
1742 pathB.moveTo(1101.00000f, 6.00000000f);
1743 pathB.lineTo(1088.00000f, 6.00000000f);
1744 pathB.lineTo(1088.00000f, 19.0000000f);
1745 pathB.lineTo(1101.00000f, 32.0000000f);
caryclark54359292015-03-26 07:52:43 -07001746 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001747}
caryclark@google.comfa2aeee2013-07-15 13:29:13 +00001748
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001749static void skpahrefs_com29(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001750 SkPath path;
1751 path.setFillType(SkPath::kEvenOdd_FillType);
1752 path.moveTo(1037.17114f, 7.17119980f);
1753 path.quadTo(1038.34314f, 6.00000000f, 1040.00000f, 6.00000000f);
1754 path.lineTo(1074.00000f, 6.00000000f);
1755 path.lineTo(1074.00000f, 32.0000000f);
1756 path.lineTo(1040.00000f, 32.0000000f);
1757 path.quadTo(1038.34314f, 32.0000000f, 1037.17114f, 30.8288002f);
1758 path.quadTo(1036.00000f, 29.6568546f, 1036.00000f, 28.0000000f);
1759 path.lineTo(1036.00000f, 10.0000000f);
1760 path.quadTo(1036.00000f, 8.34314537f, 1037.17114f, 7.17119980f);
1761 path.close();
1762 path.moveTo(1037.00000f, 10.0000000f);
1763 path.cubicTo(1037.00000f, 8.34314537f, 1038.34314f, 7.00000000f, 1040.00000f, 7.00000000f);
1764 path.lineTo(1073.00000f, 7.00000000f);
1765 path.lineTo(1073.00000f, 31.0000000f);
1766 path.lineTo(1040.00000f, 31.0000000f);
1767 path.cubicTo(1038.34314f, 31.0000000f, 1037.00000f, 29.6568546f, 1037.00000f, 28.0000000f);
1768 path.lineTo(1037.00000f, 10.0000000f);
1769 path.close();
1770 SkPath pathB;
1771 pathB.setFillType(SkPath::kWinding_FillType);
1772 pathB.moveTo(1036.00000f, 32.0000000f);
1773 pathB.lineTo(1049.00000f, 19.0000000f);
1774 pathB.lineTo(1073.00000f, 31.0000000f);
1775 pathB.lineTo(1074.00000f, 32.0000000f);
caryclark54359292015-03-26 07:52:43 -07001776 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001777}
caryclark@google.comfa2aeee2013-07-15 13:29:13 +00001778
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001779static void cubicOp85d(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001780 SkPath path;
1781 path.setFillType(SkPath::kWinding_FillType);
1782 path.moveTo(0,1);
1783 path.cubicTo(1,6, 1,0, 6,2);
1784 path.close();
1785 SkPath pathB;
1786 pathB.setFillType(SkPath::kWinding_FillType);
1787 pathB.moveTo(0,1);
1788 pathB.cubicTo(2,6, 1,0, 6,1);
1789 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001790 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.comfa2aeee2013-07-15 13:29:13 +00001791}
1792
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001793static void skpkkiste_to98(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001794 SkPath path;
1795 path.setFillType(SkPath::kEvenOdd_FillType);
1796 path.moveTo(96, 122);
1797 path.cubicTo(94.6192932f, 122, 93.3692932f, 122.559647f, 92.4644699f, 123.46447f);
1798 path.lineTo(94.1715698f, 125.17157f);
1799 path.cubicTo(94.8954315f, 124.447708f, 95.8954315f, 124, 97, 124);
1800 path.lineTo(257, 124);
1801 path.cubicTo(258.104553f, 124, 259.104584f, 124.447708f, 259.82843f, 125.17157f);
1802 path.lineTo(261.535522f, 123.46447f);
1803 path.cubicTo(260.630707f, 122.559647f, 259.380707f, 122, 258, 122);
1804 path.lineTo(96, 122);
1805 path.close();
1806 SkPath pathB;
1807 pathB.setFillType(SkPath::kWinding_FillType);
1808 pathB.moveTo(258, 122);
1809 pathB.cubicTo(260.761414f, 122, 263, 124.238579f, 263, 127);
1810 pathB.lineTo(263, 284);
1811 pathB.cubicTo(263, 286.761414f, 260.761414f, 289, 258, 289);
1812 pathB.lineTo(96, 289);
1813 pathB.cubicTo(93.2385788f, 289, 91, 286.761414f, 91, 284);
1814 pathB.lineTo(91, 127);
1815 pathB.cubicTo(91, 124.238579f, 93.2385788f, 122, 96, 122);
1816 pathB.lineTo(258, 122);
1817 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001818 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001819}
caryclark@google.comfa2aeee2013-07-15 13:29:13 +00001820
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001821static void issue1417(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.com7f1af502013-07-24 07:01:12 +00001822 SkPath path1;
1823 path1.moveTo(122.58908843994140625f, 82.2836456298828125f);
1824 path1.quadTo(129.8215789794921875f, 80, 138, 80);
1825 path1.quadTo(147.15692138671875f, 80, 155.1280364990234375f, 82.86279296875f);
1826 path1.lineTo(161.1764678955078125f, 100);
1827 path1.lineTo(161.1764678955078125f, 100);
1828 path1.lineTo(115.29412078857421875f, 100);
1829 path1.lineTo(115.29412078857421875f, 100);
1830 path1.lineTo(122.58908843994140625f, 82.2836456298828125f);
1831 path1.lineTo(122.58908843994140625f, 82.2836456298828125f);
1832 path1.close();
1833 path1.moveTo(98.68194580078125f, 140.343841552734375f);
1834 path1.lineTo(115.29412078857421875f, 100);
1835 path1.lineTo(115.29412078857421875f, 100);
1836 path1.lineTo(97.9337615966796875f, 100);
1837 path1.lineTo(97.9337615966796875f, 100);
1838 path1.quadTo(88, 112.94264984130859375f, 88, 130);
1839 path1.quadTo(88, 131.544830322265625f, 88.08148956298828125f, 133.0560302734375f);
1840 path1.lineTo(98.68194580078125f, 140.343841552734375f);
1841 path1.lineTo(98.68194580078125f, 140.343841552734375f);
1842 path1.close();
1843 path1.moveTo(136.969696044921875f, 166.6666717529296875f);
1844 path1.lineTo(98.68194580078125f, 140.343841552734375f);
1845 path1.lineTo(98.68194580078125f, 140.343841552734375f);
1846 path1.lineTo(93.45894622802734375f, 153.02825927734375f);
1847 path1.lineTo(93.45894622802734375f, 153.02825927734375f);
1848 path1.quadTo(96.94116973876953125f, 159.65185546875f, 102.64466094970703125f, 165.3553466796875f);
1849 path1.quadTo(110.7924652099609375f, 173.503143310546875f, 120.8179779052734375f, 177.1177825927734375f);
1850 path1.lineTo(136.969696044921875f, 166.6666717529296875f);
1851 path1.lineTo(136.969696044921875f, 166.6666717529296875f);
1852 path1.close();
1853 path1.moveTo(175.8309783935546875f, 141.5211334228515625f);
1854 path1.lineTo(136.969696044921875f, 166.6666717529296875f);
1855 path1.lineTo(136.969696044921875f, 166.6666717529296875f);
1856 path1.lineTo(153.15728759765625f, 177.7956390380859375f);
1857 path1.lineTo(153.15728759765625f, 177.7956390380859375f);
1858 path1.quadTo(164.392425537109375f, 174.318267822265625f, 173.3553466796875f, 165.3553466796875f);
1859 path1.quadTo(177.805816650390625f, 160.9048614501953125f, 180.90380859375f, 155.8941650390625f);
1860 path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
1861 path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
1862 path1.close();
1863 path1.moveTo(175.8309783935546875f, 141.5211334228515625f);
1864 path1.lineTo(187.8782806396484375f, 133.7258148193359375f);
1865 path1.lineTo(187.8782806396484375f, 133.7258148193359375f);
1866 path1.quadTo(188, 131.8880615234375f, 188, 130);
1867 path1.quadTo(188, 112.942657470703125f, 178.0662384033203125f, 100);
1868 path1.lineTo(161.1764678955078125f, 100);
1869 path1.lineTo(161.1764678955078125f, 100);
1870 path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
1871 path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
1872 path1.close();
1873
1874 SkPath path2;
1875 path2.moveTo(174.117645263671875f, 100);
1876 path2.lineTo(161.1764678955078125f, 100);
1877 path2.lineTo(161.1764678955078125f, 100);
1878 path2.lineTo(155.1280364990234375f, 82.86279296875f);
1879 path2.lineTo(155.1280364990234375f, 82.86279296875f);
1880 path2.quadTo(153.14971923828125f, 82.15229034423828125f, 151.098419189453125f, 81.618133544921875f);
1881 path2.lineTo(143.5294189453125f, 100);
1882 path2.lineTo(143.5294189453125f, 100);
1883 path2.lineTo(161.1764678955078125f, 100);
1884 path2.lineTo(161.1764678955078125f, 100);
1885 path2.lineTo(168.23529052734375f, 120);
1886 path2.lineTo(168.23529052734375f, 120);
1887 path2.lineTo(181.1764678955078125f, 120);
1888 path2.lineTo(181.1764678955078125f, 120);
1889 path2.lineTo(186.3661956787109375f, 134.7042236328125f);
1890 path2.lineTo(186.3661956787109375f, 134.7042236328125f);
1891 path2.lineTo(187.8782806396484375f, 133.7258148193359375f);
1892 path2.lineTo(187.8782806396484375f, 133.7258148193359375f);
1893 path2.quadTo(188, 131.8880615234375f, 188, 130);
1894 path2.quadTo(188, 124.80947113037109375f, 187.080169677734375f, 120);
1895 path2.lineTo(181.1764678955078125f, 120);
1896 path2.lineTo(181.1764678955078125f, 120);
1897 path2.lineTo(174.117645263671875f, 100);
1898 path2.lineTo(174.117645263671875f, 100);
1899 path2.close();
1900 path2.moveTo(88.91983795166015625f, 120);
1901 path2.lineTo(107.0588226318359375f, 120);
1902 path2.lineTo(107.0588226318359375f, 120);
1903 path2.lineTo(98.68194580078125f, 140.343841552734375f);
1904 path2.lineTo(98.68194580078125f, 140.343841552734375f);
1905 path2.lineTo(88.08148956298828125f, 133.0560302734375f);
1906 path2.lineTo(88.08148956298828125f, 133.0560302734375f);
1907 path2.quadTo(88, 131.544830322265625f, 88, 130);
1908 path2.quadTo(88, 124.80951690673828125f, 88.91983795166015625f, 120);
1909 path2.close();
1910 path2.moveTo(96.67621612548828125f, 145.21490478515625f);
1911 path2.lineTo(98.68194580078125f, 140.343841552734375f);
1912 path2.lineTo(98.68194580078125f, 140.343841552734375f);
1913 path2.lineTo(120.68767547607421875f, 155.4727783203125f);
1914 path2.lineTo(120.68767547607421875f, 155.4727783203125f);
1915 path2.lineTo(118.68194580078125f, 160.343841552734375f);
1916 path2.lineTo(118.68194580078125f, 160.343841552734375f);
1917 path2.lineTo(96.67621612548828125f, 145.21490478515625f);
1918 path2.lineTo(96.67621612548828125f, 145.21490478515625f);
1919 path2.close();
1920 path2.moveTo(113.232177734375f, 173.5789947509765625f);
1921 path2.quadTo(116.8802642822265625f, 175.69805908203125f, 120.8179779052734375f, 177.1177825927734375f);
1922 path2.lineTo(132.2864990234375f, 169.6969757080078125f);
1923 path2.lineTo(132.2864990234375f, 169.6969757080078125f);
1924 path2.lineTo(118.68194580078125f, 160.343841552734375f);
1925 path2.lineTo(118.68194580078125f, 160.343841552734375f);
1926 path2.lineTo(113.232177734375f, 173.5789947509765625f);
1927 path2.lineTo(113.232177734375f, 173.5789947509765625f);
1928 path2.close();
caryclark54359292015-03-26 07:52:43 -07001929 // FIXME : difficult data, circle back later
1930 testPathOp(reporter, path1, path2, kUnion_SkPathOp, filename);
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001931}
caryclark@google.com3dd27842013-07-15 15:00:58 +00001932
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001933static void issue1418(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.com7f1af502013-07-24 07:01:12 +00001934 SkPath path1;
1935 path1.moveTo(0, 0);
1936 path1.lineTo(1, 0);
1937 path1.lineTo(1, 0);
1938 path1.lineTo(1, 1);
1939 path1.lineTo(1, 1);
1940 path1.lineTo(0, 1);
1941 path1.lineTo(0, 1);
1942 path1.lineTo(0, 0);
1943 path1.lineTo(0, 0);
1944 path1.close();
1945
1946 SkPath path2;
1947 path2.moveTo(0.64644664525985717773f, -0.35355341434478759766f);
1948 path2.quadTo(0.79289329051971435547f, -0.50000005960464477539f, 1.0000001192092895508f, -0.50000005960464477539f);
1949 path2.quadTo(1.2071068286895751953f, -0.50000005960464477539f, 1.3535535335540771484f, -0.35355341434478759766f);
1950 path2.quadTo(1.5000001192092895508f, -0.20710679888725280762f, 1.5000001192092895508f, 0);
1951 path2.quadTo(1.5000001192092895508f, 0.20710679888725280762f, 1.3535535335540771484f, 0.35355341434478759766f);
1952 path2.quadTo(1.2071068286895751953f, 0.50000005960464477539f, 1.0000001192092895508f, 0.50000005960464477539f);
1953 path2.quadTo(0.79289329051971435547f, 0.50000005960464477539f, 0.64644664525985717773f, 0.35355341434478759766f);
1954 path2.quadTo(0.50000005960464477539f, 0.20710679888725280762f, 0.50000005960464477539f, 0);
caryclark@google.com4fdbb222013-07-23 15:27:41 +00001955 path2.quadTo(0.50000005960464477539f, -0.20710679888725280762f, 0.64644664525985717773f, -0.35355341434478759766f);
caryclark54359292015-03-26 07:52:43 -07001956 testPathOp(reporter, path1, path2, kIntersect_SkPathOp, filename);
skia.committer@gmail.com977409a2013-07-16 07:00:56 +00001957}
caryclark@google.com4fdbb222013-07-23 15:27:41 +00001958
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001959static void cubicOp85i(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.com7f1af502013-07-24 07:01:12 +00001960 SkPath path, pathB;
1961 path.setFillType(SkPath::kWinding_FillType);
1962 path.moveTo(3, 4);
1963 path.cubicTo(1, 5, 4, 3, 6, 4);
1964 path.close();
1965 pathB.setFillType(SkPath::kWinding_FillType);
1966 pathB.moveTo(3, 4);
1967 pathB.cubicTo(4, 6, 4, 3, 5, 1);
1968 pathB.close();
caryclark54359292015-03-26 07:52:43 -07001969 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com4fdbb222013-07-23 15:27:41 +00001970}
1971
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001972static void issue1418b(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00001973 SkPath path1;
1974 path1.moveTo(0, 0);
1975 path1.lineTo(1, 0);
1976 path1.lineTo(1, 1);
1977 path1.lineTo(0, 1);
1978 path1.lineTo(0, 0);
1979 path1.close();
1980 path1.setFillType(SkPath::kWinding_FillType);
1981 SkPath path2;
1982 path2.moveTo(0.646446645f, -0.353553414f);
1983 path2.quadTo(0.792893291f, -0.50000006f, 1.00000012f, -0.50000006f);
1984 path2.quadTo(1.20710683f, -0.50000006f, 1.35355353f, -0.353553414f);
1985 path2.quadTo(1.50000012f, -0.207106799f, 1.50000012f, 0);
1986 path2.quadTo(1.50000012f, 0.207106799f, 1.35355353f, 0.353553414f);
1987 path2.quadTo(1.20710683f, 0.50000006f, 1.00000012f, 0.50000006f);
1988 path2.quadTo(0.792893291f, 0.50000006f, 0.646446645f, 0.353553414f);
1989 path2.quadTo(0.50000006f, 0.207106799f, 0.50000006f, 0);
1990 path2.quadTo(0.50000006f, -0.207106799f, 0.646446645f, -0.353553414f);
1991 path2.close();
1992 path2.moveTo(1.00000012f, 0.50000006f);
1993 path2.lineTo(1.00000012f, 1.00000012f);
1994 path2.lineTo(0.50000006f, 1.00000012f);
1995 path2.quadTo(0.50000006f, 0.792893291f, 0.646446645f, 0.646446645f);
1996 path2.quadTo(0.792893291f, 0.50000006f, 1.00000012f, 0.50000006f);
1997 path2.close();
1998 path2.setFillType(SkPath::kEvenOdd_FillType);
caryclark54359292015-03-26 07:52:43 -07001999 testPathOp(reporter, path1, path2, kIntersect_SkPathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002000}
2001
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002002static void rectOp1i(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002003 SkPath path, pathB;
2004 path.setFillType(SkPath::kWinding_FillType);
2005 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
2006 path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
2007 pathB.setFillType(SkPath::kWinding_FillType);
2008 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
2009 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -07002010 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002011}
2012
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002013static void rectOp2i(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002014 SkPath path, pathB;
2015 path.setFillType(SkPath::kEvenOdd_FillType);
2016 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
2017 path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
2018 pathB.setFillType(SkPath::kWinding_FillType);
2019 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
2020 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -07002021 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002022}
2023
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002024static void rectOp3x(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002025 SkPath path, pathB;
2026 path.setFillType(SkPath::kEvenOdd_FillType);
2027 path.moveTo(0, 0);
2028 path.lineTo(3, 0);
2029 path.lineTo(3, 3);
2030 path.lineTo(0, 3);
2031 path.close();
2032 path.moveTo(2, 2);
2033 path.lineTo(3, 2);
2034 path.lineTo(3, 3);
2035 path.lineTo(2, 3);
2036 path.close();
2037 pathB.setFillType(SkPath::kWinding_FillType);
2038 pathB.moveTo(1, 1);
2039 pathB.lineTo(3, 1);
2040 pathB.lineTo(3, 3);
2041 pathB.lineTo(1, 3);
2042 pathB.close();
2043 pathB.moveTo(2, 2);
2044 pathB.lineTo(3, 2);
2045 pathB.lineTo(3, 3);
2046 pathB.lineTo(2, 3);
2047 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002048 testPathOp(reporter, path, pathB, kXOR_SkPathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002049}
2050
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002051static void issue1435(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002052 SkPath path1;
2053 path1.moveTo(160, 60);
2054 path1.lineTo(220, 230);
2055 path1.lineTo(60, 120);
2056 path1.lineTo(260, 120);
2057 path1.lineTo(90, 230);
2058 path1.lineTo(160, 60);
2059 path1.close();
2060 path1.setFillType(SkPath::kEvenOdd_FillType);
2061
caryclark@google.com570863f2013-09-16 15:55:01 +00002062 SkPath path2;
2063 path2.moveTo(142.589081f, 102.283646f);
2064 path2.quadTo(149.821579f, 100, 158, 100);
2065 path2.quadTo(167.156921f, 100, 175.128036f, 102.862793f);
2066 path2.lineTo(181.176468f, 120);
2067 path2.lineTo(135.294128f, 120);
2068 path2.lineTo(142.589081f, 102.283646f);
2069 path2.close();
2070 path2.moveTo(118.681946f, 160.343842f);
2071 path2.lineTo(135.294128f, 120);
2072 path2.lineTo(117.933762f, 120);
2073 path2.quadTo(108, 132.942657f, 108, 150);
2074 path2.quadTo(108, 151.54483f, 108.08149f, 153.05603f);
2075 path2.lineTo(118.681946f, 160.343842f);
2076 path2.close();
2077 path2.moveTo(156.969696f, 186.666672f);
2078 path2.lineTo(118.681946f, 160.343842f);
2079 path2.lineTo(113.458946f, 173.028259f);
2080 path2.quadTo(116.94117f, 179.651855f, 122.644661f, 185.355347f);
2081 path2.quadTo(130.792465f, 193.503143f, 140.817978f, 197.117783f);
2082 path2.lineTo(156.969696f, 186.666672f);
2083 path2.close();
2084 path2.moveTo(195.830978f, 161.521133f);
2085 path2.lineTo(156.969696f, 186.666672f);
2086 path2.lineTo(173.157288f, 197.795639f);
2087 path2.quadTo(184.392426f, 194.318268f, 193.355347f, 185.355347f);
2088 path2.quadTo(197.805817f, 180.904861f, 200.903809f, 175.894165f);
2089 path2.lineTo(195.830978f, 161.521133f);
2090 path2.close();
2091 path2.moveTo(195.830978f, 161.521133f);
2092 path2.lineTo(207.878281f, 153.725815f);
2093 path2.quadTo(208, 151.888062f, 208, 150);
2094 path2.quadTo(208, 132.942657f, 198.066238f, 120);
2095 path2.lineTo(181.176468f, 120);
2096 path2.lineTo(195.830978f, 161.521133f);
2097 path2.close();
2098 path2.setFillType(SkPath::kEvenOdd_FillType);
caryclark54359292015-03-26 07:52:43 -07002099 testPathOp(reporter, path1, path2, kIntersect_SkPathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002100}
caryclark@google.com570863f2013-09-16 15:55:01 +00002101
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002102static void skpkkiste_to716(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.com7f1af502013-07-24 07:01:12 +00002103 SkPath path;
2104 path.setFillType(SkPath::kEvenOdd_FillType);
2105 path.moveTo(1173, 284);
2106 path.cubicTo(1173, 285.125824f, 1173.37207f, 286.164734f, 1174, 287.000488f);
2107 path.lineTo(1174, 123.999496f);
2108 path.cubicTo(1173.37207f, 124.835243f, 1173, 125.874168f, 1173, 127);
2109 path.lineTo(1173, 284);
2110 path.close();
2111 SkPath pathB;
2112 pathB.setFillType(SkPath::kWinding_FillType);
2113 pathB.moveTo(1340, 122);
2114 pathB.cubicTo(1342.76147f, 122, 1345, 124.238579f, 1345, 127);
2115 pathB.lineTo(1345, 284);
2116 pathB.cubicTo(1345, 286.761414f, 1342.76147f, 289, 1340, 289);
2117 pathB.lineTo(1178, 289);
2118 pathB.cubicTo(1175.23853f, 289, 1173, 286.761414f, 1173, 284);
2119 pathB.lineTo(1173, 127);
2120 pathB.cubicTo(1173, 124.238579f, 1175.23853f, 122, 1178, 122);
2121 pathB.lineTo(1340, 122);
2122 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002123 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.com7f1af502013-07-24 07:01:12 +00002124}
caryclark@google.com3dd27842013-07-15 15:00:58 +00002125
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002126static void loopEdge1(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002127 SkPath path;
2128 path.setFillType(SkPath::kEvenOdd_FillType);
2129 path.moveTo(0,0);
2130 path.lineTo(3,0);
2131 path.lineTo(3,2);
2132 path.lineTo(1,2);
2133 path.lineTo(1,1);
2134 path.lineTo(2,1);
2135 path.lineTo(2,3);
2136 path.lineTo(0,3);
2137 path.close();
2138 SkPath pathB;
2139 pathB.setFillType(SkPath::kEvenOdd_FillType);
2140 pathB.moveTo(1,2);
2141 pathB.lineTo(2,2);
2142 pathB.lineTo(2,4);
2143 pathB.lineTo(1,4);
2144 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002145 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002146}
2147
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002148static void loopEdge2(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002149 SkPath path;
2150 path.setFillType(SkPath::kEvenOdd_FillType);
2151 path.moveTo(0,0);
2152 path.lineTo(3,0);
2153 path.lineTo(3,2);
2154 path.lineTo(1,2);
2155 path.lineTo(1,1);
2156 path.lineTo(2,1);
2157 path.lineTo(2,3);
2158 path.lineTo(0,3);
2159 path.close();
2160 SkPath pathB;
2161 pathB.setFillType(SkPath::kEvenOdd_FillType);
2162 pathB.moveTo(1 - 1e-6f,2);
2163 pathB.lineTo(2 - 1e-6f,2);
2164 pathB.lineTo(2 - 1e-6f,4);
2165 pathB.lineTo(1 - 1e-6f,4);
2166 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002167 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002168}
2169
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002170static void cubicOp86i(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002171 SkPath path, pathB;
2172 path.setFillType(SkPath::kWinding_FillType);
2173 path.moveTo(0, 4);
2174 path.cubicTo(3, 4, 6, 2, 5, 2);
2175 path.close();
2176 pathB.setFillType(SkPath::kEvenOdd_FillType);
2177 pathB.moveTo(2, 6);
2178 pathB.cubicTo(2, 5, 4, 0, 4, 3);
2179 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002180 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002181}
2182
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002183static void cubicOp87u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002184 SkPath path, pathB;
2185 path.setFillType(SkPath::kWinding_FillType);
2186 path.moveTo(0,1);
2187 path.cubicTo(0,2, 2,0, 6,4);
2188 path.close();
2189 pathB.setFillType(SkPath::kWinding_FillType);
2190 pathB.moveTo(0,2);
2191 pathB.cubicTo(4,6, 1,0, 2,0);
2192 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002193 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002194}
2195
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002196static void cubicOp88u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002197 SkPath path, pathB;
2198 path.setFillType(SkPath::kWinding_FillType);
2199 path.moveTo(0,1);
2200 path.cubicTo(2,5, 5,0, 6,4);
2201 path.close();
2202 pathB.setFillType(SkPath::kWinding_FillType);
2203 pathB.moveTo(0,5);
2204 pathB.cubicTo(4,6, 1,0, 5,2);
2205 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002206 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002207}
2208
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002209static void cubicOp89u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002210 SkPath path, pathB;
2211 path.setFillType(SkPath::kWinding_FillType);
2212 path.moveTo(0, 3);
2213 path.cubicTo(1, 6, 5, 0, 6, 3);
2214 path.close();
2215 pathB.setFillType(SkPath::kWinding_FillType);
2216 pathB.moveTo(0, 5);
2217 pathB.cubicTo(3, 6, 3, 0, 6, 1);
2218 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002219 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002220}
2221
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002222static void cubicOp90u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002223 SkPath path, pathB;
2224 path.setFillType(SkPath::kEvenOdd_FillType);
2225 path.moveTo(0, 5);
2226 path.cubicTo(1, 2, 5, 2, 4, 1);
2227 path.close();
2228 pathB.setFillType(SkPath::kEvenOdd_FillType);
2229 pathB.moveTo(2, 5);
2230 pathB.cubicTo(1, 4, 5, 0, 2, 1);
2231 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002232 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002233}
2234
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002235static void cubicOp91u(skiatest::Reporter* reporter, const char* filename) {
caryclark@google.com570863f2013-09-16 15:55:01 +00002236 SkPath path, pathB;
2237 path.setFillType(SkPath::kWinding_FillType);
2238 path.moveTo(1, 6);
2239 path.cubicTo(0, 3, 6, 3, 5, 0);
2240 path.close();
2241 pathB.setFillType(SkPath::kWinding_FillType);
2242 pathB.moveTo(3, 6);
2243 pathB.cubicTo(0, 5, 6, 1, 3, 0);
2244 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002245 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
caryclark@google.com570863f2013-09-16 15:55:01 +00002246}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002247
caryclark54359292015-03-26 07:52:43 -07002248static void skpaaalgarve_org53(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002249 SkPath path;
2250 path.setFillType(SkPath::kEvenOdd_FillType);
2251 path.moveTo(-1.24344979e-014f, 348);
2252 path.lineTo(258, 348);
2253 path.lineTo(258, 322);
2254 path.quadTo(258, 317.857849f, 255.072006f, 314.928009f);
2255 path.quadTo(252.142136f, 312, 248, 312);
2256 path.lineTo(1.77635684e-015f, 312);
2257 path.lineTo(-1.24344979e-014f, 348);
2258 path.close();
2259 SkPath pathB;
2260 pathB.setFillType(SkPath::kWinding_FillType);
2261 pathB.moveTo(0, 312);
2262 pathB.lineTo(258, 312);
2263 pathB.lineTo(258, 348);
2264 pathB.lineTo(0, 348);
2265 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002266 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002267}
2268
caryclark54359292015-03-26 07:52:43 -07002269static void skpabcspark_ca103(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002270 SkPath path;
2271 path.setFillType(SkPath::kEvenOdd_FillType);
2272 path.moveTo(1.99840144e-015f, 494);
2273 path.lineTo(97, 494);
2274 path.quadTo(100.313705f, 494, 102.6576f, 491.657593f);
2275 path.quadTo(105, 489.313721f, 105, 486);
2276 path.lineTo(105, 425);
2277 path.quadTo(105, 421.686279f, 102.6576f, 419.342407f);
2278 path.quadTo(100.313705f, 417, 97, 417);
2279 path.lineTo(2.22044605e-016f, 417);
2280 path.lineTo(1.99840144e-015f, 494);
2281 path.close();
2282 SkPath pathB;
2283 pathB.setFillType(SkPath::kWinding_FillType);
2284 pathB.moveTo(0, 417);
2285 pathB.lineTo(105, 417);
2286 pathB.lineTo(105, 494);
2287 pathB.lineTo(0, 494);
2288 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002289 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002290}
2291
caryclark54359292015-03-26 07:52:43 -07002292static void skpacesoftech_com47(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002293 SkPath path;
2294 path.setFillType(SkPath::kEvenOdd_FillType);
2295 path.moveTo(670.537415f, 285);
2296 path.lineTo(670.387451f, 285);
2297 path.lineTo(596.315186f, 314.850708f);
2298 path.lineTo(626.19696f, 389);
2299 path.lineTo(626.346863f, 389);
2300 path.lineTo(700.419189f, 359.149261f);
2301 path.lineTo(670.537415f, 285);
2302 path.close();
2303 SkPath pathB;
2304 pathB.setFillType(SkPath::kWinding_FillType);
2305 pathB.moveTo(663.318542f, 374.100616f);
2306 pathB.quadTo(647.950989f, 380.293671f, 632.705322f, 373.806305f);
2307 pathB.quadTo(617.459595f, 367.318909f, 611.266541f, 351.951355f);
2308 pathB.quadTo(605.073486f, 336.58374f, 611.560913f, 321.338074f);
2309 pathB.quadTo(618.048279f, 306.092407f, 633.415833f, 299.899353f);
2310 pathB.quadTo(648.783447f, 293.706299f, 664.029114f, 300.193665f);
2311 pathB.quadTo(679.27478f, 306.68103f, 685.467834f, 322.048645f);
2312 pathB.quadTo(691.660889f, 337.416199f, 685.173523f, 352.661896f);
2313 pathB.quadTo(678.686157f, 367.907562f, 663.318542f, 374.100616f);
2314 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002315 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002316}
2317
caryclark54359292015-03-26 07:52:43 -07002318static void skpact_com43(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002319 SkPath path;
2320 path.setFillType(SkPath::kEvenOdd_FillType);
2321 path.moveTo(1.45716772e-016f, 924.336121f);
2322 path.lineTo(-1.11022302e-016f, 920);
2323 path.lineTo(6, 920);
2324 path.lineTo(6, 926);
2325 path.lineTo(1.66389287f, 926);
2326 path.quadTo(1.18842196f, 925.674561f, 0.756800175f, 925.243225f);
2327 path.quadTo(0.325406998f, 924.811523f, 1.45716772e-016f, 924.336121f);
2328 path.close();
2329 path.moveTo(1, 921);
2330 path.lineTo(5, 921);
2331 path.lineTo(5, 925);
2332 path.cubicTo(2.79086018f, 925, 1, 923.209167f, 1, 921);
2333 path.close();
2334 SkPath pathB;
2335 pathB.setFillType(SkPath::kWinding_FillType);
2336 pathB.moveTo(-1, 920);
2337 pathB.lineTo(0, 920);
2338 pathB.lineTo(3, 927);
2339 pathB.lineTo(-1, 927);
caryclark54359292015-03-26 07:52:43 -07002340 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002341}
2342
caryclark54359292015-03-26 07:52:43 -07002343static void skpadbox_lt8(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002344 SkPath path;
2345 path.setFillType(SkPath::kEvenOdd_FillType);
2346 path.moveTo(320.097229f, 628.573669f);
2347 path.lineTo(610.227173f, 85.7786865f);
2348 path.lineTo(946.652588f, 265.601807f);
2349 path.lineTo(656.522644f, 808.39679f);
2350 path.lineTo(320.097229f, 628.573669f);
2351 path.close();
2352 SkPath pathB;
2353 pathB.setFillType(SkPath::kInverseWinding_FillType);
2354 pathB.moveTo(333.866608f, 623.496155f);
2355 pathB.lineTo(613.368042f, 100.585754f);
2356 pathB.cubicTo(613.685303f, 99.9921265f, 614.423767f, 99.7681885f, 615.017395f, 100.085449f);
2357 pathB.lineTo(932.633057f, 269.854553f);
2358 pathB.cubicTo(933.226685f, 270.171875f, 933.450623f, 270.910278f, 933.133301f, 271.503906f);
2359 pathB.lineTo(653.631897f, 794.414307f);
2360 pathB.cubicTo(653.314636f, 795.007935f, 652.576172f, 795.231934f, 651.982544f, 794.914612f);
2361 pathB.lineTo(334.366943f, 625.145508f);
2362 pathB.cubicTo(333.773315f, 624.828247f, 333.549286f, 624.089783f, 333.866608f, 623.496155f);
2363 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002364 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002365}
2366
caryclark54359292015-03-26 07:52:43 -07002367static void skpadindex_de4(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002368 SkPath path;
2369 path.setFillType(SkPath::kEvenOdd_FillType);
2370 path.moveTo(0, 926);
2371 path.lineTo(0, 0);
2372 path.lineTo(1280, 0);
2373 path.lineTo(1280, 926);
2374 path.lineTo(0, 926);
2375 path.close();
2376 SkPath pathB;
2377 pathB.setFillType(SkPath::kWinding_FillType);
2378 pathB.moveTo(0, 312);
2379 pathB.lineTo(8.20486257e-015f, 178);
2380 pathB.lineTo(49, 178);
2381 pathB.lineTo(49, 312);
2382 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002383 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002384}
2385
caryclark54359292015-03-26 07:52:43 -07002386static void skpadithya_putr4_blogspot_com551(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002387 SkPath path;
2388 path.setFillType(SkPath::kEvenOdd_FillType);
2389 path.moveTo(205.605804f, 142.334625f);
2390 path.lineTo(254.665359f, 85.6058044f);
2391 path.lineTo(311.394196f, 134.665359f);
2392 path.lineTo(262.334625f, 191.39418f);
2393 path.lineTo(205.605804f, 142.334625f);
2394 path.close();
2395 SkPath pathB;
2396 pathB.setFillType(SkPath::kWinding_FillType);
2397 pathB.moveTo(283.407959f, 110.462646f);
2398 pathB.cubicTo(298.864319f, 123.829437f, 300.558258f, 147.195221f, 287.191467f, 162.651581f);
2399 pathB.lineTo(286.537354f, 163.407959f);
2400 pathB.cubicTo(273.170563f, 178.864334f, 249.804779f, 180.558258f, 234.348419f, 167.191467f);
2401 pathB.lineTo(233.592026f, 166.537338f);
2402 pathB.cubicTo(218.135666f, 153.170547f, 216.441727f, 129.804779f, 229.808517f, 114.348412f);
2403 pathB.lineTo(230.462646f, 113.592026f);
2404 pathB.cubicTo(243.829437f, 98.1356659f, 267.195221f, 96.4417267f, 282.651581f, 109.808517f);
2405 pathB.lineTo(283.407959f, 110.462646f);
2406 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002407 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002408}
2409
caryclark54359292015-03-26 07:52:43 -07002410static void skpadspert_de11(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002411 SkPath path;
2412 path.setFillType(SkPath::kEvenOdd_FillType);
2413 path.moveTo(-4.4408921e-016f, 682.5f);
2414 path.lineTo(30.5f, 682.5f);
2415 path.cubicTo(32.709137f, 682.5f, 34.5f, 680.709167f, 34.5f, 678.5f);
2416 path.lineTo(34.5f, 486.5f);
2417 path.cubicTo(34.5f, 484.290863f, 32.709137f, 482.5f, 30.5f, 482.5f);
2418 path.lineTo(0, 482.5f);
2419 path.lineTo(-4.4408921e-016f, 682.5f);
2420 path.close();
2421 SkPath pathB;
2422 pathB.setFillType(SkPath::kWinding_FillType);
2423 pathB.moveTo(0, 482);
2424 pathB.lineTo(35, 482);
2425 pathB.lineTo(35, 683);
2426 pathB.lineTo(0, 683);
2427 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002428 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002429}
2430
caryclark54359292015-03-26 07:52:43 -07002431static void skpaiaigames_com870(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002432 SkPath path;
2433 path.setFillType(SkPath::kEvenOdd_FillType);
2434 path.moveTo(324.071075f, 845.071045f);
2435 path.cubicTo(324.405151f, 844.737f, 324.715668f, 844.379395f, 325, 844.000977f);
2436 path.lineTo(325, 842.127197f);
2437 path.cubicTo(324.571411f, 842.956238f, 324.017761f, 843.710144f, 323.363953f, 844.363953f);
2438 path.lineTo(324.071075f, 845.071045f);
2439 path.close();
2440 path.moveTo(323.363953f, 714.636047f);
2441 path.lineTo(324.071075f, 713.928955f);
2442 path.cubicTo(324.405151f, 714.263f, 324.715668f, 714.620605f, 325, 714.999023f);
2443 path.lineTo(325, 716.872803f);
2444 path.cubicTo(324.571411f, 716.043762f, 324.017761f, 715.289856f, 323.363953f, 714.636047f);
2445 path.close();
2446 SkPath pathB;
2447 pathB.setFillType(SkPath::kWinding_FillType);
2448 pathB.moveTo(317, 711);
2449 pathB.cubicTo(322.522858f, 711, 327, 715.477173f, 327, 721);
2450 pathB.lineTo(327, 838);
2451 pathB.cubicTo(327, 843.522827f, 322.522858f, 848, 317, 848);
2452 pathB.lineTo(155, 848);
2453 pathB.cubicTo(149.477158f, 848, 145, 843.522827f, 145, 838);
2454 pathB.lineTo(145, 721);
2455 pathB.cubicTo(145, 715.477173f, 149.477158f, 711, 155, 711);
2456 pathB.lineTo(317, 711);
2457 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002458 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_runFail);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002459}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002460
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002461static void cubicOp92i(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002462 SkPath path, pathB;
2463 path.setFillType(SkPath::kWinding_FillType);
2464 path.moveTo(0, 1);
2465 path.cubicTo(2, 6, 4, 1, 5, 4);
2466 path.close();
2467 pathB.setFillType(SkPath::kWinding_FillType);
2468 pathB.moveTo(1, 4);
2469 pathB.cubicTo(4, 5, 1, 0, 6, 2);
2470 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002471 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002472}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002473
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002474static void cubicOp93d(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002475 SkPath path, pathB;
2476 path.setFillType(SkPath::kWinding_FillType);
2477 path.moveTo(0, 1);
2478 path.cubicTo(1, 6, 4, 1, 4, 3);
2479 path.close();
2480 pathB.setFillType(SkPath::kWinding_FillType);
2481 pathB.moveTo(1, 4);
2482 pathB.cubicTo(3, 4, 1, 0, 6, 1);
2483 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002484 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002485}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002486
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002487static void cubicOp94u(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002488 SkPath path, pathB;
2489 path.setFillType(SkPath::kEvenOdd_FillType);
2490 path.moveTo(0, 3);
2491 path.cubicTo(2, 3, 5, 0, 5, 3);
2492 path.close();
2493 pathB.setFillType(SkPath::kEvenOdd_FillType);
2494 pathB.moveTo(0, 5);
2495 pathB.cubicTo(3, 5, 3, 0, 3, 2);
2496 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002497 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002498}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002499
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002500static void skpadbox_lt15(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002501 SkPath path;
2502 path.setFillType(SkPath::kEvenOdd_FillType);
2503 path.moveTo(333.292084f, 624.570984f);
2504 path.lineTo(614.229797f, 98.9735107f);
2505 path.lineTo(933.457764f, 269.604431f);
2506 path.lineTo(652.52002f, 795.201904f);
2507 path.lineTo(333.292084f, 624.570984f);
2508 path.close();
2509 SkPath pathB;
2510 pathB.setFillType(SkPath::kWinding_FillType);
2511 pathB.moveTo(613.368042f, 100.585754f);
2512 pathB.cubicTo(613.685303f, 99.9921265f, 614.423767f, 99.7681885f, 615.017395f, 100.085449f);
2513 pathB.lineTo(932.633057f, 269.854553f);
2514 pathB.cubicTo(933.226685f, 270.171875f, 933.450623f, 270.910278f, 933.133301f, 271.503906f);
2515 pathB.lineTo(653.631897f, 794.414307f);
2516 pathB.cubicTo(653.314636f, 795.007935f, 652.576172f, 795.231934f, 651.982544f, 794.914612f);
2517 pathB.lineTo(334.366943f, 625.145508f);
2518 pathB.cubicTo(333.773315f, 624.828247f, 333.549286f, 624.089783f, 333.866608f, 623.496155f);
2519 pathB.lineTo(613.368042f, 100.585754f);
2520 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002521 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002522}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002523
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002524static void skpadoption_org196(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002525 SkPath path;
2526 path.setFillType(SkPath::kEvenOdd_FillType);
2527 path.moveTo(802, 367);
2528 path.lineTo(802, 324);
2529 path.lineTo(956, 324);
2530 path.lineTo(956, 371);
2531 path.quadTo(956, 373.071075f, 954.536011f, 374.536011f);
2532 path.quadTo(953.071045f, 376, 951, 376);
2533 path.lineTo(811, 376);
2534 path.cubicTo(806.029419f, 376, 802, 371.970551f, 802, 367);
2535 path.close();
2536 SkPath pathB;
2537 pathB.setFillType(SkPath::kInverseWinding_FillType);
2538 pathB.moveTo(803, 326);
2539 pathB.lineTo(955, 326);
2540 pathB.lineTo(955, 370);
2541 pathB.cubicTo(955, 372.761414f, 952.761414f, 375, 950, 375);
2542 pathB.lineTo(808, 375);
2543 pathB.cubicTo(805.238586f, 375, 803, 372.761414f, 803, 370);
2544 pathB.lineTo(803, 326);
2545 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002546 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002547}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002548
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002549static void skpadspert_net23(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002550 SkPath path;
2551 path.setFillType(SkPath::kEvenOdd_FillType);
2552 path.moveTo(-2.220446e-018f, 483.5f);
2553 path.lineTo(0, 482.5f);
2554 path.lineTo(30.5f, 482.5f);
2555 path.cubicTo(32.709137f, 482.5f, 34.5f, 484.290863f, 34.5f, 486.5f);
2556 path.lineTo(34.5f, 678.5f);
2557 path.cubicTo(34.5f, 680.709167f, 32.709137f, 682.5f, 30.5f, 682.5f);
2558 path.lineTo(-4.4408921e-016f, 682.5f);
2559 path.lineTo(-4.41868766e-016f, 681.5f);
2560 path.lineTo(30.5f, 681.5f);
2561 path.cubicTo(32.1568565f, 681.5f, 33.5f, 680.15686f, 33.5f, 678.5f);
2562 path.lineTo(33.5f, 486.5f);
2563 path.cubicTo(33.5f, 484.84314f, 32.1568565f, 483.5f, 30.5f, 483.5f);
2564 path.lineTo(-2.220446e-018f, 483.5f);
2565 path.close();
2566 SkPath pathB;
2567 pathB.setFillType(SkPath::kWinding_FillType);
2568 pathB.moveTo(0, 482);
2569 pathB.lineTo(35, 482);
2570 pathB.lineTo(35, 683);
2571 pathB.lineTo(0, 683);
2572 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002573 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002574}
2575
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002576static void skpadventistmission_org572(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002577 SkPath path;
2578 path.setFillType(SkPath::kEvenOdd_FillType);
2579 path.moveTo(1182.00037f, 926);
2580 path.cubicTo(1181.08813f, 924.785583f, 1179.63586f, 924, 1178, 924);
2581 path.lineTo(938, 924);
2582 path.cubicTo(936.364197f, 924, 934.911865f, 924.785583f, 933.999634f, 926);
2583 path.lineTo(1182.00037f, 926);
2584 path.close();
2585 SkPath pathB;
2586 pathB.setFillType(SkPath::kWinding_FillType);
2587 pathB.moveTo(934, 924);
2588 pathB.lineTo(1182, 924);
2589 pathB.lineTo(1182, 926);
2590 pathB.lineTo(934, 926);
2591 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002592 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002593}
2594
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002595static void skpagentxsites_com55(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002596 SkPath path;
2597 path.setFillType(SkPath::kEvenOdd_FillType);
2598 path.moveTo(925, 27);
2599 path.cubicTo(924.447693f, 27, 924, 27.4477158f, 924, 28);
2600 path.lineTo(924, 55);
2601 path.cubicTo(924, 55.5522842f, 924.447693f, 56, 925, 56);
2602 path.lineTo(1103, 56);
2603 path.cubicTo(1103.55225f, 56, 1104, 55.5522842f, 1104, 55);
2604 path.lineTo(1104, 28);
2605 path.cubicTo(1104, 27.4477158f, 1103.55225f, 27, 1103, 27);
2606 path.lineTo(925, 27);
2607 path.close();
2608 SkPath pathB;
2609 pathB.setFillType(SkPath::kWinding_FillType);
2610 pathB.moveTo(1103, 27);
2611 pathB.cubicTo(1104.10461f, 27, 1105, 27.8954315f, 1105, 29);
2612 pathB.lineTo(1105, 54);
2613 pathB.cubicTo(1105, 55.1045685f, 1104.10461f, 56, 1103, 56);
2614 pathB.lineTo(926, 56);
2615 pathB.cubicTo(924.895447f, 56, 924, 55.1045685f, 924, 54);
2616 pathB.lineTo(924, 29);
2617 pathB.cubicTo(924, 27.8954315f, 924.895447f, 27, 926, 27);
2618 pathB.lineTo(1103, 27);
2619 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002620 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002621}
2622
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002623static void skpbakosoft_com10(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002624 SkPath path;
2625 path.setFillType(SkPath::kEvenOdd_FillType);
2626 path.moveTo(190, 170);
2627 path.cubicTo(178.9543f, 170, 170, 178.9543f, 170, 190);
2628 path.cubicTo(170, 201.0457f, 178.9543f, 210, 190, 210);
2629 path.lineTo(370, 210);
2630 path.cubicTo(381.045685f, 210, 390, 201.0457f, 390, 190);
2631 path.cubicTo(390, 178.9543f, 381.045685f, 170, 370, 170);
2632 path.lineTo(190, 170);
2633 path.close();
2634 SkPath pathB;
2635 pathB.setFillType(SkPath::kWinding_FillType);
2636 pathB.moveTo(210, 190);
2637 pathB.quadTo(210, 198.284271f, 204.142136f, 204.142136f);
2638 pathB.quadTo(198.284271f, 210, 190, 210);
2639 pathB.quadTo(181.715729f, 210, 175.857864f, 204.142136f);
2640 pathB.quadTo(170, 198.284271f, 170, 190);
2641 pathB.quadTo(170, 181.715729f, 175.857864f, 175.857864f);
2642 pathB.quadTo(181.715729f, 170, 190, 170);
2643 pathB.quadTo(198.284271f, 170, 204.142136f, 175.857864f);
2644 pathB.quadTo(210, 181.715729f, 210, 190);
2645 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002646 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002647}
2648
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002649static void skpbambootheme_com12(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002650 SkPath path;
2651 path.setFillType(SkPath::kEvenOdd_FillType);
2652 path.moveTo(47.8780937f, 58);
2653 path.lineTo(0, 58);
2654 path.lineTo(-8.65973959e-015f, 96.9914017f);
2655 path.quadTo(20.0654926f, 96.6451874f, 34.3553391f, 82.3553391f);
2656 path.quadTo(44.9466133f, 71.764061f, 47.8780937f, 58);
2657 path.close();
2658 SkPath pathB;
2659 pathB.setFillType(SkPath::kEvenOdd_FillType);
2660 pathB.moveTo(-1, -3);
2661 pathB.lineTo(-1, -3);
2662 pathB.cubicTo(26.6142502f, -3, 49, 19.3857498f, 49, 47);
2663 pathB.lineTo(49, 47);
2664 pathB.cubicTo(49, 74.6142502f, 26.6142502f, 97, -1, 97);
2665 pathB.lineTo(-1, 97);
2666 pathB.cubicTo(-28.6142502f, 97, -51, 74.6142502f, -51, 47);
2667 pathB.lineTo(-51, 47);
2668 pathB.cubicTo(-51, 19.3857498f, -28.6142502f, -3, -1, -3);
2669 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002670 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002671}
2672
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002673static void skpakmmos_ru100(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002674 SkPath path;
2675 path.setFillType(SkPath::kEvenOdd_FillType);
2676 path.moveTo(693.000488f, 926);
2677 path.cubicTo(692.164734f, 925.37207f, 691.125793f, 925, 690, 925);
2678 path.lineTo(578, 925);
2679 path.cubicTo(576.874207f, 925, 575.835266f, 925.37207f, 574.999512f, 926);
2680 path.lineTo(693.000488f, 926);
2681 path.close();
2682 SkPath pathB;
2683 pathB.setFillType(SkPath::kWinding_FillType);
2684 pathB.moveTo(575, 925);
2685 pathB.lineTo(693, 925);
2686 pathB.lineTo(693, 926);
2687 pathB.lineTo(575, 926);
2688 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002689 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002690}
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002691
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002692static void skpcarpetplanet_ru22(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002693 SkPath path;
2694 path.setFillType(SkPath::kEvenOdd_FillType);
2695 path.moveTo(195, 785);
2696 path.cubicTo(124.307556f, 785, 67, 841.859863f, 67, 912);
2697 path.lineTo(67, 913);
2698 path.cubicTo(67, 917.388916f, 67.2243805f, 921.725769f, 67.662384f, 926);
2699 path.lineTo(322, 926);
2700 path.lineTo(322, 896.048035f);
2701 path.cubicTo(314.09201f, 833.437622f, 260.247131f, 785, 195, 785);
2702 path.close();
2703 SkPath pathB;
2704 pathB.setFillType(SkPath::kWinding_FillType);
2705 pathB.moveTo(195, 785);
2706 pathB.cubicTo(265.140167f, 785, 322, 842.307556f, 322, 913);
2707 pathB.cubicTo(322, 983.692444f, 265.140167f, 1041, 195, 1041);
2708 pathB.lineTo(194, 1041);
2709 pathB.cubicTo(123.85984f, 1041, 67, 983.692444f, 67, 913);
2710 pathB.cubicTo(67, 842.307556f, 123.85984f, 785, 194, 785);
2711 pathB.lineTo(195, 785);
2712 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002713 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002714}
2715
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002716static void skpcarrot_is24(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002717 SkPath path;
2718 path.setFillType(SkPath::kEvenOdd_FillType);
2719 path.moveTo(945, 597);
2720 path.quadTo(913.93396f, 597, 891.96698f, 618.96698f);
2721 path.quadTo(870, 640.93396f, 870, 672);
2722 path.quadTo(870, 703.06604f, 891.96698f, 725.03302f);
2723 path.quadTo(913.93396f, 747, 945, 747);
2724 path.quadTo(976.06604f, 747, 998.03302f, 725.03302f);
2725 path.quadTo(1020, 703.06604f, 1020, 672);
2726 path.quadTo(1020, 640.93396f, 998.03302f, 618.96698f);
2727 path.quadTo(976.06604f, 597, 945, 597);
2728 path.close();
2729 SkPath pathB;
2730 pathB.setFillType(SkPath::kWinding_FillType);
2731 pathB.moveTo(945.080994f, 597.161987f);
2732 pathB.cubicTo(903.659973f, 597.161987f, 870.080994f, 630.73999f, 870.080994f, 672.161987f);
2733 pathB.cubicTo(870.080994f, 676.096008f, 870.387024f, 679.957031f, 870.971008f, 683.726013f);
2734 pathB.cubicTo(876.53302f, 719.656006f, 907.593994f, 747.161987f, 945.080994f, 747.161987f);
2735 pathB.cubicTo(982.567993f, 747.161987f, 1013.62903f, 719.656006f, 1019.19104f, 683.726013f);
2736 pathB.cubicTo(1019.77502f, 679.955017f, 1020.08099f, 676.094971f, 1020.08099f, 672.161987f);
2737 pathB.cubicTo(1020.08002f, 630.73999f, 986.502014f, 597.161987f, 945.080994f, 597.161987f);
2738 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002739 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002740}
2741
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002742static void skpbangalorenest_com4(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(0, 926);
2746 path.lineTo(0, 0);
2747 path.lineTo(1265, 0);
2748 path.lineTo(1265, 926);
2749 path.lineTo(0, 926);
2750 path.close();
2751 SkPath pathB;
2752 pathB.setFillType(SkPath::kWinding_FillType);
2753 pathB.moveTo(0, 290);
2754 pathB.lineTo(-2.64514972e-014f, 146);
2755 pathB.lineTo(30, 146);
2756 pathB.lineTo(30, 290);
2757 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002758 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002759}
2760
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002761static void skpbenzoteh_ru152(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002762 SkPath path;
2763 path.setFillType(SkPath::kEvenOdd_FillType);
2764 path.moveTo(883, 23);
2765 path.lineTo(883, 0);
2766 path.lineTo(1122.5f, 0);
2767 path.lineTo(1122.5f, 25.2136822f);
2768 path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2769 path.quadTo(1120.07104f, 28, 1118, 28);
2770 path.lineTo(888, 28);
2771 path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2772 path.quadTo(883, 25.0710678f, 883, 23);
2773 path.close();
2774 SkPath pathB;
2775 pathB.setFillType(SkPath::kWinding_FillType);
2776 pathB.moveTo(883, 0);
2777 pathB.lineTo(1123, 0);
2778 pathB.lineTo(1123, 23);
2779 pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2780 pathB.quadTo(1120.07104f, 28, 1118, 28);
2781 pathB.lineTo(888, 28);
2782 pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2783 pathB.quadTo(883, 25.0710678f, 883, 23);
2784 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002785 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002786}
2787
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002788static void skpbestred_ru37(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002789 SkPath path;
2790 path.setFillType(SkPath::kEvenOdd_FillType);
2791 path.moveTo(883, 23);
2792 path.lineTo(883, 0);
2793 path.lineTo(1122.5f, 0);
2794 path.lineTo(1122.5f, 25.2136822f);
2795 path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2796 path.quadTo(1120.07104f, 28, 1118, 28);
2797 path.lineTo(888, 28);
2798 path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2799 path.quadTo(883, 25.0710678f, 883, 23);
2800 path.close();
2801 SkPath pathB;
2802 pathB.setFillType(SkPath::kWinding_FillType);
2803 pathB.moveTo(883, 0);
2804 pathB.lineTo(1123, 0);
2805 pathB.lineTo(1123, 23);
2806 pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2807 pathB.quadTo(1120.07104f, 28, 1118, 28);
2808 pathB.lineTo(888, 28);
2809 pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2810 pathB.quadTo(883, 25.0710678f, 883, 23);
2811 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002812 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002813}
2814
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002815static void skpbingoentertainment_net189(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002816 SkPath path;
2817 path.setFillType(SkPath::kEvenOdd_FillType);
2818 path.moveTo(896, 745.38678f);
2819 path.lineTo(896, 873.38678f);
2820 path.lineTo(922.567993f, 876.683716f);
2821 path.lineTo(922.567993f, 748.683716f);
2822 path.lineTo(896, 745.38678f);
2823 path.close();
2824 SkPath pathB;
2825 pathB.setFillType(SkPath::kWinding_FillType);
2826 pathB.moveTo(899.200928f, 745.783997f);
2827 pathB.cubicTo(897.119385f, 745.525696f, 895.432007f, 752.031982f, 895.432007f, 760.316284f);
2828 pathB.lineTo(895.432007f, 858.316284f);
2829 pathB.cubicTo(895.432007f, 866.600586f, 897.119385f, 873.525696f, 899.200928f, 873.783997f);
2830 pathB.lineTo(918.799133f, 876.216003f);
2831 pathB.cubicTo(920.880615f, 876.474304f, 922.567993f, 869.968018f, 922.567993f, 861.683716f);
2832 pathB.lineTo(922.567993f, 763.683716f);
2833 pathB.cubicTo(922.567993f, 755.399414f, 920.880615f, 748.474304f, 918.799133f, 748.216003f);
2834 pathB.lineTo(899.200928f, 745.783997f);
2835 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002836 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002837}
2838
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002839static void skpcarrefour_ro62(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002840 SkPath path;
2841 path.setFillType(SkPath::kEvenOdd_FillType);
2842 path.moveTo(1104, 453);
2843 path.lineTo(399, 453);
2844 path.lineTo(399, 657);
2845 path.cubicTo(399, 661.970581f, 403.029449f, 666, 408, 666);
2846 path.lineTo(1095, 666);
2847 path.cubicTo(1099.97058f, 666, 1104, 661.970581f, 1104, 657);
2848 path.lineTo(1104, 453);
2849 path.close();
2850 SkPath pathB;
2851 pathB.setFillType(SkPath::kInverseWinding_FillType);
2852 pathB.moveTo(400, 453);
2853 pathB.lineTo(1103, 453);
2854 pathB.lineTo(1103, 666);
2855 pathB.lineTo(406, 666);
2856 pathB.cubicTo(402.686279f, 666, 400, 663.313721f, 400, 660);
2857 pathB.lineTo(400, 453);
2858 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002859 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002860}
2861
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002862static void skpcaffelavazzait_com_ua21(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002863 SkPath path;
2864 path.setFillType(SkPath::kEvenOdd_FillType);
2865 path.moveTo(883, 23);
2866 path.lineTo(883, 0);
2867 path.lineTo(1122.5f, 0);
2868 path.lineTo(1122.5f, 25.2136822f);
2869 path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2870 path.quadTo(1120.07104f, 28, 1118, 28);
2871 path.lineTo(888, 28);
2872 path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2873 path.quadTo(883, 25.0710678f, 883, 23);
2874 path.close();
2875 SkPath pathB;
2876 pathB.setFillType(SkPath::kWinding_FillType);
2877 pathB.moveTo(883, 0);
2878 pathB.lineTo(1123, 0);
2879 pathB.lineTo(1123, 23);
2880 pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2881 pathB.quadTo(1120.07104f, 28, 1118, 28);
2882 pathB.lineTo(888, 28);
2883 pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2884 pathB.quadTo(883, 25.0710678f, 883, 23);
2885 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002886 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002887}
2888
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002889static void skpcamcorder_kz21(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002890 SkPath path;
2891 path.setFillType(SkPath::kEvenOdd_FillType);
2892 path.moveTo(883, 23);
2893 path.lineTo(883, 0);
2894 path.lineTo(1122.5f, 0);
2895 path.lineTo(1122.5f, 25.2136822f);
2896 path.quadTo(1122.14441f, 25.9271851f, 1121.53601f, 26.5359993f);
2897 path.quadTo(1120.07104f, 28, 1118, 28);
2898 path.lineTo(888, 28);
2899 path.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2900 path.quadTo(883, 25.0710678f, 883, 23);
2901 path.close();
2902 SkPath pathB;
2903 pathB.setFillType(SkPath::kWinding_FillType);
2904 pathB.moveTo(883, 0);
2905 pathB.lineTo(1123, 0);
2906 pathB.lineTo(1123, 23);
2907 pathB.quadTo(1123, 25.0710678f, 1121.53601f, 26.5359993f);
2908 pathB.quadTo(1120.07104f, 28, 1118, 28);
2909 pathB.lineTo(888, 28);
2910 pathB.quadTo(885.928955f, 28, 884.463989f, 26.5359993f);
2911 pathB.quadTo(883, 25.0710678f, 883, 23);
2912 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002913 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002914}
2915
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002916static void skpcavablar_net563(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002917 SkPath path;
2918 path.setFillType(SkPath::kEvenOdd_FillType);
2919 path.moveTo(160.000488f, 918);
2920 path.cubicTo(159.164749f, 917.37207f, 158.125824f, 917, 157, 917);
2921 path.lineTo(94, 917);
2922 path.cubicTo(92.874176f, 917, 91.8352661f, 917.37207f, 90.9995193f, 918);
2923 path.lineTo(160.000488f, 918);
2924 path.close();
2925 SkPath pathB;
2926 pathB.setFillType(SkPath::kWinding_FillType);
2927 pathB.moveTo(91, 917);
2928 pathB.lineTo(160, 917);
2929 pathB.lineTo(160, 918);
2930 pathB.lineTo(91, 918);
2931 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002932 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002933}
2934
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002935static void skpinsomnia_gr72(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002936 SkPath path;
2937 path.setFillType(SkPath::kEvenOdd_FillType);
2938 path.moveTo(1138, 231);
2939 path.lineTo(1137, 243.625748f);
2940 path.lineTo(1137, 926);
2941 path.lineTo(1139, 926);
2942 path.lineTo(1139, 231);
2943 path.lineTo(1138, 231);
2944 path.close();
2945 SkPath pathB;
2946 pathB.setFillType(SkPath::kWinding_FillType);
2947 pathB.moveTo(1139, 231);
2948 pathB.lineTo(1138, 231);
2949 pathB.lineTo(633, 6101);
2950 pathB.lineTo(1139, 6607);
caryclark54359292015-03-26 07:52:43 -07002951 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002952}
2953
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002954static void cubicOp95u(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002955 SkPath path, pathB;
2956 path.setFillType(SkPath::kEvenOdd_FillType);
2957 path.moveTo(0, 2);
2958 path.cubicTo(2, 3, 5, 1, 3, 2);
2959 path.close();
2960 pathB.setFillType(SkPath::kEvenOdd_FillType);
2961 pathB.moveTo(1, 5);
2962 pathB.cubicTo(2, 3, 2, 0, 3, 2);
2963 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002964 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002965}
2966
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002967static void cubicOp96d(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comb0a05892013-10-03 07:01:37 +00002968 SkPath path, pathB;
2969 path.setFillType(SkPath::kEvenOdd_FillType);
2970 path.moveTo(1, 6);
2971 path.cubicTo(0, 3, 6, 3, 5, 0);
2972 path.close();
2973 pathB.setFillType(SkPath::kEvenOdd_FillType);
2974 pathB.moveTo(3, 6);
2975 pathB.cubicTo(0, 5, 6, 1, 3, 0);
2976 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002977 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00002978}
2979
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002980static void cubicOp97x(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comf54ad6f2013-11-02 07:02:02 +00002981 SkPath path, pathB;
2982 path.setFillType(SkPath::kEvenOdd_FillType);
2983 path.moveTo(0, 2);
2984 path.cubicTo(0, 6, 2, 1, 2, 1);
2985 path.close();
2986 pathB.setFillType(SkPath::kEvenOdd_FillType);
2987 pathB.moveTo(1, 2);
2988 pathB.cubicTo(1, 2, 2, 0, 6, 0);
2989 pathB.close();
caryclark54359292015-03-26 07:52:43 -07002990 testPathOp(reporter, path, pathB, kXOR_SkPathOp, filename);
caryclark@google.coma2bbc6e2013-11-01 17:36:03 +00002991}
2992
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00002993static void cubicOp98x(skiatest::Reporter* reporter, const char* filename) {
skia.committer@gmail.comf54ad6f2013-11-02 07:02:02 +00002994 SkPath path, pathB;
2995 path.setFillType(SkPath::kEvenOdd_FillType);
2996 path.moveTo(0, 3);
2997 path.cubicTo(3, 6, 4, 1, 6, 3);
2998 path.close();
2999 pathB.setFillType(SkPath::kEvenOdd_FillType);
3000 pathB.moveTo(1, 4);
3001 pathB.cubicTo(3, 6, 3, 0, 6, 3);
3002 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003003 testPathOp(reporter, path, pathB, kXOR_SkPathOp, filename);
caryclark@google.coma2bbc6e2013-11-01 17:36:03 +00003004}
3005
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003006static void cubicOp99(skiatest::Reporter* reporter, const char* filename) {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +00003007 SkPath path, pathB;
3008 path.setFillType(SkPath::kWinding_FillType);
3009 path.moveTo(3,6);
3010 path.cubicTo(0,3, 6,5, 5,4);
3011 path.close();
3012 pathB.setFillType(SkPath::kWinding_FillType);
3013 pathB.moveTo(5,6);
3014 pathB.cubicTo(4,5, 6,3, 3,0);
3015 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003016 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +00003017}
3018
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003019static void cubicOp100(skiatest::Reporter* reporter, const char* filename) {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +00003020 SkPath path, pathB;
3021 path.setFillType(SkPath::kWinding_FillType);
3022 path.moveTo(0,1);
3023 path.cubicTo(0,2, 2,1, 4,2);
3024 path.close();
3025 pathB.setFillType(SkPath::kWinding_FillType);
3026 pathB.moveTo(1,2);
3027 pathB.cubicTo(2,4, 1,0, 2,0);
3028 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003029 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +00003030}
3031
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003032static void cubicOp101(skiatest::Reporter* reporter, const char* filename) {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +00003033 SkPath path, pathB;
3034 path.setFillType(SkPath::kWinding_FillType);
3035 path.moveTo(0, 1);
3036 path.cubicTo(2, 3, 2, 1, 5, 3);
3037 path.close();
3038 pathB.setFillType(SkPath::kWinding_FillType);
3039 pathB.moveTo(1, 2);
3040 pathB.cubicTo(3, 5, 1, 0, 3, 2);
3041 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003042 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +00003043}
3044
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003045static void cubicOp102(skiatest::Reporter* reporter, const char* filename) {
3046 SkPath path, pathB;
3047 path.setFillType(SkPath::kWinding_FillType);
3048 path.moveTo(0,1);
3049 path.cubicTo(1,2, 1,0, 3,0);
3050 path.close();
3051 pathB.setFillType(SkPath::kWinding_FillType);
3052 pathB.moveTo(0,1);
3053 pathB.cubicTo(0,3, 1,0, 2,1);
3054 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003055 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003056}
3057
3058static void cubicOp103(skiatest::Reporter* reporter, const char* filename) {
3059 SkPath path, pathB;
3060 path.setFillType(SkPath::kWinding_FillType);
3061 path.moveTo(0,1);
3062 path.cubicTo(1,5, 2,0, 2,1);
3063 path.close();
3064 pathB.setFillType(SkPath::kWinding_FillType);
3065 pathB.moveTo(0,2);
3066 pathB.cubicTo(1,2, 1,0, 5,1);
3067 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003068 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003069}
3070
3071static void cubicOp104(skiatest::Reporter* reporter, const char* filename) {
3072 SkPath path, pathB;
3073 path.setFillType(SkPath::kWinding_FillType);
3074 path.moveTo(0,1);
3075 path.cubicTo(0,6, 4,0, 6,1);
3076 path.close();
3077 pathB.setFillType(SkPath::kWinding_FillType);
3078 pathB.moveTo(0,4);
3079 pathB.cubicTo(1,6, 1,0, 6,0);
3080 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003081 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003082}
3083
3084static void cubicOp105(skiatest::Reporter* reporter, const char* filename) {
3085 SkPath path, pathB;
3086 path.setFillType(SkPath::kWinding_FillType);
3087 path.moveTo(0,1);
3088 path.cubicTo(0,4, 6,5, 2,0);
3089 path.close();
3090 pathB.setFillType(SkPath::kWinding_FillType);
3091 pathB.moveTo(5,6);
3092 pathB.cubicTo(0,2, 1,0, 4,0);
3093 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003094 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003095}
3096
3097static void cubicOp106(skiatest::Reporter* reporter, const char* filename) {
3098 SkPath path, pathB;
3099 path.setFillType(SkPath::kWinding_FillType);
3100 path.moveTo(0, 1);
3101 path.cubicTo(4, 6, 2, 1, 2, 0);
3102 path.close();
3103 pathB.setFillType(SkPath::kWinding_FillType);
3104 pathB.moveTo(1, 2);
3105 pathB.cubicTo(0, 2, 1, 0, 6, 4);
3106 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003107 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003108}
3109
3110static void cubicOp107(skiatest::Reporter* reporter, const char* filename) {
3111 SkPath path, pathB;
3112 path.setFillType(SkPath::kWinding_FillType);
3113 path.moveTo(0, 1);
3114 path.cubicTo(4, 6, 2, 1, 2, 0);
3115 path.close();
3116 pathB.setFillType(SkPath::kWinding_FillType);
3117 pathB.moveTo(1, 2);
3118 pathB.cubicTo(0, 2, 1, 0, 6, 4);
3119 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003120 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003121}
3122
3123static void cubicOp108(skiatest::Reporter* reporter, const char* filename) {
3124 SkPath path, pathB;
3125 path.setFillType(SkPath::kWinding_FillType);
3126 path.moveTo(0, 1);
3127 path.cubicTo(4, 6, 2, 1, 2, 0);
3128 path.close();
3129 pathB.setFillType(SkPath::kWinding_FillType);
3130 pathB.moveTo(1, 2);
3131 pathB.cubicTo(0, 2, 1, 0, 6, 4);
3132 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003133 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003134}
3135
3136static void cubicOp109(skiatest::Reporter* reporter, const char* filename) {
3137 SkPath path, pathB;
3138 path.setFillType(SkPath::kWinding_FillType);
3139 path.moveTo(0,1);
3140 path.cubicTo(4,5, 6,3, 5,4);
3141 path.close();
3142 pathB.setFillType(SkPath::kWinding_FillType);
3143 pathB.moveTo(3,6);
3144 pathB.cubicTo(4,5, 1,0, 5,4);
3145 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003146 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003147}
3148
3149static void cubicOp110(skiatest::Reporter* reporter, const char* filename) {
3150 SkPath path, pathB;
3151 path.setFillType(SkPath::kEvenOdd_FillType);
3152 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
3153 path.addRect(0, 0, 4, 4, SkPath::kCW_Direction);
3154 pathB.setFillType(SkPath::kEvenOdd_FillType);
3155 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3156 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -07003157 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003158}
3159
3160static void cubicOp111(skiatest::Reporter* reporter, const char* filename) {
3161 SkPath path, pathB;
3162 path.setFillType(SkPath::kWinding_FillType);
3163 path.moveTo(1,4);
3164 path.cubicTo(0,5, 4,1, 3,1);
3165 path.close();
3166 pathB.setFillType(SkPath::kWinding_FillType);
3167 pathB.moveTo(1,4);
3168 pathB.cubicTo(1,3, 4,1, 5,0);
3169 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003170 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003171}
3172
3173static void xOp1u(skiatest::Reporter* reporter, const char* filename) {
3174 SkPath path, pathB;
3175 path.setFillType(SkPath::kEvenOdd_FillType);
3176 path.moveTo(1, 4);
3177 path.cubicTo(4, 5, 3, 2, 6, 3);
3178 path.close();
3179 pathB.setFillType(SkPath::kEvenOdd_FillType);
3180 pathB.moveTo(2, 3);
3181 pathB.cubicTo(3, 6, 4, 1, 5, 4);
3182 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003183 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003184}
3185
3186static void xOp1i(skiatest::Reporter* reporter, const char* filename) {
3187 SkPath path, pathB;
3188 path.setFillType(SkPath::kEvenOdd_FillType);
3189 path.moveTo(1, 4);
3190 path.cubicTo(1, 5, 6, 0, 5, 1);
3191 path.close();
3192 pathB.setFillType(SkPath::kEvenOdd_FillType);
3193 pathB.moveTo(0, 6);
3194 pathB.cubicTo(1, 5, 4, 1, 5, 1);
3195 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003196 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003197}
3198
3199static void xOp2i(skiatest::Reporter* reporter, const char* filename) {
3200 SkPath path, pathB;
3201 path.setFillType(SkPath::kEvenOdd_FillType);
3202 path.moveTo(1, 5);
3203 path.cubicTo(0, 4, 3, 2, 6, 1);
3204 path.close();
3205 pathB.setFillType(SkPath::kEvenOdd_FillType);
3206 pathB.moveTo(2, 3);
3207 pathB.cubicTo(1, 6, 5, 1, 4, 0);
3208 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003209 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003210}
3211
3212static void xOp3i(skiatest::Reporter* reporter, const char* filename) {
3213 SkPath path, pathB;
3214 path.setFillType(SkPath::kWinding_FillType);
3215 path.moveTo(1,4);
3216 path.cubicTo(0,5, 4,1, 3,1);
3217 path.close();
3218 pathB.setFillType(SkPath::kWinding_FillType);
3219 pathB.moveTo(1,4);
3220 pathB.cubicTo(1,3, 4,1, 5,0);
3221 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003222 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003223}
3224
3225static void findFirst1(skiatest::Reporter* reporter, const char* filename) {
3226 SkPath path, pathB;
3227 path.setFillType(SkPath::kWinding_FillType);
3228 path.moveTo(0,1);
3229 path.cubicTo(1,6, 5,0, 2,1);
3230 path.close();
3231 pathB.setFillType(SkPath::kWinding_FillType);
3232 pathB.moveTo(0,5);
3233 pathB.cubicTo(1,2, 1,0, 6,1);
3234 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003235 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00003236}
3237
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00003238static void cubicOp112(skiatest::Reporter* reporter, const char* filename) {
3239 SkPath path, pathB;
3240 path.setFillType(SkPath::kWinding_FillType);
3241 path.moveTo(2,4);
3242 path.cubicTo(2,3, 6,4, 1,0);
3243 path.close();
3244 pathB.setFillType(SkPath::kWinding_FillType);
3245 pathB.moveTo(4,6);
3246 pathB.cubicTo(0,1, 4,2, 3,2);
3247 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003248 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00003249}
3250
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00003251static void cubicOp113(skiatest::Reporter* reporter, const char* filename) {
3252 SkPath path, pathB;
3253 path.moveTo(2,4);
3254 path.cubicTo(3,5, 2.33333325f,4.33333349f, 3.83333325f,3.83333349f);
3255 path.close();
3256 pathB.moveTo(3,5);
3257 pathB.cubicTo(2.33333325f,4.33333349f, 3.83333325f,3.83333349f, 2,4);
3258 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003259 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00003260}
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00003261
3262static void cubicOp114(skiatest::Reporter* reporter, const char* filename) {
3263 SkPath path, pathB;
3264 path.setFillType(SkPath::kWinding_FillType);
3265 path.moveTo(0, 1);
3266 path.cubicTo(1, 3, -1, 2, 3.5f, 1.33333337f);
3267 path.close();
3268 pathB.setFillType(SkPath::kWinding_FillType);
3269 pathB.moveTo(1, 3);
3270 pathB.cubicTo(-1, 2, 3.5f, 1.33333337f, 0, 1);
3271 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003272 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00003273}
caryclarke4097e32014-06-18 07:24:19 -07003274
3275static void cubicOp114asQuad(skiatest::Reporter* reporter, const char* filename) {
3276 SkPath path, pathB;
3277 path.setFillType(SkPath::kWinding_FillType);
3278 path.moveTo(0, 1);
3279 path.cubicTo(1, 3, -1, 2, 3.5f, 1.33333337f);
3280 path.close();
3281 pathB.setFillType(SkPath::kWinding_FillType);
3282 pathB.moveTo(1, 3);
3283 pathB.cubicTo(-1, 2, 3.5f, 1.33333337f, 0, 1);
3284 pathB.close();
3285 SkPath qPath, qPathB;
3286 CubicPathToQuads(path, &qPath);
3287 CubicPathToQuads(pathB, &qPathB);
caryclark54359292015-03-26 07:52:43 -07003288 testPathOp(reporter, qPath, qPathB, kIntersect_SkPathOp, filename);
caryclarke4097e32014-06-18 07:24:19 -07003289}
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00003290
3291static void quadOp10i(skiatest::Reporter* reporter, const char* filename) {
3292 SkPath path, pathB;
3293 path.moveTo(0, 0);
3294 path.quadTo(1, 8, 3, 5);
3295 path.lineTo(8, 1);
3296 path.close();
3297 pathB.moveTo(0, 0);
3298 pathB.quadTo(8, 1, 4, 8);
3299 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003300 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00003301}
3302
commit-bot@chromium.org91fc81c2014-04-30 13:37:48 +00003303static void kari1(skiatest::Reporter* reporter, const char* filename) {
3304 SkPath path1;
3305 path1.moveTo(39.9375, -5.8359375);
3306 path1.lineTo(40.625, -5.7890625);
3307 path1.lineTo(37.7109375, 1.3515625);
3308 path1.lineTo(37.203125, 0.9609375);
3309 path1.close();
3310
3311 SkPath path2;
3312 path2.moveTo(37.52734375f, -1.44140625f);
3313 path2.cubicTo(37.8736991882324f, -1.69921875f, 38.1640625f, -2.140625f, 38.3984375f, -2.765625f);
3314 path2.lineTo(38.640625f, -2.609375f);
3315 path2.cubicTo(38.53125f, -1.89583337306976f, 38.0664443969727f, -0.154893040657043f, 38.0664443969727f, -0.154893040657043f);
3316 path2.cubicTo(38.0664443969727f, -0.154893040657043f, 37.1809883117676f, -1.18359375f, 37.52734375, -1.44140625f);
3317 path2.close();
3318
caryclark54359292015-03-26 07:52:43 -07003319 testPathOp(reporter, path1, path2, kDifference_SkPathOp, filename);
commit-bot@chromium.org91fc81c2014-04-30 13:37:48 +00003320}
3321
commit-bot@chromium.org2db7fe72014-05-07 15:31:40 +00003322static void issue2504(skiatest::Reporter* reporter, const char* filename) {
3323 SkPath path1;
3324 path1.moveTo(34.2421875, -5.976562976837158203125);
3325 path1.lineTo(35.453121185302734375, 0);
3326 path1.lineTo(31.9375, 0);
3327 path1.close();
3328
3329 SkPath path2;
3330 path2.moveTo(36.71843719482421875, 0.8886508941650390625);
3331 path2.cubicTo(36.71843719482421875, 0.8886508941650390625,
3332 35.123386383056640625, 0.554015457630157470703125,
3333 34.511409759521484375, -0.1152553558349609375);
3334 path2.cubicTo(33.899425506591796875, -0.7845261096954345703125,
3335 34.53484344482421875, -5.6777553558349609375,
3336 34.53484344482421875, -5.6777553558349609375);
3337 path2.close();
caryclark54359292015-03-26 07:52:43 -07003338 testPathOp(reporter, path1, path2, kUnion_SkPathOp, filename);
commit-bot@chromium.org2db7fe72014-05-07 15:31:40 +00003339}
3340
caryclarkdac1d172014-06-17 05:15:38 -07003341static void issue2540(skiatest::Reporter* reporter, const char* filename) {
3342 SkPath path1;
3343 path1.moveTo(26.5054988861083984375, 85.73960113525390625);
3344 path1.cubicTo(84.19739532470703125, 17.77140045166015625, 16.93920135498046875, 101.86199951171875, 12.631000518798828125, 105.24700164794921875);
3345 path1.cubicTo(11.0819997787475585937500000, 106.46399688720703125, 11.5260000228881835937500000, 104.464996337890625, 11.5260000228881835937500000, 104.464996337890625);
3346 path1.lineTo(23.1654987335205078125, 89.72879791259765625);
3347 path1.cubicTo(23.1654987335205078125, 89.72879791259765625, -10.1713008880615234375, 119.9160003662109375, -17.1620006561279296875, 120.8249969482421875);
3348 path1.cubicTo(-19.1149997711181640625, 121.07900238037109375, -18.0380001068115234375, 119.79299163818359375, -18.0380001068115234375, 119.79299163818359375);
3349 path1.cubicTo(-18.0380001068115234375, 119.79299163818359375, 14.22100067138671875, 90.60700225830078125, 26.5054988861083984375, 85.73960113525390625);
3350 path1.close();
3351
3352 SkPath path2;
3353 path2.moveTo(-25.077999114990234375, 124.9120025634765625);
3354 path2.cubicTo(-25.077999114990234375, 124.9120025634765625, -25.9509983062744140625, 125.95400238037109375, -24.368999481201171875, 125.7480010986328125);
3355 path2.cubicTo(-16.06999969482421875, 124.66899871826171875, 1.2680000066757202148437500, 91.23999786376953125, 37.264003753662109375, 95.35400390625);
3356 path2.cubicTo(37.264003753662109375, 95.35400390625, 11.3710002899169921875, 83.7339935302734375, -25.077999114990234375, 124.9120025634765625);
3357 path2.close();
caryclark54359292015-03-26 07:52:43 -07003358 testPathOp(reporter, path1, path2, kUnion_SkPathOp, filename);
caryclarkdac1d172014-06-17 05:15:38 -07003359}
caryclarkdac1d172014-06-17 05:15:38 -07003360
3361static void rects1(skiatest::Reporter* reporter, const char* filename) {
3362 SkPath path, pathB;
3363 path.setFillType(SkPath::kEvenOdd_FillType);
3364 path.moveTo(0, 0);
3365 path.lineTo(1, 0);
3366 path.lineTo(1, 1);
3367 path.lineTo(0, 1);
3368 path.close();
3369 path.moveTo(0, 0);
3370 path.lineTo(6, 0);
3371 path.lineTo(6, 6);
3372 path.lineTo(0, 6);
3373 path.close();
3374 pathB.setFillType(SkPath::kEvenOdd_FillType);
3375 pathB.moveTo(0, 0);
3376 pathB.lineTo(1, 0);
3377 pathB.lineTo(1, 1);
3378 pathB.lineTo(0, 1);
3379 pathB.close();
3380 pathB.moveTo(0, 0);
3381 pathB.lineTo(2, 0);
3382 pathB.lineTo(2, 2);
3383 pathB.lineTo(0, 2);
3384 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003385 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
caryclarkdac1d172014-06-17 05:15:38 -07003386}
3387
3388static void rects2(skiatest::Reporter* reporter, const char* filename) {
3389 SkPath path, pathB;
3390 path.setFillType(SkPath::kEvenOdd_FillType);
3391 path.moveTo(0, 0);
3392 path.lineTo(4, 0);
3393 path.lineTo(4, 4);
3394 path.lineTo(0, 4);
3395 path.close();
3396 path.moveTo(3, 3);
3397 path.lineTo(4, 3);
3398 path.lineTo(4, 4);
3399 path.lineTo(3, 4);
3400 path.close();
3401 pathB.setFillType(SkPath::kWinding_FillType);
3402 pathB.moveTo(3, 3);
3403 pathB.lineTo(6, 3);
3404 pathB.lineTo(6, 6);
3405 pathB.lineTo(3, 6);
3406 pathB.close();
3407 pathB.moveTo(3, 3);
3408 pathB.lineTo(4, 3);
3409 pathB.lineTo(4, 4);
3410 pathB.lineTo(3, 4);
3411 pathB.close();
caryclark54359292015-03-26 07:52:43 -07003412 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclarkdac1d172014-06-17 05:15:38 -07003413}
3414
3415static void rects3(skiatest::Reporter* reporter, const char* filename) {
3416 SkPath path, pathB;
3417 path.setFillType(SkPath::kEvenOdd_FillType);
3418 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
3419 path.addRect(0, 0, 4, 4, SkPath::kCW_Direction);
3420 pathB.setFillType(SkPath::kWinding_FillType);
3421 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3422 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -07003423 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclarkdac1d172014-06-17 05:15:38 -07003424}
3425
3426static void rects4(skiatest::Reporter* reporter, const char* filename) {
3427 SkPath path, pathB;
3428 path.setFillType(SkPath::kEvenOdd_FillType);
3429 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
3430 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3431 pathB.setFillType(SkPath::kWinding_FillType);
3432 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3433 pathB.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
caryclark54359292015-03-26 07:52:43 -07003434 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclarkdac1d172014-06-17 05:15:38 -07003435}
3436
caryclark19eb3b22014-07-18 05:08:14 -07003437static void issue2753(skiatest::Reporter* reporter, const char* filename) {
3438 SkPath path1;
3439 path1.moveTo(142.701f, 110.568f);
3440 path1.lineTo(142.957f, 100);
3441 path1.lineTo(153.835f, 100);
3442 path1.lineTo(154.592f, 108.188f);
3443 path1.cubicTo(154.592f, 108.188f, 153.173f, 108.483f, 152.83f, 109.412f);
3444 path1.cubicTo(152.83f, 109.412f, 142.701f, 110.568f, 142.701f, 110.568f);
3445 path1.close();
3446
3447 SkPath path2;
3448 path2.moveTo(39, 124.001f);
3449 path2.cubicTo(39, 124.001f, 50.6f, 117.001f, 50.6f, 117.001f);
3450 path2.cubicTo(50.6f, 117.001f, 164.601f, 85.2f, 188.201f, 117.601f);
3451 path2.cubicTo(188.201f, 117.601f, 174.801f, 93, 39, 124.001f);
3452 path2.close();
3453
caryclark54359292015-03-26 07:52:43 -07003454 testPathOp(reporter, path1, path2, kUnion_SkPathOp, filename);
caryclark19eb3b22014-07-18 05:08:14 -07003455}
caryclark19eb3b22014-07-18 05:08:14 -07003456
caryclark80a83ad2014-08-12 05:49:37 -07003457static void issue2808(skiatest::Reporter* reporter, const char* filename) {
3458 SkPath path1, path2;
3459
3460 path1.moveTo(509.20300293f, 385.601989746f);
3461 path1.quadTo(509.20300293f, 415.68838501f, 487.928710938f, 436.96270752f);
3462 path1.quadTo(466.654388428f, 458.236999512f, 436.567993164f, 458.236999512f);
3463 path1.quadTo(406.4815979f, 458.236999512f, 385.207275391f, 436.96270752f);
3464 path1.quadTo(363.932983398f, 415.68838501f, 363.932983398f, 385.601989746f);
3465 path1.quadTo(363.932983398f, 355.515594482f, 385.207275391f, 334.241271973f);
3466 path1.quadTo(406.4815979f, 312.96697998f, 436.567993164f, 312.96697998f);
3467 path1.quadTo(466.654388428f, 312.96697998f, 487.928710938f, 334.241271973f);
3468 path1.quadTo(509.20300293f, 355.515594482f, 509.20300293f, 385.601989746f);
3469 path1.close();
3470
3471 path2.moveTo(449.033996582f, 290.87298584f);
3472 path2.quadTo(449.033996582f, 301.028259277f, 441.853149414f, 308.209106445f);
3473 path2.quadTo(434.672271729f, 315.389984131f, 424.516998291f, 315.389984131f);
3474 path2.quadTo(414.361724854f, 315.389984131f, 407.180847168f, 308.209106445f);
3475 path2.quadTo(400, 301.028259277f, 400, 290.87298584f);
3476 path2.quadTo(400, 280.717712402f, 407.180847168f, 273.536865234f);
3477 path2.quadTo(414.361724854f, 266.355987549f, 424.516998291f, 266.355987549f);
3478 path2.quadTo(434.672271729f, 266.355987549f, 441.853149414f, 273.536865234f);
3479 path2.quadTo(449.033996582f, 280.717712402f, 449.033996582f, 290.87298584f);
3480 path2.close();
3481
caryclark54359292015-03-26 07:52:43 -07003482 testPathOp(reporter, path1, path2, kUnion_SkPathOp, filename);
caryclark80a83ad2014-08-12 05:49:37 -07003483}
3484
caryclark65f55312014-11-13 06:58:52 -08003485static void cubicOp115(skiatest::Reporter* reporter, const char* filename) {
3486 SkPath path, pathB;
3487 path.setFillType(SkPath::kWinding_FillType);
3488 path.moveTo(0,1);
3489 path.cubicTo(3,4, 2,1, 5,3);
3490 path.close();
3491 pathB.setFillType(SkPath::kWinding_FillType);
3492 pathB.moveTo(1,2);
3493 pathB.cubicTo(3,5, 1,0, 4,3);
3494 pathB.close();
3495 SkPath path2(path);
caryclark54359292015-03-26 07:52:43 -07003496 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
caryclark65f55312014-11-13 06:58:52 -08003497}
3498
caryclark54359292015-03-26 07:52:43 -07003499static void testRect1(skiatest::Reporter* reporter, const char* filename) {
3500 SkPath path, path2;
3501 path.addRect(0, 0, 60, 60, SkPath::kCCW_Direction);
3502 path.addRect(30, 20, 50, 50, SkPath::kCCW_Direction);
3503 path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction);
3504// path.addRect(32, 24, 36, 41, SkPath::kCCW_Direction);
3505 testPathOp(reporter, path, path2, kUnion_SkPathOp, filename);
3506}
3507
3508static void testRect2(skiatest::Reporter* reporter, const char* filename) {
3509 SkPath path, pathB;
3510 path.setFillType(SkPath::kWinding_FillType);
3511 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
3512 path.addRect(4, 4, 5, 5, SkPath::kCW_Direction);
3513 pathB.setFillType(SkPath::kEvenOdd_FillType);
3514 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
3515 pathB.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
3516 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3517}
3518
3519static void cubicOp116(skiatest::Reporter* reporter, const char* filename) {
3520 SkPath path, pathB;
3521 path.setFillType(SkPath::kWinding_FillType);
3522 path.moveTo(0,1);
3523 path.cubicTo(4,6, 2,0, 2,0);
3524 path.close();
3525 pathB.setFillType(SkPath::kWinding_FillType);
3526 pathB.moveTo(0,2);
3527 pathB.cubicTo(0,2, 1,0, 6,4);
3528 pathB.close();
3529 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3530}
3531
3532static void cubicOp117(skiatest::Reporter* reporter, const char* filename) {
3533 SkPath path, pathB;
3534 path.setFillType(SkPath::kWinding_FillType);
3535 path.moveTo(0,1);
3536 path.cubicTo(4,5, 6,0, 1,0);
3537 path.close();
3538 pathB.setFillType(SkPath::kWinding_FillType);
3539 pathB.moveTo(0,6);
3540 pathB.cubicTo(0,1, 1,0, 5,4);
3541 pathB.close();
3542 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3543}
3544
3545static void cubicOp118(skiatest::Reporter* reporter, const char* filename) {
3546 SkPath path, pathB;
3547 path.setFillType(SkPath::kWinding_FillType);
3548 path.moveTo(0,1);
3549 path.cubicTo(4,6, 5,1, 6,2);
3550 path.close();
3551 pathB.setFillType(SkPath::kWinding_FillType);
3552 pathB.moveTo(1,5);
3553 pathB.cubicTo(2,6, 1,0, 6,4);
3554 pathB.close();
3555 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3556}
3557
3558static void loop1(skiatest::Reporter* reporter, const char* filename) {
3559 SkPath path, pathB;
3560 path.moveTo(0,1);
3561 path.cubicTo(1,5, -5.66666651f,3.33333349f, 8.83333302f,2.33333349f);
3562 path.close();
3563 pathB.moveTo(1,5);
3564 pathB.cubicTo(-5.66666651f,3.33333349f, 8.83333302f,2.33333349f, 0,1);
3565 pathB.close();
3566 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3567}
3568
3569#include "SkPathOpsCubic.h"
3570
3571static void loop1asQuad(skiatest::Reporter* reporter, const char* filename) {
3572 SkDCubic c1 = {{{0,1}, {1,5}, {-5.66666651f,3.33333349f}, {8.83333302f,2.33333349f}}};
3573 SkDCubic c2 = {{{1,5}, {-5.66666651f,3.33333349f}, {8.83333302f,2.33333349f}, {0,1}}};
3574 double c1InflectionTs[2], c2InflectionTs[2];
3575 SkDEBUGCODE(int c1InfTCount =) c1.findInflections(c1InflectionTs);
3576 SkASSERT(c1InfTCount == 2);
3577 SkDEBUGCODE(int c2InfTCount =) c2.findInflections(c2InflectionTs);
3578 SkASSERT(c2InfTCount == 1);
3579 SkASSERT(c1InflectionTs[0] > c1InflectionTs[1]);
3580 SkDCubicPair c1pair = c1.chopAt(c1InflectionTs[0]);
3581 SkDCubicPair c1apair = c1pair.first().chopAt(c1InflectionTs[1]);
3582 SkDCubicPair c2pair = c2.chopAt(c2InflectionTs[0]);
3583 SkDQuad q1[2] = { c1pair.first().toQuad(), c1pair.second().toQuad() };
3584 SkDQuad q1a[2] = { c1apair.first().toQuad(), c1apair.second().toQuad() };
3585 SkDQuad q2[2] = { c2pair.first().toQuad(), c2pair.second().toQuad() };
3586 SkPath path, pathB;
3587 path.moveTo(q1a[0].fPts[0].asSkPoint());
3588 path.quadTo(q1a[0].fPts[1].asSkPoint(), q1a[0].fPts[2].asSkPoint());
3589 path.quadTo(q1a[1].fPts[1].asSkPoint(), q1a[1].fPts[2].asSkPoint());
3590 path.quadTo(q1[1].fPts[1].asSkPoint(), q1[1].fPts[2].asSkPoint());
3591 path.close();
3592 pathB.moveTo(q2[0].fPts[0].asSkPoint());
3593 pathB.quadTo(q2[0].fPts[1].asSkPoint(), q2[0].fPts[2].asSkPoint());
3594 pathB.quadTo(q2[1].fPts[1].asSkPoint(), q2[1].fPts[2].asSkPoint());
3595 pathB.close();
3596 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3597}
3598
3599static void loop2(skiatest::Reporter* reporter, const char* filename) {
3600 SkPath path, pathB;
3601 path.moveTo(0,1);
3602 path.cubicTo(3,4, 3.f,4.f, 4.5f,1.5f);
3603 path.close();
3604 pathB.moveTo(3,4);
3605 pathB.cubicTo(3.f,4.f, 4.5f,1.5f, 0,1);
3606 pathB.close();
3607 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3608}
3609
3610static void loop3(skiatest::Reporter* reporter, const char* filename) {
3611 SkPath path, pathB;
3612 path.moveTo(0,1);
3613 path.cubicTo(3,5, -3.66666651f,0, 10.5f,-1.66666651f);
3614 path.close();
3615 pathB.moveTo(3,5);
3616 pathB.cubicTo(-3.66666651f,0, 10.5f,-1.66666651f, 0,1);
3617 pathB.close();
3618 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3619}
3620
3621static void loop4(skiatest::Reporter* reporter, const char* filename) {
3622 SkPath path, pathB;
3623 path.moveTo(0,5);
3624 path.cubicTo(1,5, 1,4, 0.833333313f,3);
3625 path.close();
3626 pathB.moveTo(1,5);
3627 pathB.cubicTo(1,4, 0.833333313f,3, 0,5);
3628 pathB.close();
3629 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3630}
3631
3632#include "SkParsePath.h"
3633
3634static void issue3517(skiatest::Reporter* reporter, const char* filename) {
3635 SkPath path, pathB;
3636
3637 const char str[] = "M31.35 57.75L31.35 57.75C31.9 57.7486 32.45 57.7948 33 57.7413C33.55 57.6878 34.1 57.5014 34.65 57.4291C35.2 57.3569 35.75 57.3223 36.3 57.3079C36.85 57.2935 37.4 57.3143 37.95 57.3428C38.5 57.3712 39.05 57.4112 39.6 57.4786C40.15 57.546 40.7 57.7029 41.25 57.7472C41.8 57.7916 42.35 57.7962 42.9 57.7445C43.45 57.6928 44 57.5345 44.55 57.4373C45.1 57.34 45.65 57.2115 46.2 57.1611C46.75 57.1107 47.3 57.1371 47.85 57.1349C48.4 57.1327 48.95 57.144 49.5 57.1478C50.05 57.1516 50.6 57.1553 51.15 57.1579C51.7 57.1605 52.25 57.1601 52.8 57.1634C53.35 57.1667 53.9 57.1731 54.45 57.1776C55 57.182 55.55 57.1916 56.1 57.19C56.65 57.1884 57.2 57.178 57.75 57.168C58.3 57.158 58.85 57.1355 59.4 57.1299C59.95 57.1243 60.5 57.1338 61.05 57.1345C61.6 57.1352 62.15 57.124 62.7 57.134C63.25 57.1441 63.8 57.1731 64.35 57.195C64.9 57.2169 65.45 57.2532 66 57.2655C66.55 57.2778 67.1 57.2647 67.65 57.2687C68.2 57.2728 68.75 57.267 69.3 57.2896C69.85 57.3122 70.4 57.371 70.95 57.4044C71.5 57.4377 72.05 57.4668 72.6 57.4896C73.15 57.5123 73.7 57.545 74.25 57.5408C74.8 57.5365 75.35 57.5068 75.9 57.4641C76.45 57.4213 77 57.3244 77.55 57.2842C78.1 57.244 78.65 57.2163 79.2 57.2228C79.75 57.2293 80.3 57.29 80.85 57.3232C81.4 57.3563 81.95 57.396 82.5 57.4219C83.05 57.4478 83.6 57.4637 84.15 57.4787C84.7 57.4937 85.25 57.5011 85.8 57.5121C86.35 57.523 86.9 57.5411 87.45 57.5444C88 57.5477 88.55 57.5663 89.1 57.5318C89.65 57.4972 90.2 57.3126 90.75 57.337C91.3 57.3613 91.85 57.6088 92.4 57.6776C92.95 57.7465 93.5 57.7379 94.05 57.75C94.6 57.7621 95.15 57.75 95.7 57.75L95.7 57.75L31.35 57.75Z";
3638 SkParsePath::FromSVGString(str, &path);
3639
3640 const char strB[] = "M31.35 57.75L31.35 57.75C31.9 57.7514 32.45 57.7052 33 57.7587C33.55 57.8122 34.1 57.9986 34.65 58.0709C35.2 58.1431 35.75 58.1777 36.3 58.1921C36.85 58.2065 37.4 58.1857 37.95 58.1572C38.5 58.1288 39.05 58.0888 39.6 58.0214C40.15 57.954 40.7 57.7971 41.25 57.7528C41.8 57.7084 42.35 57.7038 42.9 57.7555C43.45 57.8072 44 57.9655 44.55 58.0627C45.1 58.16 45.65 58.2885 46.2 58.3389C46.75 58.3893 47.3 58.3629 47.85 58.3651C48.4 58.3673 48.95 58.356 49.5 58.3522C50.05 58.3484 50.6 58.3447 51.15 58.3421C51.7 58.3395 52.25 58.3399 52.8 58.3366C53.35 58.3333 53.9 58.3269 54.45 58.3224C55 58.318 55.55 58.3084 56.1 58.31C56.65 58.3116 57.2 58.322 57.75 58.332C58.3 58.342 58.85 58.3645 59.4 58.3701C59.95 58.3757 60.5 58.3662 61.05 58.3655C61.6 58.3648 62.15 58.376 62.7 58.366C63.25 58.3559 63.8 58.3269 64.35 58.305C64.9 58.2831 65.45 58.2468 66 58.2345C66.55 58.2222 67.1 58.2353 67.65 58.2313C68.2 58.2272 68.75 58.233 69.3 58.2104C69.85 58.1878 70.4 58.129 70.95 58.0956C71.5 58.0623 72.05 58.0332 72.6 58.0104C73.15 57.9877 73.7 57.955 74.25 57.9592C74.8 57.9635 75.35 57.9932 75.9 58.0359C76.45 58.0787 77 58.1756 77.55 58.2158C78.1 58.256 78.65 58.2837 79.2 58.2772C79.75 58.2707 80.3 58.21 80.85 58.1768C81.4 58.1437 81.95 58.104 82.5 58.0781C83.05 58.0522 83.6 58.0363 84.15 58.0213C84.7 58.0063 85.25 57.9989 85.8 57.9879C86.35 57.977 86.9 57.9589 87.45 57.9556C88 57.9523 88.55 57.9337 89.1 57.9682C89.65 58.0028 90.2 58.1874 90.75 58.163C91.3 58.1387 91.85 57.8912 92.4 57.8224C92.95 57.7535 93.5 57.7621 94.05 57.75C94.6 57.7379 95.15 57.75 95.7 57.75L95.7 57.75L31.35 57.75Z";
3641 SkParsePath::FromSVGString(strB, &pathB);
3642 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
3643}
3644
3645static void cubicOp119(skiatest::Reporter* reporter, const char* filename) {
3646 SkPath path, pathB;
3647 path.setFillType(SkPath::kWinding_FillType);
3648 path.moveTo(0,1);
3649 path.cubicTo(3,5, 2,1, 3,1);
3650 path.close();
3651 pathB.setFillType(SkPath::kWinding_FillType);
3652 pathB.moveTo(1,2);
3653 pathB.cubicTo(1,3, 1,0, 5,3);
3654 pathB.close();
3655 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3656}
3657
3658static void cubicOp120(skiatest::Reporter* reporter, const char* filename) {
3659 SkPath path, pathB;
3660 path.setFillType(SkPath::kWinding_FillType);
3661 path.moveTo(0,1);
3662 path.cubicTo(2,4, 2,1, 4,0);
3663 path.close();
3664 pathB.setFillType(SkPath::kWinding_FillType);
3665 pathB.moveTo(1,2);
3666 pathB.cubicTo(0,4, 1,0, 4,2);
3667 pathB.close();
3668 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3669}
3670
3671static void cubicOp121(skiatest::Reporter* reporter, const char* filename) {
3672 SkPath path, pathB;
3673 path.setFillType(SkPath::kWinding_FillType);
3674 path.moveTo(0,1);
3675 path.cubicTo(3,4, 3,2, 4,3);
3676 path.close();
3677 pathB.setFillType(SkPath::kWinding_FillType);
3678 pathB.moveTo(2,3);
3679 pathB.cubicTo(3,4, 1,0, 4,3);
3680 pathB.close();
3681 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3682}
3683
3684// FIXME : haven't debugged this failure yet
3685static void cubicOp122(skiatest::Reporter* reporter, const char* filename) {
3686 SkPath path, pathB;
3687 path.setFillType(SkPath::kWinding_FillType);
3688 path.moveTo(0,1);
3689 path.cubicTo(3,5, 4,1, 4,0);
3690 path.close();
3691 pathB.setFillType(SkPath::kWinding_FillType);
3692 pathB.moveTo(1,4);
3693 pathB.cubicTo(0,4, 1,0, 5,3);
3694 pathB.close();
3695 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3696}
3697
3698static void cubicOp123(skiatest::Reporter* reporter, const char* filename) {
3699 SkPath path, pathB;
3700 path.setFillType(SkPath::kWinding_FillType);
3701 path.moveTo(0,1);
3702 path.cubicTo(1,5, 2,0, 6,0);
3703 path.close();
3704 pathB.setFillType(SkPath::kWinding_FillType);
3705 pathB.moveTo(0,2);
3706 pathB.cubicTo(0,6, 1,0, 5,1);
3707 pathB.close();
3708 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3709}
3710
3711static void loop5(skiatest::Reporter* reporter, const char* filename) {
3712 SkPath path, pathB;
3713 path.moveTo(0,2);
3714 path.cubicTo(1,2, 1,1.66666663f, 0.833333313f,1.33333325f);
3715 path.close();
3716 pathB.moveTo(1,2);
3717 pathB.cubicTo(1,1.66666663f, 0.833333313f,1.33333325f, 0,2);
3718 pathB.close();
3719 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3720}
3721
3722static void loop6(skiatest::Reporter* reporter, const char* filename) {
3723 SkPath path, pathB;
3724 path.moveTo(0,1);
3725 path.cubicTo(1,3, -1.66666675f,1.66666663f, 4.16666651f,1.00000012f);
3726 path.close();
3727 pathB.moveTo(1,3);
3728 pathB.cubicTo(-1.66666675f,1.66666663f, 4.16666651f,1.00000012f, 0,1);
3729 pathB.close();
3730 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3731}
3732
3733static void cubicOp124(skiatest::Reporter* reporter, const char* filename) {
3734 SkPath path, pathB;
3735 path.setFillType(SkPath::kWinding_FillType);
3736 path.moveTo(0,1);
3737 path.cubicTo(1,5, 6,0, 3,0);
3738 path.close();
3739 pathB.setFillType(SkPath::kWinding_FillType);
3740 pathB.moveTo(0,6);
3741 pathB.cubicTo(0,3, 1,0, 5,1);
3742 pathB.close();
3743 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3744}
3745
3746static void cubicOp125(skiatest::Reporter* reporter, const char* filename) {
3747 SkPath path, pathB;
3748 path.setFillType(SkPath::kWinding_FillType);
3749 path.moveTo(0,1);
3750 path.cubicTo(3,6, 3,1, 6,2);
3751 path.close();
3752 pathB.setFillType(SkPath::kWinding_FillType);
3753 pathB.moveTo(1,3);
3754 pathB.cubicTo(2,6, 1,0, 6,3);
3755 pathB.close();
3756 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3757}
3758
3759static void cubicOp126(skiatest::Reporter* reporter, const char* filename) {
3760 SkPath path, pathB;
3761 path.setFillType(SkPath::kWinding_FillType);
3762 path.moveTo(0,1);
3763 path.cubicTo(0,3, 6,0, 2,1);
3764 path.close();
3765 pathB.setFillType(SkPath::kWinding_FillType);
3766 pathB.moveTo(0,6);
3767 pathB.cubicTo(1,2, 1,0, 3,0);
3768 pathB.close();
3769 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3770}
3771
3772static void cubicOp127(skiatest::Reporter* reporter, const char* filename) {
3773 SkPath path, pathB;
3774 path.setFillType(SkPath::kWinding_FillType);
3775 path.moveTo(0,1);
3776 path.cubicTo(1,5, 6,0, 3,0);
3777 path.close();
3778 pathB.setFillType(SkPath::kWinding_FillType);
3779 pathB.moveTo(0,6);
3780 pathB.cubicTo(0,3, 1,0, 5,1);
3781 pathB.close();
3782 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3783}
3784
3785static void cubicOp128(skiatest::Reporter* reporter, const char* filename) {
3786 SkPath path, pathB;
3787 path.setFillType(SkPath::kWinding_FillType);
3788 path.moveTo(0,1);
3789 path.cubicTo(0,3, 3,2, 5,2);
3790 path.close();
3791 pathB.setFillType(SkPath::kWinding_FillType);
3792 pathB.moveTo(2,3);
3793 pathB.cubicTo(2,5, 1,0, 3,0);
3794 pathB.close();
3795 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3796}
3797
caryclark1049f122015-04-20 08:31:59 -07003798static void cubicOp129(skiatest::Reporter* reporter, const char* filename) {
3799 SkPath path, pathB;
3800 path.setFillType(SkPath::kWinding_FillType);
3801 path.moveTo(5,6);
3802 path.cubicTo(3,4, 2,0, 2,1);
3803 path.close();
3804 pathB.setFillType(SkPath::kWinding_FillType);
3805 pathB.moveTo(0,2);
3806 pathB.cubicTo(1,2, 6,5, 4,3);
3807 pathB.close();
3808 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3809}
3810
3811static void cubicOp130(skiatest::Reporter* reporter, const char* filename) {
3812 SkPath path, pathB;
3813 path.setFillType(SkPath::kWinding_FillType);
3814 path.moveTo(5,6);
3815 path.cubicTo(4,6, 3,0, 2,1);
3816 path.close();
3817 pathB.setFillType(SkPath::kWinding_FillType);
3818 pathB.moveTo(0,3);
3819 pathB.cubicTo(1,2, 6,5, 6,4);
3820 pathB.close();
3821 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3822}
3823
3824#include "SkGeometry.h"
3825
3826static void complex_to_quads(const SkPoint pts[], SkPath* path) {
3827 SkScalar loopT;
caryclark03b03ca2015-04-23 09:13:37 -07003828 SkDCubic::CubicType dType;
3829 if (SkDCubic::ComplexBreak(pts, &loopT, &dType)) {
caryclark1049f122015-04-20 08:31:59 -07003830 SkPoint cubicPair[7];
3831 SkChopCubicAt(pts, cubicPair, loopT);
3832 SkDCubic c1, c2;
3833 c1.set(cubicPair);
3834 c2.set(&cubicPair[3]);
3835 SkDQuad q1 = c1.toQuad();
3836 SkDQuad q2 = c2.toQuad();
3837 path->quadTo(q1[1].asSkPoint(), q1[2].asSkPoint());
3838 path->quadTo(q2[1].asSkPoint(), q2[2].asSkPoint());
3839 } else {
3840 path->cubicTo(pts[1], pts[2], pts[3]);
3841 }
3842}
3843
3844static void cubicOp130a(skiatest::Reporter* reporter, const char* filename) {
3845 SkPath path, pathB;
3846 path.setFillType(SkPath::kWinding_FillType);
3847 path.moveTo(5,6);
3848 SkPoint pts[] = { {5,6}, {4,6}, {3,0}, {2,1} };
3849 complex_to_quads(pts, &path);
3850 path.close();
3851 pathB.setFillType(SkPath::kWinding_FillType);
3852 pathB.moveTo(0,3);
3853 SkPoint pts2[] = { {0,3}, {1,2}, {6,5}, {6,4} };
3854 complex_to_quads(pts2, &path);
3855 pathB.close();
3856 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3857}
3858
3859static void cubicOp131(skiatest::Reporter* reporter, const char* filename) {
3860 SkPath path, pathB;
3861 path.setFillType(SkPath::kWinding_FillType);
3862 path.moveTo(0,1);
3863 path.cubicTo(3,4, 3,0, 6,2);
3864 path.close();
3865 pathB.setFillType(SkPath::kWinding_FillType);
3866 pathB.moveTo(0,3);
3867 pathB.cubicTo(2,6, 1,0, 4,3);
3868 pathB.close();
3869 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3870}
3871
3872static void circlesOp1(skiatest::Reporter* reporter, const char* filename) {
3873 SkPath path, pathB;
3874 path.setFillType(SkPath::kWinding_FillType);
3875 path.addCircle(0, 1, 2, SkPath::kCCW_Direction);
3876 pathB.setFillType(SkPath::kWinding_FillType);
3877 pathB.addCircle(0, 1, 1, SkPath::kCW_Direction);
3878 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3879}
3880
3881static void circlesOp2(skiatest::Reporter* reporter, const char* filename) {
3882 SkPath path, pathB;
3883 path.setFillType(SkPath::kWinding_FillType);
3884 path.addCircle(0, 1, 4, SkPath::kCCW_Direction);
3885 pathB.setFillType(SkPath::kWinding_FillType);
3886 pathB.addCircle(0, 4, 3, SkPath::kCW_Direction);
3887 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3888}
3889
3890static void rRect1x(skiatest::Reporter* reporter, const char* filename) {
3891 SkPath path, pathB;
3892 path.setFillType(SkPath::kEvenOdd_FillType);
3893 path.moveTo(20.65f, 5.65f);
3894 path.conicTo(20.65f, 1.13612f, 25.1404f, 0.65f, 0.888488f);
3895 path.lineTo(25.65f, 0.65f);
3896 path.lineTo(26.1596f, 0.67604f);
3897 path.conicTo(30.65f, 1.13612f, 30.65f, 5.65f, 0.888488f);
3898 path.lineTo(30.65f, 25.65f);
3899 path.conicTo(30.65f, 20.65f, 25.65f, 20.65f, 0.707107f);
3900 path.lineTo(20.65f, 20.65f);
3901 path.lineTo(20.65f, 5.65f);
3902 path.close();
3903 path.moveTo(20.65f, 20.65f);
3904 path.lineTo(5.65f, 20.65f);
3905 path.conicTo(0.65f, 20.65f, 0.65f, 25.65f, 0.707107f);
3906 path.lineTo(0.65f, 45.65f);
3907 path.conicTo(0.65f, 50.65f, 5.65f, 50.65f, 0.707107f);
3908 path.lineTo(25.65f, 50.65f);
3909 path.conicTo(30.65f, 50.65f, 30.65f, 45.65f, 0.707107f);
3910 path.lineTo(30.65f, 25.65f);
3911 path.conicTo(30.65f, 30.65f, 25.65f, 30.65f, 0.707107f);
3912 path.conicTo(20.65f, 30.65f, 20.65f, 25.65f, 0.707107f);
3913 path.lineTo(20.65f, 20.65f);
3914 path.close();
3915 SkPath path1(path);
3916
3917 path.reset();
3918 path.setFillType(SkPath::kWinding_FillType);
3919 path.moveTo(20.65f, 45.65f);
3920 path.lineTo(20.65f, 25.65f);
3921 path.conicTo(20.65f, 20.65f, 25.65f, 20.65f, 0.707107f);
3922 path.lineTo(45.65f, 20.65f);
3923 path.conicTo(50.65f, 20.65f, 50.65f, 25.65f, 0.707107f);
3924 path.lineTo(50.65f, 45.65f);
3925 path.conicTo(50.65f, 50.65f, 45.65f, 50.65f, 0.707107f);
3926 path.lineTo(25.65f, 50.65f);
3927 path.conicTo(20.65f, 50.65f, 20.65f, 45.65f, 0.707107f);
3928 path.close();
3929 SkPath path2(path);
3930
3931 testPathOp(reporter, path1, path2, kDifference_SkPathOp, filename);
3932}
3933
3934static void loop7(skiatest::Reporter* reporter, const char* filename) {
3935 SkPath path, pathB;
3936 path.moveTo(0,1);
3937 path.cubicTo(3,4, -1,0, 8.5f,-2.5f);
3938 path.close();
3939 pathB.moveTo(3,4);
3940 pathB.cubicTo(-1,0, 8.5f,-2.5f, 0,1);
3941 pathB.close();
3942 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3943}
3944
3945static void rects5(skiatest::Reporter* reporter, const char* filename) {
3946 SkPath path, pathB;
3947 path.setFillType(SkPath::kWinding_FillType);
3948 path.addRect(5, 5, 6, 6, SkPath::kCW_Direction);
3949 path.addRect(5, 5, 6, 6, SkPath::kCW_Direction);
3950 pathB.setFillType(SkPath::kEvenOdd_FillType);
3951 pathB.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
3952 pathB.addRect(5, 5, 6, 6, SkPath::kCW_Direction);
3953 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3954}
3955
3956static void loop8(skiatest::Reporter* reporter, const char* filename) {
3957 SkPath path, pathB;
3958 path.moveTo(0,1);
3959 path.cubicTo(1,4, -3.83333325f,0.166666627f, 6,-1);
3960 path.close();
3961 pathB.moveTo(1,4);
3962 pathB.cubicTo(-3.83333325f,0.166666627f, 6,-1, 0,1);
3963 pathB.close();
3964 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3965}
3966
3967static void loop9(skiatest::Reporter* reporter, const char* filename) {
3968 SkPath path, pathB;
3969 path.moveTo(0,1);
3970 path.cubicTo(1,3, -2.5f,0, 3.33333325f,-0.666666627f);
3971 path.close();
3972 pathB.moveTo(1,3);
3973 pathB.cubicTo(-2.5f,0, 3.33333325f,-0.666666627f, 0,1);
3974 pathB.close();
3975 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3976}
3977
3978static void circlesOp3(skiatest::Reporter* reporter, const char* filename) {
3979 SkPath path, pathB;
3980 path.setFillType(SkPath::kWinding_FillType);
3981 path.addCircle(0, 1, 2, SkPath::kCCW_Direction);
3982 pathB.setFillType(SkPath::kWinding_FillType);
3983 pathB.addCircle(3, 5, 3, SkPath::kCW_Direction);
3984 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
3985}
3986
3987static void loop10(skiatest::Reporter* reporter, const char* filename) {
3988 SkPath path, pathB;
3989 path.moveTo(5,6);
3990 path.cubicTo(1,2, 1,2, -3.66666651f,13.333334f);
3991 path.close();
3992 pathB.moveTo(1,2);
3993 pathB.cubicTo(1,2, -3.66666651f,13.333334f, 5,6);
3994 pathB.close();
3995 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
3996}
3997
3998static void loop11(skiatest::Reporter* reporter, const char* filename) {
3999 SkPath path, pathB;
4000 path.moveTo(0,1);
4001 path.cubicTo(1,3, -1.83333349f,1.33333337f, 4,-1);
4002 path.close();
4003 pathB.moveTo(1,3);
4004 pathB.cubicTo(-1.83333349f,1.33333337f, 4,-1, 0,1);
4005 pathB.close();
4006 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4007}
4008
4009static void cubicOp132(skiatest::Reporter* reporter, const char* filename) {
4010 SkPath path, pathB;
4011 path.setFillType(SkPath::kWinding_FillType);
4012 path.moveTo(5,6);
4013 path.cubicTo(3,4, 3,0, 3,2);
4014 path.close();
4015 pathB.setFillType(SkPath::kWinding_FillType);
4016 pathB.moveTo(0,3);
4017 pathB.cubicTo(2,3, 6,5, 4,3);
4018 pathB.close();
4019 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4020}
4021
caryclark03b03ca2015-04-23 09:13:37 -07004022static void loop12(skiatest::Reporter* reporter, const char* filename) {
4023 SkPath path, pathB;
4024 path.moveTo(1,2);
4025 path.cubicTo(0,6, -3.16666675f,3.66666675f, 6.33333349f,3.33333349f);
4026 path.close();
4027 pathB.moveTo(0,6);
4028 pathB.cubicTo(-3.16666675f,3.66666675f, 6.33333349f,3.33333349f, 1,2);
4029 pathB.close();
4030 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4031}
4032
4033static void loop15(skiatest::Reporter* reporter, const char* filename) {
4034 SkPath path, pathB;
4035 path.moveTo(2,6);
4036 path.cubicTo(1,2, 7.16666698f,6.66666698f, -4.66666651f,7.66666651f);
4037 path.close();
4038 pathB.moveTo(1,2);
4039 pathB.cubicTo(7.16666698f,6.66666698f, -4.66666651f,7.66666651f, 2,6);
4040 pathB.close();
4041 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_runFail);
4042}
4043
4044// lots of loopy interesections -- all points appear to be present -- needs more investigation
4045static void loop16(skiatest::Reporter* reporter, const char* filename) {
4046 SkPath path, pathB;
4047 path.moveTo(1,5);
4048 path.cubicTo(0,1, 7.33333302f,5.33333349f, -7,7);
4049 path.close();
4050 pathB.moveTo(0,1);
4051 pathB.cubicTo(7.33333302f,5.33333349f, -7,7, 1,5);
4052 pathB.close();
4053 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_runFail);
4054}
4055
4056static void cubicOp133(skiatest::Reporter* reporter, const char* filename) {
4057 SkPath path, pathB;
4058 path.setFillType(SkPath::kWinding_FillType);
4059 path.moveTo(5,6);
4060 path.cubicTo(5,6, 5,0, 4,1);
4061 path.close();
4062 pathB.setFillType(SkPath::kWinding_FillType);
4063 pathB.moveTo(0,5);
4064 pathB.cubicTo(1,4, 6,5, 6,5);
4065 pathB.close();
4066 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4067}
4068
4069static void cubicOp134(skiatest::Reporter* reporter, const char* filename) {
4070 SkPath path, pathB;
4071 path.setFillType(SkPath::kWinding_FillType);
4072 path.moveTo(5,6);
4073 path.cubicTo(5,6, 6,0, 3,1);
4074 path.close();
4075 pathB.setFillType(SkPath::kWinding_FillType);
4076 pathB.moveTo(0,6);
4077 pathB.cubicTo(1,3, 6,5, 6,5);
4078 pathB.close();
4079 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4080}
4081
4082static void cubicOp135(skiatest::Reporter* reporter, const char* filename) {
4083 SkPath path, pathB;
4084 path.setFillType(SkPath::kWinding_FillType);
4085 path.moveTo(5,6);
4086 path.cubicTo(5,6, 6,0, 4,1);
4087 path.close();
4088 pathB.setFillType(SkPath::kWinding_FillType);
4089 pathB.moveTo(0,6);
4090 pathB.cubicTo(1,4, 6,5, 6,5);
4091 pathB.close();
4092 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4093}
4094
4095static void cubicOp136(skiatest::Reporter* reporter, const char* filename) {
4096 SkPath path, pathB;
4097 path.setFillType(SkPath::kWinding_FillType);
4098 path.moveTo(5,6);
4099 path.cubicTo(5,6, 5,0, 3,1);
4100 path.close();
4101 pathB.setFillType(SkPath::kWinding_FillType);
4102 pathB.moveTo(0,5);
4103 pathB.cubicTo(1,3, 6,5, 6,5);
4104 pathB.close();
4105 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4106}
4107
4108static void cubicOp136a(skiatest::Reporter* reporter, const char* filename) {
4109 SkPath path, pathB;
4110 path.setFillType(SkPath::kWinding_FillType);
4111 path.moveTo(5,6);
4112 path.quadTo(5,0, 3,1);
4113 path.close();
4114 pathB.setFillType(SkPath::kWinding_FillType);
4115 pathB.moveTo(0,5);
4116 pathB.cubicTo(1,3, 6,5, 6,5);
4117 pathB.close();
4118 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4119}
4120
4121static void cubics137(skiatest::Reporter* reporter, const char* filename) {
4122 SkPath path, pathB;
4123 path.setFillType(SkPath::kWinding_FillType);
4124 path.moveTo(0, 5);
4125 path.cubicTo(3, 6, 1, 0, 3, 2);
4126 path.close();
4127 pathB.setFillType(SkPath::kWinding_FillType);
4128 pathB.moveTo(0, 1);
4129 pathB.cubicTo(2, 3, 5, 0, 6, 3);
4130 pathB.close();
4131 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4132}
4133
4134static void cubics138(skiatest::Reporter* reporter, const char* filename) {
4135 SkPath path, pathB;
4136 path.setFillType(SkPath::kWinding_FillType);
4137 path.moveTo(0, 5);
4138 path.cubicTo(3, 6, 1, 0, 4, 2);
4139 path.close();
4140 pathB.setFillType(SkPath::kWinding_FillType);
4141 pathB.moveTo(0, 1);
4142 pathB.cubicTo(2, 4, 5, 0, 6, 3);
4143 pathB.close();
4144 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4145}
4146
4147// three curves intersect successfully nearby -- the angle only gets 2 of the 3 pts
4148static void cubicOp139(skiatest::Reporter* reporter, const char* filename) {
4149 SkPath path, pathB;
4150 path.setFillType(SkPath::kWinding_FillType);
4151 path.moveTo(0,2);
4152 path.cubicTo(0,4, 3,1, 5,1);
4153 path.close();
4154 pathB.setFillType(SkPath::kWinding_FillType);
4155 pathB.moveTo(1,3);
4156 pathB.cubicTo(1,5, 2,0, 4,0);
4157 pathB.close();
4158 testPathOpCheck(reporter, path, pathB, kDifference_SkPathOp, filename, FLAGS_runFail);
4159}
4160
4161static void cubicOp140(skiatest::Reporter* reporter, const char* filename) {
4162 SkPath path, pathB;
4163 path.setFillType(SkPath::kWinding_FillType);
4164 path.moveTo(0,2);
4165 path.cubicTo(1,2, 5,4, 3,2);
4166 path.close();
4167 pathB.setFillType(SkPath::kWinding_FillType);
4168 pathB.moveTo(4,5);
4169 pathB.cubicTo(2,3, 2,0, 2,1);
4170 pathB.close();
4171 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4172}
4173
4174static void cubicOp141(skiatest::Reporter* reporter, const char* filename) {
4175 SkPath path, pathB;
4176 path.setFillType(SkPath::kWinding_FillType);
4177 path.moveTo(0,2);
4178 path.cubicTo(1,2, 6,4, 3,2);
4179 path.close();
4180 pathB.setFillType(SkPath::kWinding_FillType);
4181 pathB.moveTo(4,6);
4182 pathB.cubicTo(2,3, 2,0, 2,1);
4183 pathB.close();
4184 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4185}
4186
4187static void quadRect1(skiatest::Reporter* reporter, const char* filename) {
4188 SkPath path, pathB;
4189 path.moveTo(6,15);
4190 path.quadTo(16,0, 8,4);
4191 path.quadTo(2,7, 12,12);
4192 path.close();
4193 pathB.addRect(4,11, 13,16);
4194 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4195}
4196
4197static void quadRect2(skiatest::Reporter* reporter, const char* filename) {
4198 SkPath path, pathB;
4199 path.moveTo(5,12);
4200 path.quadTo(15,7, 9,4);
4201 path.quadTo(1,0, 11,15);
4202 path.close();
4203 pathB.addRect(4,11, 13,16);
4204 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4205}
4206
4207static void quadRect3(skiatest::Reporter* reporter, const char* filename) {
4208 SkPath path, pathB;
4209 path.moveTo(12,12);
4210 path.quadTo(2,7, 8,4);
4211 path.quadTo(16,0, 6,15);
4212 path.close();
4213 pathB.addRect(4,11, 13,16);
4214 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4215}
4216
4217static void quadRect4(skiatest::Reporter* reporter, const char* filename) {
4218 SkPath path, pathB;
4219 path.moveTo(11,15);
4220 path.quadTo(1,0, 9,4);
4221 path.quadTo(15,7, 5,12);
4222 path.close();
4223 pathB.addRect(4,11, 13,16);
4224 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4225}
4226
4227static void quadRect5(skiatest::Reporter* reporter, const char* filename) {
4228 SkPath path, pathB;
4229 path.moveTo(11,13);
4230 path.quadTo(4,4, 8,4);
4231 path.quadTo(12,4, 5,13);
4232 path.close();
4233 pathB.addRect(4,11, 13,16);
4234 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4235}
4236
4237static void quadRect6(skiatest::Reporter* reporter, const char* filename) {
4238 SkPath path, pathB;
4239 path.moveTo(5,13);
4240 path.quadTo(12,4, 8,4);
4241 path.quadTo(4,4, 11,13);
4242 path.close();
4243 pathB.addRect(4,11, 13,16);
4244 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4245}
4246
4247static void loops4i(skiatest::Reporter* reporter, const char* filename) {
4248 SkPath path, pathB;
4249 path.setFillType(SkPath::kWinding_FillType);
4250 path.moveTo(0, 3);
4251 path.cubicTo(0, 2, 0, 2, -1.66666663f, 2.16666675f);
4252 path.close();
4253 pathB.setFillType(SkPath::kWinding_FillType);
4254 pathB.moveTo(0, 2);
4255 pathB.cubicTo(0, 2, -1.66666663f, 2.16666675f, 0, 3);
4256 pathB.close();
4257 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4258}
4259
4260static void loops5i(skiatest::Reporter* reporter, const char* filename) {
4261 SkPath path, pathB;
4262 path.setFillType(SkPath::kWinding_FillType);
4263 path.moveTo(1, 2);
4264 path.cubicTo(0, 2, 0, 2, 0.166666672f, 2.66666675f);
4265 path.close();
4266 pathB.setFillType(SkPath::kWinding_FillType);
4267 pathB.moveTo(0, 2);
4268 pathB.cubicTo(0, 2, 0.166666672f, 2.66666675f, 1, 2);
4269 pathB.close();
4270 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4271}
4272
caryclark54359292015-03-26 07:52:43 -07004273static void (*skipTest)(skiatest::Reporter* , const char* filename) = 0;
caryclark630240d2014-09-19 06:33:31 -07004274static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0;
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00004275static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0;
caryclark@google.com818b0cc2013-04-08 11:50:46 +00004276
4277static struct TestDesc tests[] = {
caryclark03b03ca2015-04-23 09:13:37 -07004278 TEST(loops4i),
4279 TEST(quadRect1),
4280 TEST(quadRect2),
4281 TEST(quadRect3),
4282 TEST(quadRect4),
4283 TEST(quadRect5),
4284 TEST(quadRect6),
4285 TEST(cubicOp141),
4286 TEST(cubicOp58d),
4287 TEST(loops5i),
4288 TEST(cubicOp140),
4289 TEST(cubicOp139),
4290 TEST(cubics138),
4291 TEST(cubics137),
4292 TEST(cubicOp136a),
4293 TEST(cubicOp136),
4294 TEST(cubicOp135),
4295 TEST(cubicOp134),
4296 TEST(cubicOp133),
4297 TEST(loop16),
4298 TEST(loop15),
4299 TEST(loop12),
caryclark1049f122015-04-20 08:31:59 -07004300 TEST(cubicOp132),
4301 TEST(loop11),
4302 TEST(loop10),
4303 TEST(circlesOp3),
4304 TEST(loop9),
4305 TEST(loop8),
4306 TEST(rects5),
4307 TEST(loop7),
4308 TEST(cubicOp130a),
4309 TEST(rRect1x),
4310 TEST(circlesOp2),
4311 TEST(circlesOp1),
4312 TEST(cubicOp131),
4313 TEST(cubicOp130),
4314 TEST(cubicOp129),
caryclark54359292015-03-26 07:52:43 -07004315 TEST(cubicOp128),
4316 TEST(cubicOp127),
4317 TEST(cubicOp126),
4318 TEST(cubicOp125),
4319 TEST(cubicOp124),
4320 TEST(loop6),
4321 TEST(loop5),
4322 TEST(cubicOp123),
4323 TEST(cubicOp122),
4324 TEST(cubicOp121),
4325 TEST(cubicOp120),
4326 TEST(cubicOp119),
4327 TEST(loop4),
4328 TEST(loop3),
4329 TEST(loop2),
4330 TEST(loop1asQuad),
4331 TEST(loop1),
4332 TEST(issue3517),
4333 TEST(cubicOp118),
4334 TEST(cubicOp117),
4335 TEST(cubicOp116),
4336 TEST(testRect2),
4337 TEST(testRect1),
caryclark65f55312014-11-13 06:58:52 -08004338 TEST(cubicOp115),
caryclark54359292015-03-26 07:52:43 -07004339 TEST(issue2753),
caryclark03b03ca2015-04-23 09:13:37 -07004340 TEST(cubicOp114),
caryclark80a83ad2014-08-12 05:49:37 -07004341 TEST(issue2808),
caryclarke4097e32014-06-18 07:24:19 -07004342 TEST(cubicOp114asQuad),
caryclarkdac1d172014-06-17 05:15:38 -07004343 TEST(rects4),
4344 TEST(rects3),
4345 TEST(rects2),
4346 TEST(rects1),
caryclarkdac1d172014-06-17 05:15:38 -07004347 TEST(issue2540),
commit-bot@chromium.org2db7fe72014-05-07 15:31:40 +00004348 TEST(issue2504),
commit-bot@chromium.org91fc81c2014-04-30 13:37:48 +00004349 TEST(kari1),
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00004350 TEST(quadOp10i),
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00004351 TEST(cubicOp113),
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00004352 TEST(skpcarrot_is24),
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00004353 TEST(issue1417),
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +00004354 TEST(cubicOp112),
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00004355 TEST(skpadspert_net23),
4356 TEST(skpadspert_de11),
4357 TEST(findFirst1),
4358 TEST(xOp2i),
4359 TEST(xOp3i),
4360 TEST(xOp1u),
4361 TEST(xOp1i),
4362 TEST(cubicOp111),
4363 TEST(cubicOp110),
4364 TEST(cubicOp109),
4365 TEST(cubicOp108),
4366 TEST(cubicOp107),
4367 TEST(cubicOp106),
4368 TEST(cubicOp105),
4369 TEST(cubicOp104),
4370 TEST(cubicOp103),
4371 TEST(cubicOp102),
4372 TEST(cubicOp101),
4373 TEST(cubicOp100),
4374 TEST(cubicOp99),
4375 TEST(issue1435),
caryclark@google.coma2bbc6e2013-11-01 17:36:03 +00004376 TEST(cubicOp98x),
4377 TEST(cubicOp97x),
caryclark54359292015-03-26 07:52:43 -07004378 TEST(skpcarpetplanet_ru22),
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00004379 TEST(cubicOp96d),
4380 TEST(cubicOp95u),
4381 TEST(skpadbox_lt15),
4382 TEST(skpagentxsites_com55),
4383 TEST(skpadventistmission_org572),
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00004384 TEST(skpadoption_org196),
4385 TEST(skpbambootheme_com12),
4386 TEST(skpbakosoft_com10),
4387 TEST(skpakmmos_ru100),
4388 TEST(skpbangalorenest_com4),
4389 TEST(skpbingoentertainment_net189),
4390 TEST(skpbestred_ru37),
4391 TEST(skpbenzoteh_ru152),
4392 TEST(skpcamcorder_kz21),
4393 TEST(skpcaffelavazzait_com_ua21),
4394 TEST(skpcarrefour_ro62),
4395 TEST(skpcavablar_net563),
4396 TEST(skpinsomnia_gr72),
4397 TEST(skpadbox_lt8),
4398 TEST(skpact_com43),
4399 TEST(skpacesoftech_com47),
4400 TEST(skpabcspark_ca103),
4401 TEST(cubicOp94u),
4402 TEST(cubicOp93d),
4403 TEST(cubicOp92i),
4404 TEST(skpadithya_putr4_blogspot_com551),
4405 TEST(skpadindex_de4),
caryclark@google.com7eaa53d2013-10-02 14:49:34 +00004406 TEST(skpaiaigames_com870),
4407 TEST(skpaaalgarve_org53),
4408 TEST(skpkkiste_to716),
caryclark@google.com570863f2013-09-16 15:55:01 +00004409 TEST(cubicOp91u),
4410 TEST(cubicOp90u),
4411 TEST(cubicOp89u),
4412 TEST(cubicOp88u),
4413 TEST(cubicOp87u),
4414 TEST(cubicOp86i),
4415 TEST(loopEdge2),
4416 TEST(loopEdge1),
4417 TEST(rectOp3x),
4418 TEST(rectOp2i),
4419 TEST(rectOp1i),
4420 TEST(issue1418b),
caryclark@google.com4fdbb222013-07-23 15:27:41 +00004421 TEST(cubicOp85i),
caryclark@google.com4fdbb222013-07-23 15:27:41 +00004422 TEST(issue1418),
4423 TEST(skpkkiste_to98),
caryclark@google.comfa2aeee2013-07-15 13:29:13 +00004424 TEST(skpahrefs_com29),
4425 TEST(cubicOp85d),
4426 TEST(skpahrefs_com88),
caryclark@google.com07e97fc2013-07-08 17:17:02 +00004427 TEST(skphealth_com76),
4428 TEST(skpancestry_com1),
4429 TEST(skpbyte_com1),
4430 TEST(skpeldorado_com_ua1),
4431 TEST(skp96prezzi1),
caryclark@google.comcffbcc32013-06-04 17:59:42 +00004432 TEST(skpClip2),
caryclark@google.comcffbcc32013-06-04 17:59:42 +00004433 TEST(skpClip1),
4434 TEST(cubicOp84d),
4435 TEST(cubicOp83i),
reed@google.com277c3f82013-05-31 15:17:50 +00004436 TEST(cubicOp82i),
4437 TEST(cubicOp81d),
4438 TEST(cubicOp80i),
4439 TEST(cubicOp79u),
reed@google.com277c3f82013-05-31 15:17:50 +00004440 TEST(cubicOp78u),
4441 TEST(cubicOp77i),
caryclark@google.comcffbcc32013-06-04 17:59:42 +00004442 TEST(cubicOp76u),
reed@google.com277c3f82013-05-31 15:17:50 +00004443 TEST(cubicOp75d),
caryclark@google.comcffbcc32013-06-04 17:59:42 +00004444 TEST(cubicOp74d),
reed@google.com277c3f82013-05-31 15:17:50 +00004445 TEST(cubicOp73d),
4446 TEST(cubicOp72i),
4447 TEST(cubicOp71d),
caryclark@google.coma5e55922013-05-07 18:51:31 +00004448 TEST(skp5),
4449 TEST(skp4),
4450 TEST(skp3),
4451 TEST(skp2),
4452 TEST(skp1),
caryclark@google.com6dc7df62013-04-25 11:51:54 +00004453 TEST(rRect1),
caryclark@google.coma5e55922013-05-07 18:51:31 +00004454 TEST(cubicOp70d),
caryclark@google.com03610322013-04-18 15:58:21 +00004455 TEST(cubicOp69d),
4456 TEST(cubicOp68u),
caryclark@google.comb3f09212013-04-17 15:49:16 +00004457 TEST(cubicOp67u),
4458 TEST(cubicOp66u),
caryclark@google.com818b0cc2013-04-08 11:50:46 +00004459 TEST(rectOp1d),
4460 TEST(cubicOp65d),
4461 TEST(cubicOp64d),
4462 TEST(cubicOp63d),
4463 TEST(cubicOp62d),
4464 TEST(cubicOp61d),
4465 TEST(cubicOp60d),
4466 TEST(cubicOp59d),
caryclark@google.com818b0cc2013-04-08 11:50:46 +00004467 TEST(cubicOp57d),
4468 TEST(cubicOp56d),
4469 TEST(cubicOp55d),
4470 TEST(cubicOp54d),
4471 TEST(cubicOp53d),
4472 TEST(cubicOp52d),
4473 TEST(cubicOp51d),
4474 TEST(cubicOp50d),
4475 TEST(cubicOp49d),
4476 TEST(cubicOp48d),
4477 TEST(cubicOp47d),
4478 TEST(cubicOp46d),
4479 TEST(cubicOp45d),
4480 TEST(cubicOp44d),
4481 TEST(cubicOp43d),
4482 TEST(cubicOp42d),
4483 TEST(cubicOp41i),
4484 TEST(cubicOp40d),
4485 TEST(cubicOp39d),
4486 TEST(cubicOp38d),
4487 TEST(cubicOp37d),
4488 TEST(cubicOp36u),
4489 TEST(cubicOp35d),
4490 TEST(cubicOp34d),
4491 TEST(cubicOp33i),
4492 TEST(cubicOp32d),
4493 TEST(cubicOp31d),
4494 TEST(cubicOp31x),
4495 TEST(cubicOp31u),
4496 TEST(cubicOp30d),
4497 TEST(cubicOp29d),
4498 TEST(cubicOp28u),
4499 TEST(cubicOp27d),
4500 TEST(cubicOp26d),
4501 TEST(cubicOp25i),
4502 TEST(testOp8d),
4503 TEST(testDiff1),
4504 TEST(testIntersect1),
4505 TEST(testUnion1),
4506 TEST(testXor1),
4507 TEST(testDiff2),
4508 TEST(testIntersect2),
4509 TEST(testUnion2),
4510 TEST(testXor2),
4511 TEST(testOp1d),
4512 TEST(testOp2d),
4513 TEST(testOp3d),
4514 TEST(testOp1u),
4515 TEST(testOp4d),
4516 TEST(testOp5d),
4517 TEST(testOp6d),
4518 TEST(testOp7d),
4519 TEST(testOp2u),
4520
4521 TEST(cubicOp24d),
4522 TEST(cubicOp23d),
4523 TEST(cubicOp22d),
4524 TEST(cubicOp21d),
4525 TEST(cubicOp20d),
4526 TEST(cubicOp19i),
4527 TEST(cubicOp18d),
4528 TEST(cubicOp17d),
4529 TEST(cubicOp16d),
4530 TEST(cubicOp15d),
4531 TEST(cubicOp14d),
4532 TEST(cubicOp13d),
4533 TEST(cubicOp12d),
4534 TEST(cubicOp11d),
4535 TEST(cubicOp10d),
4536 TEST(cubicOp1i),
4537 TEST(cubicOp9d),
4538 TEST(quadOp9d),
4539 TEST(lineOp9d),
4540 TEST(cubicOp8d),
4541 TEST(cubicOp7d),
4542 TEST(cubicOp6d),
4543 TEST(cubicOp5d),
4544 TEST(cubicOp3d),
4545 TEST(cubicOp2d),
4546 TEST(cubicOp1d),
4547};
4548
caryclark@google.comad65a3e2013-04-15 19:13:59 +00004549static const size_t testCount = SK_ARRAY_COUNT(tests);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00004550
4551static struct TestDesc subTests[] = {
caryclark03b03ca2015-04-23 09:13:37 -07004552 TEST(loop16),
4553 TEST(loop15),
4554 TEST(loop12),
4555 TEST(cubicOp132),
4556 TEST(loop11),
4557 TEST(loop10),
4558 TEST(circlesOp3),
4559 TEST(loop9),
4560 TEST(loop8),
4561 TEST(rects5),
4562 TEST(loop7),
4563 TEST(cubicOp130a),
4564 TEST(rRect1x),
4565 TEST(circlesOp2),
4566 TEST(circlesOp1),
4567 TEST(cubicOp131),
4568 TEST(cubicOp130),
4569 TEST(cubicOp129),
4570 TEST(cubicOp128),
4571 TEST(cubicOp127),
4572 TEST(cubicOp126),
4573 TEST(cubicOp125),
4574 TEST(cubicOp124),
4575 TEST(loop6),
4576 TEST(loop5),
4577 TEST(cubicOp123),
4578 TEST(cubicOp122),
4579 TEST(cubicOp121),
4580 TEST(cubicOp120),
4581 TEST(cubicOp119),
4582 TEST(loop4),
4583 TEST(loop3),
4584 TEST(loop2),
4585 TEST(loop1asQuad),
4586 TEST(loop1),
4587 TEST(issue3517),
4588 TEST(cubicOp118),
4589 TEST(cubicOp117),
4590 TEST(cubicOp116),
4591 TEST(testRect2),
4592 TEST(testRect1),
4593 TEST(cubicOp115),
4594 TEST(issue2753),
4595 TEST(cubicOp114),
4596 TEST(issue2808),
4597 TEST(cubicOp114asQuad),
4598 TEST(rects4),
4599 TEST(rects3),
4600 TEST(rects2),
4601 TEST(rects1),
4602 TEST(issue2540),
4603 TEST(issue2504),
4604 TEST(kari1),
4605 TEST(quadOp10i),
4606 TEST(cubicOp113),
4607 TEST(skpcarrot_is24),
4608 TEST(issue1417),
4609 TEST(cubicOp112),
4610 TEST(skpadspert_net23),
4611 TEST(skpadspert_de11),
4612 TEST(findFirst1),
4613 TEST(xOp2i),
4614 TEST(xOp3i),
4615 TEST(xOp1u),
4616 TEST(xOp1i),
4617 TEST(cubicOp111),
4618 TEST(cubicOp110),
4619 TEST(cubicOp109),
4620 TEST(cubicOp108),
4621 TEST(cubicOp107),
4622 TEST(cubicOp106),
4623 TEST(cubicOp105),
4624 TEST(cubicOp104),
4625 TEST(cubicOp103),
4626 TEST(cubicOp102),
4627 TEST(cubicOp101),
4628 TEST(cubicOp100),
4629 TEST(cubicOp99),
caryclark@google.com818b0cc2013-04-08 11:50:46 +00004630};
4631
caryclark@google.comad65a3e2013-04-15 19:13:59 +00004632static const size_t subTestCount = SK_ARRAY_COUNT(subTests);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00004633
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00004634static void (*firstSubTest)(skiatest::Reporter* , const char* filename) = 0;
caryclark@google.com818b0cc2013-04-08 11:50:46 +00004635
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00004636static bool runSubTests = false;
caryclark03b03ca2015-04-23 09:13:37 -07004637static bool runSubTestsFirst = true;
caryclark@google.com818b0cc2013-04-08 11:50:46 +00004638static bool runReverse = false;
caryclark@google.com818b0cc2013-04-08 11:50:46 +00004639
tfarina@chromium.org78e7b4e2014-01-02 21:45:03 +00004640DEF_TEST(PathOpsOp, reporter) {
caryclark@google.com07e97fc2013-07-08 17:17:02 +00004641#if DEBUG_SHOW_TEST_NAME
4642 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
4643#endif
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00004644 if (runSubTests && runSubTestsFirst) {
caryclark54359292015-03-26 07:52:43 -07004645 RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTest, runReverse);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00004646 }
caryclark54359292015-03-26 07:52:43 -07004647 RunTestSet(reporter, tests, testCount, firstTest, skipTest, stopTest, runReverse);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00004648 if (runSubTests && !runSubTestsFirst) {
caryclark54359292015-03-26 07:52:43 -07004649 RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTest, runReverse);
caryclark@google.com818b0cc2013-04-08 11:50:46 +00004650 }
caryclark@google.com818b0cc2013-04-08 11:50:46 +00004651}
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00004652
4653static void bufferOverflow(skiatest::Reporter* reporter, const char* filename) {
4654 SkPath path;
4655 path.addRect(0,0, 300,170141183460469231731687303715884105728.f);
4656 SkPath pathB;
4657 pathB.addRect(0,0, 300,16);
caryclark54359292015-03-26 07:52:43 -07004658 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00004659}
4660
caryclark361b8b02014-09-08 10:25:38 -07004661// m 100,0 60,170 -160,-110 200,0 -170,11000000000 z
4662static void fuzz433(skiatest::Reporter* reporter, const char* filename) {
4663 SkPath path1, path2;
4664 path1.moveTo(100,0);
4665 path1.lineTo(60,170);
4666 path1.lineTo(-160,-110);
4667 path1.lineTo(200,0);
4668 path1.lineTo(-170,11000000000.0f);
4669 path1.close();
4670
4671 path2.moveTo(100 + 20,0 + 20);
4672 path2.lineTo(60 + 20,170 + 20);
4673 path2.lineTo(-160 + 20,-110 + 20);
4674 path2.lineTo(200 + 20,0 + 20);
4675 path2.lineTo(-170 + 20,11000000000.0f + 20);
4676 path2.close();
4677
caryclark1049f122015-04-20 08:31:59 -07004678 testPathOpFailCheck(reporter, path1, path2, kIntersect_SkPathOp, filename);
caryclark361b8b02014-09-08 10:25:38 -07004679}
4680
4681static void fuzz433b(skiatest::Reporter* reporter, const char* filename) {
4682 SkPath path1, path2;
4683 path1.setFillType(SkPath::kEvenOdd_FillType);
4684 path1.moveTo(140, 40);
4685 path1.lineTo(200, 210);
4686 path1.lineTo(40, 100);
4687 path1.lineTo(240, 100);
4688 path1.lineTo(70, 1.1e+10f);
4689 path1.lineTo(140, 40);
4690 path1.close();
4691
4692 path1.setFillType(SkPath::kWinding_FillType);
4693 path2.moveTo(190, 60);
4694 path2.lineTo(250, 230);
4695 path2.lineTo(90, 120);
4696 path2.lineTo(290, 120);
4697 path2.lineTo(120, 1.1e+10f);
4698 path2.lineTo(190, 60);
4699 path2.close();
4700
caryclark1049f122015-04-20 08:31:59 -07004701 testPathOpFailCheck(reporter, path1, path2, kUnion_SkPathOp, filename);
caryclark361b8b02014-09-08 10:25:38 -07004702}
4703
caryclark630240d2014-09-19 06:33:31 -07004704static void fuzz487a(skiatest::Reporter* reporter, const char* filename) {
4705 SkPath path;
4706 path.setFillType((SkPath::FillType) 0);
4707path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
4708path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000));
4709path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x429a6666), SkBits2Float(0x42f9999a), SkBits2Float(0x4275999a), SkBits2Float(0x42d70001), SkBits2Float(0x42633333));
4710path.lineTo(SkBits2Float(0x42e90001), SkBits2Float(0x41b8cccc));
4711path.cubicTo(SkBits2Float(0x42dc6667), SkBits2Float(0x41ab3332), SkBits2Float(0x42cf3334), SkBits2Float(0x41a3ffff), SkBits2Float(0x42c20001), SkBits2Float(0x41a3ffff));
4712path.lineTo(SkBits2Float(0x42c20001), SkBits2Float(0x425d999a));
4713path.lineTo(SkBits2Float(0x42c20001), SkBits2Float(0x425d999a));
4714path.cubicTo(SkBits2Float(0x429c6668), SkBits2Float(0x425d999a), SkBits2Float(0x4279999c), SkBits2Float(0x42886667), SkBits2Float(0x42673335), SkBits2Float(0x42ab0000));
4715path.lineTo(SkBits2Float(0x41c0ccd0), SkBits2Float(0x42990000));
4716path.cubicTo(SkBits2Float(0x41b33336), SkBits2Float(0x42a5999a), SkBits2Float(0x41ac0003), SkBits2Float(0x42b2cccd), SkBits2Float(0x41ac0003), SkBits2Float(0x42c00000));
4717path.lineTo(SkBits2Float(0x4261999c), SkBits2Float(0x42c00000));
4718path.lineTo(SkBits2Float(0x4261999c), SkBits2Float(0x42c00000));
4719path.cubicTo(SkBits2Float(0x4261999c), SkBits2Float(0x434d3333), SkBits2Float(0x4364e667), SkBits2Float(0x4346b333), SkBits2Float(0x4364e667), SkBits2Float(0x43400000));
4720path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
4721path.close();
4722
4723 SkPath path1(path);
4724 path.reset();
4725 path.setFillType((SkPath::FillType) 0);
4726path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
4727path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000));
4728path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x42a20000), SkBits2Float(0x43016667), SkBits2Float(0x4287cccd), SkBits2Float(0x42ea999a), SkBits2Float(0x4273999a));
4729path.lineTo(SkBits2Float(0x4306cccd), SkBits2Float(0x41f5999a));
4730path.cubicTo(SkBits2Float(0x42f76667), SkBits2Float(0x41c26667), SkBits2Float(0x42dd999a), SkBits2Float(0x41a4cccd), SkBits2Float(0x42c23334), SkBits2Float(0x41a4cccd));
4731path.lineTo(SkBits2Float(0x42c23334), SkBits2Float(0x425e0000));
4732path.cubicTo(SkBits2Float(0x42a43334), SkBits2Float(0x425e0000), SkBits2Float(0x428a0001), SkBits2Float(0x427ecccd), SkBits2Float(0x42780002), SkBits2Float(0x4297999a));
4733path.lineTo(SkBits2Float(0x41fccccd), SkBits2Float(0x42693333));
4734path.cubicTo(SkBits2Float(0x41c9999a), SkBits2Float(0x428acccd), SkBits2Float(0x41ac0000), SkBits2Float(0x42a4999a), SkBits2Float(0x41ac0000), SkBits2Float(0x42c00000));
4735path.lineTo(SkBits2Float(0x4261999a), SkBits2Float(0x42c00000));
4736path.cubicTo(SkBits2Float(0x4261999a), SkBits2Float(0x42de0000), SkBits2Float(0x42813333), SkBits2Float(0x42f83333), SkBits2Float(0x42996666), SkBits2Float(0x4303199a));
4737path.cubicTo(SkBits2Float(0x4272cccc), SkBits2Float(0x4303199a), SkBits2Float(0x423d3332), SkBits2Float(0x430de667), SkBits2Float(0x422d9999), SkBits2Float(0x431cb334));
4738path.lineTo(SkBits2Float(0x7086a1dc), SkBits2Float(0x42eecccd));
4739path.lineTo(SkBits2Float(0x41eb3333), SkBits2Float(0xc12ccccd));
4740path.lineTo(SkBits2Float(0x42053333), SkBits2Float(0xc1cccccd));
4741path.lineTo(SkBits2Float(0x42780000), SkBits2Float(0xc18f3334));
4742path.cubicTo(SkBits2Float(0x43206666), SkBits2Float(0x43134ccd), SkBits2Float(0x43213333), SkBits2Float(0x430db333), SkBits2Float(0x43213333), SkBits2Float(0x43080000));
4743path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
4744path.close();
4745
4746 SkPath path2(path);
caryclark1049f122015-04-20 08:31:59 -07004747 testPathOpFailCheck(reporter, path1, path2, (SkPathOp) 2, filename);
caryclark630240d2014-09-19 06:33:31 -07004748}
4749
4750static void fuzz487b(skiatest::Reporter* reporter, const char* filename) {
4751 SkPath path;
4752 path.setFillType((SkPath::FillType) 0);
4753path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
4754path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000));
4755path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x429a6666), SkBits2Float(0x42f9999a), SkBits2Float(0x4275999a), SkBits2Float(0x42d70001), SkBits2Float(0x42633333));
4756path.lineTo(SkBits2Float(0x42e90001), SkBits2Float(0x41b8cccc));
4757path.cubicTo(SkBits2Float(0x42dc6667), SkBits2Float(0x41ab3332), SkBits2Float(0x42cf3334), SkBits2Float(0x41a3ffff), SkBits2Float(0x42c20001), SkBits2Float(0x41a3ffff));
4758path.lineTo(SkBits2Float(0x42c20001), SkBits2Float(0x425d999a));
4759path.lineTo(SkBits2Float(0x42c20001), SkBits2Float(0x425d999a));
4760path.cubicTo(SkBits2Float(0x429c6668), SkBits2Float(0x425d999a), SkBits2Float(0x4279999c), SkBits2Float(0x42886667), SkBits2Float(0x42673335), SkBits2Float(0x42ab0000));
4761path.lineTo(SkBits2Float(0x41c0ccd0), SkBits2Float(0x42990000));
4762path.cubicTo(SkBits2Float(0x41b33336), SkBits2Float(0x42a5999a), SkBits2Float(0x41ac0003), SkBits2Float(0x42b2cccd), SkBits2Float(0x41ac0003), SkBits2Float(0x42c00000));
4763path.lineTo(SkBits2Float(0x4261999c), SkBits2Float(0x42c00000));
4764path.lineTo(SkBits2Float(0x4261999c), SkBits2Float(0x42c00000));
4765path.cubicTo(SkBits2Float(0x4261999c), SkBits2Float(0x434d3333), SkBits2Float(0x4364e667), SkBits2Float(0x4346b333), SkBits2Float(0x4364e667), SkBits2Float(0x43400000));
4766path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
4767path.close();
4768
4769 SkPath path1(path);
4770 path.reset();
4771 path.setFillType((SkPath::FillType) 0);
4772path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
4773path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000));
4774path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x42a20000), SkBits2Float(0x43016667), SkBits2Float(0x4287cccd), SkBits2Float(0x42ea999a), SkBits2Float(0x4273999a));
4775path.lineTo(SkBits2Float(0x4306cccd), SkBits2Float(0x41f5999a));
4776path.cubicTo(SkBits2Float(0x42f76667), SkBits2Float(0x41c26667), SkBits2Float(0x42dd999a), SkBits2Float(0x41a4cccd), SkBits2Float(0x42c23334), SkBits2Float(0x41a4cccd));
4777path.lineTo(SkBits2Float(0x42c23334), SkBits2Float(0x425e0000));
4778path.cubicTo(SkBits2Float(0x42a43334), SkBits2Float(0x425e0000), SkBits2Float(0x428a0001), SkBits2Float(0x427ecccd), SkBits2Float(0x42780002), SkBits2Float(0x4297999a));
4779path.lineTo(SkBits2Float(0x41fccccd), SkBits2Float(0x42693333));
4780path.cubicTo(SkBits2Float(0x41c9999a), SkBits2Float(0x428acccd), SkBits2Float(0x41ac0000), SkBits2Float(0x42a4999a), SkBits2Float(0x41ac0000), SkBits2Float(0x42c00000));
4781path.lineTo(SkBits2Float(0x4261999a), SkBits2Float(0x42c00000));
4782path.cubicTo(SkBits2Float(0x4261999a), SkBits2Float(0x42de0000), SkBits2Float(0x42813333), SkBits2Float(0x42f83333), SkBits2Float(0x42996666), SkBits2Float(0x4303199a));
4783path.cubicTo(SkBits2Float(0x4272cccc), SkBits2Float(0x4303199a), SkBits2Float(0x423d3332), SkBits2Float(0x430de667), SkBits2Float(0x422d9999), SkBits2Float(0x431cb334));
4784path.lineTo(SkBits2Float(0x7086a1dc), SkBits2Float(0x42eecccd));
4785path.lineTo(SkBits2Float(0x41eb3333), SkBits2Float(0xc12ccccd));
4786path.lineTo(SkBits2Float(0x42053333), SkBits2Float(0xc1cccccd));
4787path.lineTo(SkBits2Float(0x42780000), SkBits2Float(0xc18f3334));
4788path.cubicTo(SkBits2Float(0x43206666), SkBits2Float(0x43134ccd), SkBits2Float(0x43213333), SkBits2Float(0x430db333), SkBits2Float(0x43213333), SkBits2Float(0x43080000));
4789path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000));
4790path.close();
4791
4792 SkPath path2(path);
caryclark1049f122015-04-20 08:31:59 -07004793 testPathOpFailCheck(reporter, path1, path2, (SkPathOp) 2, filename);
caryclark630240d2014-09-19 06:33:31 -07004794}
4795
caryclarkc06d9a72014-09-29 06:58:41 -07004796static void fuzz714(skiatest::Reporter* reporter, const char* filename) {
4797 SkPath path;
4798 path.setFillType((SkPath::FillType) 1);
4799path.moveTo(SkBits2Float(0x430c0000), SkBits2Float(0x42200000));
4800path.lineTo(SkBits2Float(0x43480000), SkBits2Float(0x43520000));
4801path.lineTo(SkBits2Float(0x42200000), SkBits2Float(0x42c80000));
4802path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x42c80000));
4803path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x43520000));
4804path.lineTo(SkBits2Float(0x430c0000), SkBits2Float(0x42200000));
4805path.close();
4806
4807 SkPath path1(path);
4808 path.reset();
4809 path.setFillType((SkPath::FillType) 0);
4810path.moveTo(SkBits2Float(0x43200000), SkBits2Float(0x42700000));
4811path.lineTo(SkBits2Float(0x435c0000), SkBits2Float(0x43660000));
4812path.lineTo(SkBits2Float(0x42700000), SkBits2Float(0x42f00000));
4813path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x42f00000));
4814path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x43660000));
4815path.lineTo(SkBits2Float(0x43200000), SkBits2Float(0x42700000));
4816path.close();
4817
4818 SkPath path2(path);
caryclark1049f122015-04-20 08:31:59 -07004819 testPathOpFailCheck(reporter, path1, path2, (SkPathOp) 2, filename);
caryclarkc06d9a72014-09-29 06:58:41 -07004820}
4821
caryclarkd751ac02014-10-03 05:36:27 -07004822static void fuzz1(skiatest::Reporter* reporter, const char* filename) {
4823 SkPath path;
4824 path.setFillType((SkPath::FillType) 0);
4825path.moveTo(SkBits2Float(0x7f800000), SkBits2Float(0x7f800000));
4826path.quadTo(SkBits2Float(0x7f800000), SkBits2Float(0x7f800000), SkBits2Float(0x7f800000), SkBits2Float(0x7f800000));
4827path.quadTo(SkBits2Float(0x7f800000), SkBits2Float(0x7f800000), SkBits2Float(0x7f800000), SkBits2Float(0x7f800000));
4828path.quadTo(SkBits2Float(0xffc00000), SkBits2Float(0x7f800000), SkBits2Float(0xffc00000), SkBits2Float(0x7f800000));
4829path.quadTo(SkBits2Float(0xff000001), SkBits2Float(0x7f800000), SkBits2Float(0xff000001), SkBits2Float(0x7f800000));
4830path.quadTo(SkBits2Float(0xff000001), SkBits2Float(0xffc00000), SkBits2Float(0xffc00000), SkBits2Float(0xffc00000));
4831path.quadTo(SkBits2Float(0xffc00000), SkBits2Float(0xff000001), SkBits2Float(0x7f800000), SkBits2Float(0xff000001));
4832path.quadTo(SkBits2Float(0x7f800000), SkBits2Float(0xff000001), SkBits2Float(0x7f800000), SkBits2Float(0xffc00000));
4833path.quadTo(SkBits2Float(0x7f800000), SkBits2Float(0xffc00000), SkBits2Float(0x7f800000), SkBits2Float(0x7f800000));
4834path.close();
4835
4836 SkPath path1(path);
4837 path.reset();
4838 path.setFillType((SkPath::FillType) 0);
4839
4840 SkPath path2(path);
4841 testPathFailOp(reporter, path1, path2, (SkPathOp) 2, filename);
4842}
4843
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00004844static struct TestDesc failTests[] = {
caryclarkd751ac02014-10-03 05:36:27 -07004845 TEST(fuzz1),
caryclarkc06d9a72014-09-29 06:58:41 -07004846 TEST(fuzz714),
caryclark630240d2014-09-19 06:33:31 -07004847 TEST(fuzz487a),
4848 TEST(fuzz487b),
caryclark361b8b02014-09-08 10:25:38 -07004849 TEST(fuzz433b),
4850 TEST(fuzz433),
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00004851 TEST(bufferOverflow),
4852};
4853
4854static const size_t failTestCount = SK_ARRAY_COUNT(failTests);
4855
4856DEF_TEST(PathOpsFailOp, reporter) {
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00004857#if DEBUG_SHOW_TEST_NAME
4858 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
4859#endif
caryclark54359292015-03-26 07:52:43 -07004860 RunTestSet(reporter, failTests, failTestCount, NULL, NULL, NULL, false);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00004861}