OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2012 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 #include "PathOpsExtendedTest.h" |
| 8 |
| 9 #define TEST(name) { name, #name } |
| 10 |
| 11 static void cubicOp1d(skiatest::Reporter* reporter) { |
| 12 SkPath path, pathB; |
| 13 path.setFillType(SkPath::kWinding_FillType); |
| 14 path.moveTo(0,1); |
| 15 path.cubicTo(0,2, 1,0, 1,0); |
| 16 path.close(); |
| 17 pathB.setFillType(SkPath::kWinding_FillType); |
| 18 pathB.moveTo(0,1); |
| 19 pathB.cubicTo(0,1, 1,0, 2,0); |
| 20 pathB.close(); |
| 21 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 22 } |
| 23 |
| 24 static void cubicOp2d(skiatest::Reporter* reporter) { |
| 25 SkPath path, pathB; |
| 26 path.setFillType(SkPath::kWinding_FillType); |
| 27 path.moveTo(0,2); |
| 28 path.cubicTo(0,1, 1,0, 1,0); |
| 29 path.close(); |
| 30 pathB.setFillType(SkPath::kWinding_FillType); |
| 31 pathB.moveTo(0,1); |
| 32 pathB.cubicTo(0,1, 2,0, 1,0); |
| 33 pathB.close(); |
| 34 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 35 } |
| 36 |
| 37 static void cubicOp3d(skiatest::Reporter* reporter) { |
| 38 SkPath path, pathB; |
| 39 path.setFillType(SkPath::kWinding_FillType); |
| 40 path.moveTo(0,1); |
| 41 path.cubicTo(2,3, 1,0, 1,0); |
| 42 path.close(); |
| 43 pathB.setFillType(SkPath::kWinding_FillType); |
| 44 pathB.moveTo(0,1); |
| 45 pathB.cubicTo(0,1, 1,0, 3,2); |
| 46 pathB.close(); |
| 47 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 48 } |
| 49 |
| 50 static void cubicOp5d(skiatest::Reporter* reporter) { |
| 51 SkPath path, pathB; |
| 52 path.setFillType(SkPath::kWinding_FillType); |
| 53 path.moveTo(0,1); |
| 54 path.cubicTo(0,2, 1,0, 2,0); |
| 55 path.close(); |
| 56 pathB.setFillType(SkPath::kWinding_FillType); |
| 57 pathB.moveTo(0,1); |
| 58 pathB.cubicTo(0,2, 1,0, 2,0); |
| 59 pathB.close(); |
| 60 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 61 } |
| 62 |
| 63 static void cubicOp6d(skiatest::Reporter* reporter) { |
| 64 SkPath path, pathB; |
| 65 path.setFillType(SkPath::kWinding_FillType); |
| 66 path.moveTo(0,1); |
| 67 path.cubicTo(0,6, 1,0, 3,0); |
| 68 path.close(); |
| 69 pathB.setFillType(SkPath::kWinding_FillType); |
| 70 pathB.moveTo(0,1); |
| 71 pathB.cubicTo(0,3, 1,0, 6,0); |
| 72 pathB.close(); |
| 73 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 74 } |
| 75 |
| 76 static void cubicOp7d(skiatest::Reporter* reporter) { |
| 77 SkPath path, pathB; |
| 78 path.setFillType(SkPath::kWinding_FillType); |
| 79 path.moveTo(0,1); |
| 80 path.cubicTo(3,4, 1,0, 3,0); |
| 81 path.close(); |
| 82 pathB.setFillType(SkPath::kWinding_FillType); |
| 83 pathB.moveTo(0,1); |
| 84 pathB.cubicTo(0,3, 1,0, 4,3); |
| 85 pathB.close(); |
| 86 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 87 } |
| 88 |
| 89 static void cubicOp8d(skiatest::Reporter* reporter) { |
| 90 SkPath path, pathB; |
| 91 path.setFillType(SkPath::kWinding_FillType); |
| 92 path.moveTo(0,1); |
| 93 path.cubicTo(0,5, 1,0, 4,0); |
| 94 path.close(); |
| 95 pathB.setFillType(SkPath::kWinding_FillType); |
| 96 pathB.moveTo(0,1); |
| 97 pathB.cubicTo(0,4, 1,0, 5,0); |
| 98 pathB.close(); |
| 99 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 100 } |
| 101 |
| 102 static void cubicOp9d(skiatest::Reporter* reporter) { |
| 103 SkPath path, pathB; |
| 104 path.setFillType(SkPath::kWinding_FillType); |
| 105 path.moveTo(0,1); |
| 106 path.cubicTo(1,6, 1,0, 2,1); |
| 107 path.close(); |
| 108 pathB.setFillType(SkPath::kWinding_FillType); |
| 109 pathB.moveTo(0,1); |
| 110 pathB.cubicTo(1,2, 1,0, 6,1); |
| 111 pathB.close(); |
| 112 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 113 } |
| 114 |
| 115 static void quadOp9d(skiatest::Reporter* reporter) { |
| 116 SkPath path, pathB; |
| 117 path.setFillType(SkPath::kWinding_FillType); |
| 118 path.moveTo(0,1); |
| 119 path.quadTo(1,6, 1.5f,1); |
| 120 path.quadTo(1.5f,0.5f, 2,1); |
| 121 path.close(); |
| 122 pathB.setFillType(SkPath::kWinding_FillType); |
| 123 pathB.moveTo(0,1); |
| 124 pathB.quadTo(1,2, 1.4f,1); |
| 125 pathB.quadTo(3,0.4f, 6,1); |
| 126 pathB.close(); |
| 127 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 128 } |
| 129 |
| 130 static void lineOp9d(skiatest::Reporter* reporter) { |
| 131 SkPath path, pathB; |
| 132 path.setFillType(SkPath::kWinding_FillType); |
| 133 path.moveTo(0,1); |
| 134 path.lineTo(1,6); |
| 135 path.lineTo(1.5f,1); |
| 136 path.lineTo(1.8f,0.8f); |
| 137 path.lineTo(2,1); |
| 138 path.close(); |
| 139 pathB.setFillType(SkPath::kWinding_FillType); |
| 140 pathB.moveTo(0,1); |
| 141 pathB.lineTo(1,2); |
| 142 pathB.lineTo(1.4f,1); |
| 143 pathB.lineTo(3,0.4f); |
| 144 pathB.lineTo(6,1); |
| 145 pathB.close(); |
| 146 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 147 } |
| 148 |
| 149 static void cubicOp1i(skiatest::Reporter* reporter) { |
| 150 SkPath path, pathB; |
| 151 path.setFillType(SkPath::kWinding_FillType); |
| 152 path.moveTo(0,1); |
| 153 path.cubicTo(1,2, 1,0, 2,1); |
| 154 path.close(); |
| 155 pathB.setFillType(SkPath::kWinding_FillType); |
| 156 pathB.moveTo(0,1); |
| 157 pathB.cubicTo(1,2, 1,0, 2,1); |
| 158 pathB.close(); |
| 159 testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| 160 } |
| 161 |
| 162 static void cubicOp10d(skiatest::Reporter* reporter) { |
| 163 SkPath path, pathB; |
| 164 path.setFillType(SkPath::kWinding_FillType); |
| 165 path.moveTo(0,1); |
| 166 path.cubicTo(1,3, 1,0, 4,1); |
| 167 path.close(); |
| 168 pathB.setFillType(SkPath::kWinding_FillType); |
| 169 pathB.moveTo(0,1); |
| 170 pathB.cubicTo(1,4, 1,0, 3,1); |
| 171 pathB.close(); |
| 172 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 173 } |
| 174 |
| 175 static void cubicOp11d(skiatest::Reporter* reporter) { |
| 176 SkPath path, pathB; |
| 177 path.setFillType(SkPath::kWinding_FillType); |
| 178 path.moveTo(0,1); |
| 179 path.cubicTo(3,4, 1,0, 5,1); |
| 180 path.close(); |
| 181 pathB.setFillType(SkPath::kWinding_FillType); |
| 182 pathB.moveTo(0,1); |
| 183 pathB.cubicTo(1,5, 1,0, 4,3); |
| 184 pathB.close(); |
| 185 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 186 } |
| 187 |
| 188 static void cubicOp12d(skiatest::Reporter* reporter) { |
| 189 SkPath path, pathB; |
| 190 path.setFillType(SkPath::kWinding_FillType); |
| 191 path.moveTo(0,1); |
| 192 path.cubicTo(1,6, 1,0, 1,0); |
| 193 path.close(); |
| 194 pathB.setFillType(SkPath::kWinding_FillType); |
| 195 pathB.moveTo(0,1); |
| 196 pathB.cubicTo(0,1, 1,0, 6,1); |
| 197 pathB.close(); |
| 198 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 199 } |
| 200 |
| 201 static void cubicOp13d(skiatest::Reporter* reporter) { |
| 202 SkPath path, pathB; |
| 203 path.setFillType(SkPath::kWinding_FillType); |
| 204 path.moveTo(0,1); |
| 205 path.cubicTo(4,5, 1,0, 5,3); |
| 206 path.close(); |
| 207 pathB.setFillType(SkPath::kWinding_FillType); |
| 208 pathB.moveTo(0,1); |
| 209 pathB.cubicTo(3,5, 1,0, 5,4); |
| 210 pathB.close(); |
| 211 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 212 } |
| 213 |
| 214 static void cubicOp14d(skiatest::Reporter* reporter) { |
| 215 SkPath path, pathB; |
| 216 path.setFillType(SkPath::kWinding_FillType); |
| 217 path.moveTo(0,1); |
| 218 path.cubicTo(0,2, 2,0, 2,1); |
| 219 path.close(); |
| 220 pathB.setFillType(SkPath::kWinding_FillType); |
| 221 pathB.moveTo(0,2); |
| 222 pathB.cubicTo(1,2, 1,0, 2,0); |
| 223 pathB.close(); |
| 224 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 225 } |
| 226 |
| 227 static void cubicOp15d(skiatest::Reporter* reporter) { |
| 228 SkPath path, pathB; |
| 229 path.setFillType(SkPath::kWinding_FillType); |
| 230 path.moveTo(0,1); |
| 231 path.cubicTo(3,6, 2,0, 2,1); |
| 232 path.close(); |
| 233 pathB.setFillType(SkPath::kWinding_FillType); |
| 234 pathB.moveTo(0,2); |
| 235 pathB.cubicTo(1,2, 1,0, 6,3); |
| 236 pathB.close(); |
| 237 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 238 } |
| 239 |
| 240 static void cubicOp16d(skiatest::Reporter* reporter) { |
| 241 SkPath path, pathB; |
| 242 path.setFillType(SkPath::kWinding_FillType); |
| 243 path.moveTo(0,2); |
| 244 path.cubicTo(0,1, 3,0, 1,0); |
| 245 path.close(); |
| 246 pathB.setFillType(SkPath::kWinding_FillType); |
| 247 pathB.moveTo(0,3); |
| 248 pathB.cubicTo(0,1, 2,0, 1,0); |
| 249 pathB.close(); |
| 250 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 251 } |
| 252 |
| 253 static void cubicOp17d(skiatest::Reporter* reporter) { |
| 254 SkPath path, pathB; |
| 255 path.setFillType(SkPath::kWinding_FillType); |
| 256 path.moveTo(0,2); |
| 257 path.cubicTo(0,2, 4,0, 2,1); |
| 258 path.close(); |
| 259 pathB.setFillType(SkPath::kWinding_FillType); |
| 260 pathB.moveTo(0,4); |
| 261 pathB.cubicTo(1,2, 2,0, 2,0); |
| 262 pathB.close(); |
| 263 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 264 } |
| 265 |
| 266 static void cubicOp18d(skiatest::Reporter* reporter) { |
| 267 SkPath path, pathB; |
| 268 path.setFillType(SkPath::kWinding_FillType); |
| 269 path.moveTo(0,1); |
| 270 path.cubicTo(3,5, 2,0, 2,1); |
| 271 path.close(); |
| 272 pathB.setFillType(SkPath::kWinding_FillType); |
| 273 pathB.moveTo(0,2); |
| 274 pathB.cubicTo(1,2, 1,0, 5,3); |
| 275 pathB.close(); |
| 276 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 277 } |
| 278 |
| 279 static void cubicOp19i(skiatest::Reporter* reporter) { |
| 280 SkPath path, pathB; |
| 281 path.setFillType(SkPath::kWinding_FillType); |
| 282 path.moveTo(0,2); |
| 283 path.cubicTo(0,1, 2,1, 6,2); |
| 284 path.close(); |
| 285 pathB.setFillType(SkPath::kWinding_FillType); |
| 286 pathB.moveTo(1,2); |
| 287 pathB.cubicTo(2,6, 2,0, 1,0); |
| 288 pathB.close(); |
| 289 testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| 290 } |
| 291 |
| 292 static void cubicOp20d(skiatest::Reporter* reporter) { |
| 293 SkPath path, pathB; |
| 294 path.setFillType(SkPath::kWinding_FillType); |
| 295 path.moveTo(0,1); |
| 296 path.cubicTo(0,1, 6,0, 2,1); |
| 297 path.close(); |
| 298 pathB.setFillType(SkPath::kWinding_FillType); |
| 299 pathB.moveTo(0,6); |
| 300 pathB.cubicTo(1,2, 1,0, 1,0); |
| 301 pathB.close(); |
| 302 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 303 } |
| 304 |
| 305 static void cubicOp21d(skiatest::Reporter* reporter) { |
| 306 SkPath path, pathB; |
| 307 path.setFillType(SkPath::kWinding_FillType); |
| 308 path.moveTo(0,1); |
| 309 path.cubicTo(0,1, 2,1, 6,5); |
| 310 path.close(); |
| 311 pathB.setFillType(SkPath::kWinding_FillType); |
| 312 pathB.moveTo(1,2); |
| 313 pathB.cubicTo(5,6, 1,0, 1,0); |
| 314 pathB.close(); |
| 315 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 316 } |
| 317 |
| 318 static void cubicOp22d(skiatest::Reporter* reporter) { |
| 319 SkPath path, pathB; |
| 320 path.setFillType(SkPath::kWinding_FillType); |
| 321 path.moveTo(0,1); |
| 322 path.cubicTo(2,3, 3,0, 2,1); |
| 323 path.close(); |
| 324 pathB.setFillType(SkPath::kWinding_FillType); |
| 325 pathB.moveTo(0,3); |
| 326 pathB.cubicTo(1,2, 1,0, 3,2); |
| 327 pathB.close(); |
| 328 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 329 } |
| 330 |
| 331 static void cubicOp23d(skiatest::Reporter* reporter) { |
| 332 SkPath path, pathB; |
| 333 path.setFillType(SkPath::kWinding_FillType); |
| 334 path.moveTo(0,1); |
| 335 path.cubicTo(1,2, 4,0, 2,1); |
| 336 path.close(); |
| 337 pathB.setFillType(SkPath::kWinding_FillType); |
| 338 pathB.moveTo(0,4); |
| 339 pathB.cubicTo(1,2, 1,0, 2,1); |
| 340 pathB.close(); |
| 341 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 342 } |
| 343 |
| 344 static void cubicOp24d(skiatest::Reporter* reporter) { |
| 345 SkPath path, pathB; |
| 346 path.setFillType(SkPath::kWinding_FillType); |
| 347 path.moveTo(0,1); |
| 348 path.cubicTo(1,2, 2,0, 3,2); |
| 349 path.close(); |
| 350 pathB.setFillType(SkPath::kWinding_FillType); |
| 351 pathB.moveTo(0,2); |
| 352 pathB.cubicTo(2,3, 1,0, 2,1); |
| 353 pathB.close(); |
| 354 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 355 } |
| 356 |
| 357 static void testIntersect1(skiatest::Reporter* reporter) { |
| 358 SkPath one, two; |
| 359 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction); |
| 360 two.addRect(3, 3, 9, 9, SkPath::kCW_Direction); |
| 361 testPathOp(reporter, one, two, kIntersect_PathOp); |
| 362 } |
| 363 |
| 364 static void testUnion1(skiatest::Reporter* reporter) { |
| 365 SkPath one, two; |
| 366 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction); |
| 367 two.addRect(3, 3, 9, 9, SkPath::kCW_Direction); |
| 368 testPathOp(reporter, one, two, kUnion_PathOp); |
| 369 } |
| 370 |
| 371 static void testDiff1(skiatest::Reporter* reporter) { |
| 372 SkPath one, two; |
| 373 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction); |
| 374 two.addRect(3, 3, 9, 9, SkPath::kCW_Direction); |
| 375 testPathOp(reporter, one, two, kDifference_PathOp); |
| 376 } |
| 377 |
| 378 static void testXor1(skiatest::Reporter* reporter) { |
| 379 SkPath one, two; |
| 380 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction); |
| 381 two.addRect(3, 3, 9, 9, SkPath::kCW_Direction); |
| 382 testPathOp(reporter, one, two, kXOR_PathOp); |
| 383 } |
| 384 |
| 385 static void testIntersect2(skiatest::Reporter* reporter) { |
| 386 SkPath one, two; |
| 387 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction); |
| 388 two.addRect(0, 3, 9, 9, SkPath::kCW_Direction); |
| 389 testPathOp(reporter, one, two, kIntersect_PathOp); |
| 390 } |
| 391 |
| 392 static void testUnion2(skiatest::Reporter* reporter) { |
| 393 SkPath one, two; |
| 394 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction); |
| 395 two.addRect(0, 3, 9, 9, SkPath::kCW_Direction); |
| 396 testPathOp(reporter, one, two, kUnion_PathOp); |
| 397 } |
| 398 |
| 399 static void testDiff2(skiatest::Reporter* reporter) { |
| 400 SkPath one, two; |
| 401 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction); |
| 402 two.addRect(0, 3, 9, 9, SkPath::kCW_Direction); |
| 403 testPathOp(reporter, one, two, kDifference_PathOp); |
| 404 } |
| 405 |
| 406 static void testXor2(skiatest::Reporter* reporter) { |
| 407 SkPath one, two; |
| 408 one.addRect(0, 0, 6, 6, SkPath::kCW_Direction); |
| 409 two.addRect(0, 3, 9, 9, SkPath::kCW_Direction); |
| 410 testPathOp(reporter, one, two, kXOR_PathOp); |
| 411 } |
| 412 |
| 413 static void testOp1d(skiatest::Reporter* reporter) { |
| 414 SkPath path, pathB; |
| 415 path.setFillType(SkPath::kWinding_FillType); |
| 416 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 417 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction); |
| 418 pathB.setFillType(SkPath::kWinding_FillType); |
| 419 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 420 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 421 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 422 } |
| 423 |
| 424 static void testOp2d(skiatest::Reporter* reporter) { |
| 425 SkPath path, pathB; |
| 426 path.setFillType(SkPath::kWinding_FillType); |
| 427 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 428 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction); |
| 429 pathB.setFillType(SkPath::kEvenOdd_FillType); |
| 430 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 431 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 432 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 433 } |
| 434 |
| 435 static void testOp3d(skiatest::Reporter* reporter) { |
| 436 SkPath path, pathB; |
| 437 path.setFillType(SkPath::kWinding_FillType); |
| 438 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 439 path.addRect(1, 1, 2, 2, SkPath::kCW_Direction); |
| 440 pathB.setFillType(SkPath::kWinding_FillType); |
| 441 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 442 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 443 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 444 } |
| 445 |
| 446 static void testOp1u(skiatest::Reporter* reporter) { |
| 447 SkPath path, pathB; |
| 448 path.setFillType(SkPath::kWinding_FillType); |
| 449 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 450 path.addRect(0, 0, 3, 3, SkPath::kCW_Direction); |
| 451 pathB.setFillType(SkPath::kWinding_FillType); |
| 452 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 453 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 454 testPathOp(reporter, path, pathB, kUnion_PathOp); |
| 455 } |
| 456 |
| 457 static void testOp4d(skiatest::Reporter* reporter) { |
| 458 SkPath path, pathB; |
| 459 path.setFillType(SkPath::kWinding_FillType); |
| 460 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 461 path.addRect(2, 2, 4, 4, SkPath::kCW_Direction); |
| 462 pathB.setFillType(SkPath::kWinding_FillType); |
| 463 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 464 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 465 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 466 } |
| 467 |
| 468 static void testOp5d(skiatest::Reporter* reporter) { |
| 469 SkPath path, pathB; |
| 470 path.setFillType(SkPath::kEvenOdd_FillType); |
| 471 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction); |
| 472 path.addRect(0, 0, 3, 3, SkPath::kCW_Direction); |
| 473 pathB.setFillType(SkPath::kEvenOdd_FillType); |
| 474 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 475 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 476 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 477 } |
| 478 |
| 479 static void testOp6d(skiatest::Reporter* reporter) { |
| 480 SkPath path, pathB; |
| 481 path.setFillType(SkPath::kEvenOdd_FillType); |
| 482 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 483 path.addRect(0, 0, 3, 3, SkPath::kCW_Direction); |
| 484 pathB.setFillType(SkPath::kWinding_FillType); |
| 485 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 486 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 487 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 488 } |
| 489 |
| 490 static void testOp7d(skiatest::Reporter* reporter) { |
| 491 SkPath path, pathB; |
| 492 path.setFillType(SkPath::kEvenOdd_FillType); |
| 493 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction); |
| 494 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 495 pathB.setFillType(SkPath::kEvenOdd_FillType); |
| 496 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 497 pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| 498 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 499 } |
| 500 |
| 501 static void testOp2u(skiatest::Reporter* reporter) { |
| 502 SkPath path, pathB; |
| 503 path.setFillType(SkPath::kEvenOdd_FillType); |
| 504 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction); |
| 505 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction); |
| 506 pathB.setFillType(SkPath::kWinding_FillType); |
| 507 pathB.addRect(0, 0, 3, 3, SkPath::kCW_Direction); |
| 508 pathB.addRect(1, 1, 2, 2, SkPath::kCW_Direction); |
| 509 testPathOp(reporter, path, pathB, kUnion_PathOp); |
| 510 } |
| 511 |
| 512 static void testOp8d(skiatest::Reporter* reporter) { |
| 513 SkPath path, pathB; |
| 514 path.addRect(0, 0, 640, 480); |
| 515 pathB.moveTo(577330, 1971.72f); |
| 516 pathB.cubicTo(10.7082f, -116.596f, 262.057f, 45.6468f, 294.694f, 1.96237f); |
| 517 pathB.close(); |
| 518 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 519 } |
| 520 static void cubicOp25i(skiatest::Reporter* reporter) { |
| 521 SkPath path, pathB; |
| 522 path.setFillType(SkPath::kWinding_FillType); |
| 523 path.moveTo(0,1); |
| 524 path.cubicTo(2,4, 5,0, 3,2); |
| 525 path.close(); |
| 526 pathB.setFillType(SkPath::kWinding_FillType); |
| 527 pathB.moveTo(0,5); |
| 528 pathB.cubicTo(2,3, 1,0, 4,2); |
| 529 pathB.close(); |
| 530 testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| 531 } |
| 532 |
| 533 static void cubicOp26d(skiatest::Reporter* reporter) { |
| 534 SkPath path, pathB; |
| 535 path.setFillType(SkPath::kWinding_FillType); |
| 536 path.moveTo(0,1); |
| 537 path.cubicTo(3,4, 4,0, 3,2); |
| 538 path.close(); |
| 539 pathB.setFillType(SkPath::kWinding_FillType); |
| 540 pathB.moveTo(0,4); |
| 541 pathB.cubicTo(2,3, 1,0, 4,3); |
| 542 pathB.close(); |
| 543 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 544 } |
| 545 |
| 546 static void cubicOp27d(skiatest::Reporter* reporter) { |
| 547 SkPath path, pathB; |
| 548 path.setFillType(SkPath::kWinding_FillType); |
| 549 path.moveTo(0,1); |
| 550 path.cubicTo(3,6, 1,0, 5,2); |
| 551 path.close(); |
| 552 pathB.setFillType(SkPath::kWinding_FillType); |
| 553 pathB.moveTo(0,1); |
| 554 pathB.cubicTo(2,5, 1,0, 6,3); |
| 555 pathB.close(); |
| 556 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 557 } |
| 558 |
| 559 static void cubicOp28u(skiatest::Reporter* reporter) { |
| 560 SkPath path, pathB; |
| 561 path.setFillType(SkPath::kWinding_FillType); |
| 562 path.moveTo(0,1); |
| 563 path.cubicTo(1,4, 6,0, 3,2); |
| 564 path.close(); |
| 565 pathB.setFillType(SkPath::kWinding_FillType); |
| 566 pathB.moveTo(0,6); |
| 567 pathB.cubicTo(2,3, 1,0, 4,1); |
| 568 pathB.close(); |
| 569 testPathOp(reporter, path, pathB, kUnion_PathOp); |
| 570 } |
| 571 |
| 572 static void cubicOp29d(skiatest::Reporter* reporter) { |
| 573 SkPath path, pathB; |
| 574 path.setFillType(SkPath::kWinding_FillType); |
| 575 path.moveTo(0,1); |
| 576 path.cubicTo(2,5, 6,0, 4,2); |
| 577 path.close(); |
| 578 pathB.setFillType(SkPath::kWinding_FillType); |
| 579 pathB.moveTo(0,6); |
| 580 pathB.cubicTo(2,4, 1,0, 5,2); |
| 581 pathB.close(); |
| 582 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 583 } |
| 584 |
| 585 static void cubicOp30d(skiatest::Reporter* reporter) { |
| 586 SkPath path, pathB; |
| 587 path.setFillType(SkPath::kWinding_FillType); |
| 588 path.moveTo(0,1); |
| 589 path.cubicTo(2,5, 6,0, 5,3); |
| 590 path.close(); |
| 591 pathB.setFillType(SkPath::kWinding_FillType); |
| 592 pathB.moveTo(0,6); |
| 593 pathB.cubicTo(3,5, 1,0, 5,2); |
| 594 pathB.close(); |
| 595 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 596 } |
| 597 |
| 598 static void cubicOp31d(skiatest::Reporter* reporter) { |
| 599 SkPath path, pathB; |
| 600 path.setFillType(SkPath::kWinding_FillType); |
| 601 path.moveTo(0,2); |
| 602 path.cubicTo(0,3, 2,1, 4,0); |
| 603 path.close(); |
| 604 pathB.setFillType(SkPath::kWinding_FillType); |
| 605 pathB.moveTo(1,2); |
| 606 pathB.cubicTo(0,4, 2,0, 3,0); |
| 607 pathB.close(); |
| 608 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 609 } |
| 610 |
| 611 static void cubicOp31u(skiatest::Reporter* reporter) { |
| 612 SkPath path, pathB; |
| 613 path.setFillType(SkPath::kWinding_FillType); |
| 614 path.moveTo(0,2); |
| 615 path.cubicTo(0,3, 2,1, 4,0); |
| 616 path.close(); |
| 617 pathB.setFillType(SkPath::kWinding_FillType); |
| 618 pathB.moveTo(1,2); |
| 619 pathB.cubicTo(0,4, 2,0, 3,0); |
| 620 pathB.close(); |
| 621 testPathOp(reporter, path, pathB, kUnion_PathOp); |
| 622 } |
| 623 |
| 624 static void cubicOp31x(skiatest::Reporter* reporter) { |
| 625 SkPath path, pathB; |
| 626 path.setFillType(SkPath::kWinding_FillType); |
| 627 path.moveTo(0,2); |
| 628 path.cubicTo(0,3, 2,1, 4,0); |
| 629 path.close(); |
| 630 pathB.setFillType(SkPath::kWinding_FillType); |
| 631 pathB.moveTo(1,2); |
| 632 pathB.cubicTo(0,4, 2,0, 3,0); |
| 633 pathB.close(); |
| 634 testPathOp(reporter, path, pathB, kXOR_PathOp); |
| 635 } |
| 636 |
| 637 static void cubicOp32d(skiatest::Reporter* reporter) { |
| 638 SkPath path, pathB; |
| 639 path.setFillType(SkPath::kWinding_FillType); |
| 640 path.moveTo(0,1); |
| 641 path.cubicTo(1,2, 6,0, 3,1); |
| 642 path.close(); |
| 643 pathB.setFillType(SkPath::kWinding_FillType); |
| 644 pathB.moveTo(0,6); |
| 645 pathB.cubicTo(1,3, 1,0, 2,1); |
| 646 pathB.close(); |
| 647 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 648 } |
| 649 |
| 650 static void cubicOp33i(skiatest::Reporter* reporter) { |
| 651 SkPath path, pathB; |
| 652 path.setFillType(SkPath::kWinding_FillType); |
| 653 path.moveTo(0,1); |
| 654 path.cubicTo(1,2, 6,0, 3,1); |
| 655 path.close(); |
| 656 pathB.setFillType(SkPath::kWinding_FillType); |
| 657 pathB.moveTo(0,6); |
| 658 pathB.cubicTo(1,3, 1,0, 2,1); |
| 659 pathB.close(); |
| 660 testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| 661 } |
| 662 |
| 663 static void cubicOp34d(skiatest::Reporter* reporter) { |
| 664 SkPath path, pathB; |
| 665 path.setFillType(SkPath::kWinding_FillType); |
| 666 path.moveTo(0,1); |
| 667 path.cubicTo(3,5, 2,1, 3,1); |
| 668 path.close(); |
| 669 pathB.setFillType(SkPath::kWinding_FillType); |
| 670 pathB.moveTo(1,2); |
| 671 pathB.cubicTo(1,3, 1,0, 5,3); |
| 672 pathB.close(); |
| 673 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 674 } |
| 675 |
| 676 static void cubicOp35d(skiatest::Reporter* reporter) { |
| 677 SkPath path, pathB; |
| 678 path.setFillType(SkPath::kWinding_FillType); |
| 679 path.moveTo(0,1); |
| 680 path.cubicTo(1,5, 2,1, 4,0); |
| 681 path.close(); |
| 682 pathB.setFillType(SkPath::kWinding_FillType); |
| 683 pathB.moveTo(1,2); |
| 684 pathB.cubicTo(0,4, 1,0, 5,1); |
| 685 pathB.close(); |
| 686 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 687 } |
| 688 |
| 689 static void cubicOp36u(skiatest::Reporter* reporter) { |
| 690 SkPath path, pathB; |
| 691 path.setFillType(SkPath::kWinding_FillType); |
| 692 path.moveTo(0,1); |
| 693 path.cubicTo(1,6, 2,0, 5,1); |
| 694 path.close(); |
| 695 pathB.setFillType(SkPath::kWinding_FillType); |
| 696 pathB.moveTo(0,2); |
| 697 pathB.cubicTo(1,5, 1,0, 6,1); |
| 698 pathB.close(); |
| 699 testPathOp(reporter, path, pathB, kUnion_PathOp); |
| 700 } |
| 701 |
| 702 static void cubicOp37d(skiatest::Reporter* reporter) { |
| 703 SkPath path, pathB; |
| 704 path.setFillType(SkPath::kWinding_FillType); |
| 705 path.moveTo(0,1); |
| 706 path.cubicTo(2,6, 6,1, 4,3); |
| 707 path.close(); |
| 708 pathB.setFillType(SkPath::kWinding_FillType); |
| 709 pathB.moveTo(1,6); |
| 710 pathB.cubicTo(3,4, 1,0, 6,2); |
| 711 pathB.close(); |
| 712 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 713 } |
| 714 |
| 715 #if 1 |
| 716 // this fails to detect a cubic/cubic intersection |
| 717 // the slight overlap is missed when the cubics are approximated by quadratics |
| 718 // and the subsequent line/cubic intersection also (correctly) misses the inters
ection |
| 719 // if the line/cubic was a matching line/approx.quadratic then the missing inter
section |
| 720 // could have been detected |
| 721 static void cubicOp38d(skiatest::Reporter* reporter) { |
| 722 SkPath path, pathB; |
| 723 path.setFillType(SkPath::kWinding_FillType); |
| 724 path.moveTo(0,1); |
| 725 path.cubicTo(0,6, 3,2, 4,1); |
| 726 path.close(); |
| 727 pathB.setFillType(SkPath::kWinding_FillType); |
| 728 pathB.moveTo(2,3); |
| 729 pathB.cubicTo(1,4, 1,0, 6,0); |
| 730 pathB.close(); |
| 731 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 732 } |
| 733 #endif |
| 734 |
| 735 static void cubicOp39d(skiatest::Reporter* reporter) { |
| 736 SkPath path, pathB; |
| 737 path.setFillType(SkPath::kWinding_FillType); |
| 738 path.moveTo(0,1); |
| 739 path.cubicTo(2,3, 5,1, 4,3); |
| 740 path.close(); |
| 741 pathB.setFillType(SkPath::kWinding_FillType); |
| 742 pathB.moveTo(1,5); |
| 743 pathB.cubicTo(3,4, 1,0, 3,2); |
| 744 pathB.close(); |
| 745 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 746 } |
| 747 |
| 748 static void cubicOp40d(skiatest::Reporter* reporter) { |
| 749 SkPath path, pathB; |
| 750 path.setFillType(SkPath::kWinding_FillType); |
| 751 path.moveTo(0,1); |
| 752 path.cubicTo(1,5, 3,2, 4,2); |
| 753 path.close(); |
| 754 pathB.setFillType(SkPath::kWinding_FillType); |
| 755 pathB.moveTo(2,3); |
| 756 pathB.cubicTo(2,4, 1,0, 5,1); |
| 757 pathB.close(); |
| 758 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 759 } |
| 760 |
| 761 static void cubicOp41i(skiatest::Reporter* reporter) { |
| 762 SkPath path, pathB; |
| 763 path.setFillType(SkPath::kWinding_FillType); |
| 764 path.moveTo(0,1); |
| 765 path.cubicTo(2,6, 4,3, 6,4); |
| 766 path.close(); |
| 767 pathB.setFillType(SkPath::kWinding_FillType); |
| 768 pathB.moveTo(3,4); |
| 769 pathB.cubicTo(4,6, 1,0, 6,2); |
| 770 pathB.close(); |
| 771 testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| 772 } |
| 773 |
| 774 static void cubicOp42d(skiatest::Reporter* reporter) { |
| 775 SkPath path, pathB; |
| 776 path.setFillType(SkPath::kWinding_FillType); |
| 777 path.moveTo(0,1); |
| 778 path.cubicTo(1,2, 6,5, 5,4); |
| 779 path.close(); |
| 780 pathB.setFillType(SkPath::kWinding_FillType); |
| 781 pathB.moveTo(5,6); |
| 782 pathB.cubicTo(4,5, 1,0, 2,1); |
| 783 pathB.close(); |
| 784 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 785 } |
| 786 |
| 787 static void cubicOp43d(skiatest::Reporter* reporter) { |
| 788 SkPath path, pathB; |
| 789 path.setFillType(SkPath::kWinding_FillType); |
| 790 path.moveTo(0,2); |
| 791 path.cubicTo(1,2, 4,0, 3,1); |
| 792 path.close(); |
| 793 pathB.setFillType(SkPath::kWinding_FillType); |
| 794 pathB.moveTo(0,4); |
| 795 pathB.cubicTo(1,3, 2,0, 2,1); |
| 796 pathB.close(); |
| 797 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 798 } |
| 799 |
| 800 static void cubicOp44d(skiatest::Reporter* reporter) { |
| 801 SkPath path, pathB; |
| 802 path.setFillType(SkPath::kWinding_FillType); |
| 803 path.moveTo(0,2); |
| 804 path.cubicTo(3,6, 4,0, 3,2); |
| 805 path.close(); |
| 806 pathB.setFillType(SkPath::kWinding_FillType); |
| 807 pathB.moveTo(0,4); |
| 808 pathB.cubicTo(2,3, 2,0, 6,3); |
| 809 pathB.close(); |
| 810 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 811 } |
| 812 |
| 813 static void cubicOp45d(skiatest::Reporter* reporter) { |
| 814 SkPath path, pathB; |
| 815 path.setFillType(SkPath::kWinding_FillType); |
| 816 path.moveTo(0,2); |
| 817 path.cubicTo(2,4, 4,0, 3,2); |
| 818 path.close(); |
| 819 pathB.setFillType(SkPath::kWinding_FillType); |
| 820 pathB.moveTo(0,4); |
| 821 pathB.cubicTo(2,3, 2,0, 4,2); |
| 822 pathB.close(); |
| 823 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 824 } |
| 825 |
| 826 static void cubicOp46d(skiatest::Reporter* reporter) { |
| 827 SkPath path, pathB; |
| 828 path.setFillType(SkPath::kWinding_FillType); |
| 829 path.moveTo(0,2); |
| 830 path.cubicTo(3,5, 5,0, 4,2); |
| 831 path.close(); |
| 832 pathB.setFillType(SkPath::kWinding_FillType); |
| 833 pathB.moveTo(0,5); |
| 834 pathB.cubicTo(2,4, 2,0, 5,3); |
| 835 pathB.close(); |
| 836 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 837 } |
| 838 |
| 839 static void cubicOp47d(skiatest::Reporter* reporter) { |
| 840 SkPath path, pathB; |
| 841 path.setFillType(SkPath::kWinding_FillType); |
| 842 path.moveTo(0,1); |
| 843 path.cubicTo(1,6, 6,2, 5,4); |
| 844 path.close(); |
| 845 pathB.setFillType(SkPath::kWinding_FillType); |
| 846 pathB.moveTo(2,6); |
| 847 pathB.cubicTo(4,5, 1,0, 6,1); |
| 848 pathB.close(); |
| 849 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 850 } |
| 851 |
| 852 static void cubicOp48d(skiatest::Reporter* reporter) { |
| 853 SkPath path, pathB; |
| 854 path.setFillType(SkPath::kWinding_FillType); |
| 855 path.moveTo(0,2); |
| 856 path.cubicTo(2,3, 5,1, 3,2); |
| 857 path.close(); |
| 858 pathB.setFillType(SkPath::kWinding_FillType); |
| 859 pathB.moveTo(1,5); |
| 860 pathB.cubicTo(2,3, 2,0, 3,2); |
| 861 pathB.close(); |
| 862 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 863 } |
| 864 |
| 865 static void cubicOp49d(skiatest::Reporter* reporter) { |
| 866 SkPath path, pathB; |
| 867 path.setFillType(SkPath::kWinding_FillType); |
| 868 path.moveTo(0,2); |
| 869 path.cubicTo(1,5, 3,2, 4,1); |
| 870 path.close(); |
| 871 pathB.setFillType(SkPath::kWinding_FillType); |
| 872 pathB.moveTo(2,3); |
| 873 pathB.cubicTo(1,4, 2,0, 5,1); |
| 874 pathB.close(); |
| 875 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 876 } |
| 877 |
| 878 static void cubicOp50d(skiatest::Reporter* reporter) { |
| 879 SkPath path, pathB; |
| 880 path.setFillType(SkPath::kWinding_FillType); |
| 881 path.moveTo(0,3); |
| 882 path.cubicTo(1,6, 5,0, 5,1); |
| 883 path.close(); |
| 884 pathB.setFillType(SkPath::kWinding_FillType); |
| 885 pathB.moveTo(0,5); |
| 886 pathB.cubicTo(1,5, 3,0, 6,1); |
| 887 pathB.close(); |
| 888 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 889 } |
| 890 |
| 891 static void cubicOp51d(skiatest::Reporter* reporter) { |
| 892 SkPath path, pathB; |
| 893 path.setFillType(SkPath::kWinding_FillType); |
| 894 path.moveTo(0,3); |
| 895 path.cubicTo(1,2, 4,1, 6,0); |
| 896 path.close(); |
| 897 pathB.setFillType(SkPath::kWinding_FillType); |
| 898 pathB.moveTo(1,4); |
| 899 pathB.cubicTo(0,6, 3,0, 2,1); |
| 900 pathB.close(); |
| 901 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 902 } |
| 903 |
| 904 static void cubicOp52d(skiatest::Reporter* reporter) { |
| 905 SkPath path, pathB; |
| 906 path.setFillType(SkPath::kWinding_FillType); |
| 907 path.moveTo(0,2); |
| 908 path.cubicTo(1,2, 5,4, 4,3); |
| 909 path.close(); |
| 910 pathB.setFillType(SkPath::kWinding_FillType); |
| 911 pathB.moveTo(4,5); |
| 912 pathB.cubicTo(3,4, 2,0, 2,1); |
| 913 pathB.close(); |
| 914 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 915 } |
| 916 |
| 917 static void cubicOp53d(skiatest::Reporter* reporter) { |
| 918 SkPath path, pathB; |
| 919 path.setFillType(SkPath::kWinding_FillType); |
| 920 path.moveTo(0,3); |
| 921 path.cubicTo(1,2, 5,3, 2,1); |
| 922 path.close(); |
| 923 pathB.setFillType(SkPath::kWinding_FillType); |
| 924 pathB.moveTo(3,5); |
| 925 pathB.cubicTo(1,2, 3,0, 2,1); |
| 926 pathB.close(); |
| 927 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 928 } |
| 929 |
| 930 static void cubicOp54d(skiatest::Reporter* reporter) { |
| 931 SkPath path, pathB; |
| 932 path.setFillType(SkPath::kWinding_FillType); |
| 933 path.moveTo(0,4); |
| 934 path.cubicTo(1,3, 5,4, 4,2); |
| 935 path.close(); |
| 936 pathB.setFillType(SkPath::kWinding_FillType); |
| 937 pathB.moveTo(4,5); |
| 938 pathB.cubicTo(2,4, 4,0, 3,1); |
| 939 pathB.close(); |
| 940 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 941 } |
| 942 |
| 943 static void cubicOp55d(skiatest::Reporter* reporter) { |
| 944 SkPath path, pathB; |
| 945 path.setFillType(SkPath::kWinding_FillType); |
| 946 path.moveTo(0,5); |
| 947 path.cubicTo(1,3, 3,2, 5,0); |
| 948 path.close(); |
| 949 pathB.setFillType(SkPath::kWinding_FillType); |
| 950 pathB.moveTo(2,3); |
| 951 pathB.cubicTo(0,5, 5,0, 3,1); |
| 952 pathB.close(); |
| 953 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 954 } |
| 955 |
| 956 static void cubicOp56d(skiatest::Reporter* reporter) { |
| 957 SkPath path, pathB; |
| 958 path.setFillType(SkPath::kWinding_FillType); |
| 959 path.moveTo(0,1); |
| 960 path.cubicTo(2,6, 5,0, 2,1); |
| 961 path.close(); |
| 962 pathB.setFillType(SkPath::kWinding_FillType); |
| 963 pathB.moveTo(0,5); |
| 964 pathB.cubicTo(1,2, 1,0, 6,2); |
| 965 pathB.close(); |
| 966 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 967 } |
| 968 |
| 969 static void cubicOp57d(skiatest::Reporter* reporter) { |
| 970 SkPath path, pathB; |
| 971 path.setFillType(SkPath::kWinding_FillType); |
| 972 path.moveTo(0,5); |
| 973 path.cubicTo(0,5, 5,4, 6,4); |
| 974 path.close(); |
| 975 pathB.setFillType(SkPath::kWinding_FillType); |
| 976 pathB.moveTo(4,5); |
| 977 pathB.cubicTo(4,6, 5,0, 5,0); |
| 978 pathB.close(); |
| 979 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 980 } |
| 981 |
| 982 static void cubicOp58d(skiatest::Reporter* reporter) { |
| 983 SkPath path, pathB; |
| 984 path.setFillType(SkPath::kWinding_FillType); |
| 985 path.moveTo(0,5); |
| 986 path.cubicTo(3,4, 6,5, 5,3); |
| 987 path.close(); |
| 988 pathB.setFillType(SkPath::kWinding_FillType); |
| 989 pathB.moveTo(5,6); |
| 990 pathB.cubicTo(3,5, 5,0, 4,3); |
| 991 pathB.close(); |
| 992 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 993 } |
| 994 |
| 995 static void cubicOp59d(skiatest::Reporter* reporter) { |
| 996 SkPath path, pathB; |
| 997 path.setFillType(SkPath::kWinding_FillType); |
| 998 path.moveTo(0,1); |
| 999 path.cubicTo(5,6, 4,0, 4,1); |
| 1000 path.close(); |
| 1001 pathB.setFillType(SkPath::kWinding_FillType); |
| 1002 pathB.moveTo(0,4); |
| 1003 pathB.cubicTo(1,4, 1,0, 6,5); |
| 1004 pathB.close(); |
| 1005 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 1006 } |
| 1007 |
| 1008 static void cubicOp60d(skiatest::Reporter* reporter) { |
| 1009 SkPath path, pathB; |
| 1010 path.setFillType(SkPath::kWinding_FillType); |
| 1011 path.moveTo(0,2); |
| 1012 path.cubicTo(4,6, 6,0, 5,2); |
| 1013 path.close(); |
| 1014 pathB.setFillType(SkPath::kWinding_FillType); |
| 1015 pathB.moveTo(0,6); |
| 1016 pathB.cubicTo(2,5, 2,0, 6,4); |
| 1017 pathB.close(); |
| 1018 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 1019 } |
| 1020 |
| 1021 static void cubicOp61d(skiatest::Reporter* reporter) { |
| 1022 SkPath path, pathB; |
| 1023 path.setFillType(SkPath::kWinding_FillType); |
| 1024 path.moveTo(1,2); |
| 1025 path.cubicTo(0,5, 3,2, 6,1); |
| 1026 path.close(); |
| 1027 pathB.setFillType(SkPath::kWinding_FillType); |
| 1028 pathB.moveTo(2,3); |
| 1029 pathB.cubicTo(1,6, 2,1, 5,0); |
| 1030 pathB.close(); |
| 1031 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 1032 } |
| 1033 |
| 1034 static void cubicOp62d(skiatest::Reporter* reporter) { |
| 1035 SkPath path, pathB; |
| 1036 path.setFillType(SkPath::kWinding_FillType); |
| 1037 path.moveTo(1,3); |
| 1038 path.cubicTo(5,6, 5,3, 5,4); |
| 1039 path.close(); |
| 1040 pathB.setFillType(SkPath::kWinding_FillType); |
| 1041 pathB.moveTo(3,5); |
| 1042 pathB.cubicTo(4,5, 3,1, 6,5); |
| 1043 pathB.close(); |
| 1044 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 1045 } |
| 1046 |
| 1047 static void cubicOp63d(skiatest::Reporter* reporter) { |
| 1048 SkPath path, pathB; |
| 1049 path.setFillType(SkPath::kWinding_FillType); |
| 1050 path.moveTo(2,3); |
| 1051 path.cubicTo(0,4, 3,2, 5,3); |
| 1052 path.close(); |
| 1053 pathB.setFillType(SkPath::kWinding_FillType); |
| 1054 pathB.moveTo(2,3); |
| 1055 pathB.cubicTo(3,5, 3,2, 4,0); |
| 1056 pathB.close(); |
| 1057 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 1058 } |
| 1059 |
| 1060 static void cubicOp64d(skiatest::Reporter* reporter) { |
| 1061 SkPath path, pathB; |
| 1062 path.moveTo(0,1); |
| 1063 path.cubicTo(0,1, 1,0, 3,0); |
| 1064 path.lineTo(0,1); |
| 1065 path.close(); |
| 1066 pathB.moveTo(0,1); |
| 1067 pathB.cubicTo(0,3, 1,0, 1,0); |
| 1068 pathB.lineTo(0,1); |
| 1069 pathB.close(); |
| 1070 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 1071 } |
| 1072 |
| 1073 static void cubicOp65d(skiatest::Reporter* reporter) { |
| 1074 SkPath path, pathB; |
| 1075 path.moveTo(0,1); |
| 1076 path.cubicTo(1,5, 1,0, 1,0); |
| 1077 path.lineTo(0,1); |
| 1078 path.close(); |
| 1079 pathB.moveTo(0,1); |
| 1080 pathB.cubicTo(0,1, 1,0, 5,1); |
| 1081 pathB.lineTo(0,1); |
| 1082 pathB.close(); |
| 1083 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 1084 } |
| 1085 |
| 1086 static void (*firstTest)(skiatest::Reporter* ) = 0; |
| 1087 |
| 1088 static struct TestDesc tests[] = { |
| 1089 TEST(cubicOp65d), |
| 1090 TEST(cubicOp64d), |
| 1091 TEST(cubicOp63d), |
| 1092 TEST(cubicOp62d), |
| 1093 TEST(cubicOp61d), |
| 1094 TEST(cubicOp60d), |
| 1095 TEST(cubicOp59d), |
| 1096 TEST(cubicOp58d), |
| 1097 TEST(cubicOp57d), |
| 1098 TEST(cubicOp56d), |
| 1099 TEST(cubicOp55d), |
| 1100 TEST(cubicOp54d), |
| 1101 TEST(cubicOp53d), |
| 1102 TEST(cubicOp52d), |
| 1103 TEST(cubicOp51d), |
| 1104 TEST(cubicOp50d), |
| 1105 TEST(cubicOp49d), |
| 1106 TEST(cubicOp48d), |
| 1107 TEST(cubicOp47d), |
| 1108 TEST(cubicOp46d), |
| 1109 TEST(cubicOp45d), |
| 1110 TEST(cubicOp44d), |
| 1111 TEST(cubicOp43d), |
| 1112 TEST(cubicOp42d), |
| 1113 TEST(cubicOp41i), |
| 1114 TEST(cubicOp40d), |
| 1115 TEST(cubicOp39d), |
| 1116 TEST(cubicOp38d), |
| 1117 TEST(cubicOp37d), |
| 1118 TEST(cubicOp36u), |
| 1119 TEST(cubicOp35d), |
| 1120 TEST(cubicOp34d), |
| 1121 TEST(cubicOp33i), |
| 1122 TEST(cubicOp32d), |
| 1123 TEST(cubicOp31d), |
| 1124 TEST(cubicOp31x), |
| 1125 TEST(cubicOp31u), |
| 1126 TEST(cubicOp30d), |
| 1127 TEST(cubicOp29d), |
| 1128 TEST(cubicOp28u), |
| 1129 TEST(cubicOp27d), |
| 1130 TEST(cubicOp26d), |
| 1131 TEST(cubicOp25i), |
| 1132 TEST(testOp8d), |
| 1133 TEST(testDiff1), |
| 1134 TEST(testIntersect1), |
| 1135 TEST(testUnion1), |
| 1136 TEST(testXor1), |
| 1137 TEST(testDiff2), |
| 1138 TEST(testIntersect2), |
| 1139 TEST(testUnion2), |
| 1140 TEST(testXor2), |
| 1141 TEST(testOp1d), |
| 1142 TEST(testOp2d), |
| 1143 TEST(testOp3d), |
| 1144 TEST(testOp1u), |
| 1145 TEST(testOp4d), |
| 1146 TEST(testOp5d), |
| 1147 TEST(testOp6d), |
| 1148 TEST(testOp7d), |
| 1149 TEST(testOp2u), |
| 1150 |
| 1151 TEST(cubicOp24d), |
| 1152 TEST(cubicOp23d), |
| 1153 TEST(cubicOp22d), |
| 1154 TEST(cubicOp21d), |
| 1155 TEST(cubicOp20d), |
| 1156 TEST(cubicOp19i), |
| 1157 TEST(cubicOp18d), |
| 1158 TEST(cubicOp17d), |
| 1159 TEST(cubicOp16d), |
| 1160 TEST(cubicOp15d), |
| 1161 TEST(cubicOp14d), |
| 1162 TEST(cubicOp13d), |
| 1163 TEST(cubicOp12d), |
| 1164 TEST(cubicOp11d), |
| 1165 TEST(cubicOp10d), |
| 1166 TEST(cubicOp1i), |
| 1167 TEST(cubicOp9d), |
| 1168 TEST(quadOp9d), |
| 1169 TEST(lineOp9d), |
| 1170 TEST(cubicOp8d), |
| 1171 TEST(cubicOp7d), |
| 1172 TEST(cubicOp6d), |
| 1173 TEST(cubicOp5d), |
| 1174 TEST(cubicOp3d), |
| 1175 TEST(cubicOp2d), |
| 1176 TEST(cubicOp1d), |
| 1177 }; |
| 1178 |
| 1179 static const size_t testCount = sizeof(tests) / sizeof(tests[0]); |
| 1180 |
| 1181 static struct TestDesc subTests[] = { |
| 1182 TEST(cubicOp43d), |
| 1183 TEST(quadOp9d), |
| 1184 TEST(cubicOp9d), |
| 1185 TEST(cubicOp1i), |
| 1186 TEST(cubicOp10d), |
| 1187 TEST(cubicOp11d), |
| 1188 TEST(cubicOp15d), |
| 1189 TEST(cubicOp18d), |
| 1190 TEST(cubicOp22d), |
| 1191 TEST(cubicOp23d), |
| 1192 TEST(cubicOp24d), |
| 1193 TEST(cubicOp28u), |
| 1194 TEST(cubicOp33i), |
| 1195 TEST(cubicOp36u), |
| 1196 TEST(cubicOp40d), |
| 1197 }; |
| 1198 |
| 1199 static const size_t subTestCount = sizeof(subTests) / sizeof(subTests[0]); |
| 1200 |
| 1201 static void (*firstSubTest)(skiatest::Reporter* ) = 0; |
| 1202 |
| 1203 static bool runSubTestsFirst = false; |
| 1204 static bool runReverse = false; |
| 1205 static void (*stopTest)(skiatest::Reporter* ) = 0; |
| 1206 |
| 1207 static void OpTest(skiatest::Reporter* reporter) { |
| 1208 #ifdef SK_DEBUG |
| 1209 gDebugMaxWindSum = 4; |
| 1210 gDebugMaxWindValue = 4; |
| 1211 #endif |
| 1212 if (runSubTestsFirst) { |
| 1213 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run
Reverse); |
| 1214 } |
| 1215 RunTestSet(reporter, tests, testCount, firstTest, stopTest, runReverse); |
| 1216 if (!runSubTestsFirst) { |
| 1217 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run
Reverse); |
| 1218 } |
| 1219 #ifdef SK_DEBUG |
| 1220 gDebugMaxWindSum = SK_MaxS32; |
| 1221 gDebugMaxWindValue = SK_MaxS32; |
| 1222 #endif |
| 1223 } |
| 1224 |
| 1225 #include "TestClassDef.h" |
| 1226 DEFINE_TESTCLASS("PathOpsOpTest", PathOpsOpClass, OpTest) |
OLD | NEW |