| /* |
| * Copyright 2012 Google Inc. |
| * |
| * Use of this source code is governed by a BSD-style license that can be |
| * found in the LICENSE file. |
| */ |
| #include "PathOpsExtendedTest.h" |
| |
| #define TEST(name) { name, #name } |
| |
| static void cubicOp1d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(0,2, 1,0, 1,0); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,1, 1,0, 2,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp2d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,2); |
| path.cubicTo(0,1, 1,0, 1,0); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,1, 2,0, 1,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp3d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(2,3, 1,0, 1,0); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,1, 1,0, 3,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp5d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(0,2, 1,0, 2,0); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,2, 1,0, 2,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp6d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(0,6, 1,0, 3,0); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,3, 1,0, 6,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp7d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(3,4, 1,0, 3,0); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,3, 1,0, 4,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp8d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(0,5, 1,0, 4,0); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,4, 1,0, 5,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp9d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(1,6, 1,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(1,2, 1,0, 6,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void quadOp9d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.quadTo(1,6, 1.5f,1); |
| path.quadTo(1.5f,0.5f, 2,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,1); |
| pathB.quadTo(1,2, 1.4f,1); |
| pathB.quadTo(3,0.4f, 6,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void lineOp9d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.lineTo(1,6); |
| path.lineTo(1.5f,1); |
| path.lineTo(1.8f,0.8f); |
| path.lineTo(2,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,1); |
| pathB.lineTo(1,2); |
| pathB.lineTo(1.4f,1); |
| pathB.lineTo(3,0.4f); |
| pathB.lineTo(6,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp1i(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(1,2, 1,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(1,2, 1,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void cubicOp10d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(1,3, 1,0, 4,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(1,4, 1,0, 3,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp11d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(3,4, 1,0, 5,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(1,5, 1,0, 4,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp12d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(1,6, 1,0, 1,0); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,1, 1,0, 6,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp13d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(4,5, 1,0, 5,3); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(3,5, 1,0, 5,4); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp14d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(0,2, 2,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,2); |
| pathB.cubicTo(1,2, 1,0, 2,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp15d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(3,6, 2,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,2); |
| pathB.cubicTo(1,2, 1,0, 6,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp16d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,2); |
| path.cubicTo(0,1, 3,0, 1,0); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,3); |
| pathB.cubicTo(0,1, 2,0, 1,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp17d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,2); |
| path.cubicTo(0,2, 4,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,4); |
| pathB.cubicTo(1,2, 2,0, 2,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp18d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(3,5, 2,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,2); |
| pathB.cubicTo(1,2, 1,0, 5,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp19i(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,2); |
| path.cubicTo(0,1, 2,1, 6,2); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(1,2); |
| pathB.cubicTo(2,6, 2,0, 1,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void cubicOp20d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(0,1, 6,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,6); |
| pathB.cubicTo(1,2, 1,0, 1,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp21d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(0,1, 2,1, 6,5); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(1,2); |
| pathB.cubicTo(5,6, 1,0, 1,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp22d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(2,3, 3,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,3); |
| pathB.cubicTo(1,2, 1,0, 3,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp23d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(1,2, 4,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,4); |
| pathB.cubicTo(1,2, 1,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp24d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(1,2, 2,0, 3,2); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,2); |
| pathB.cubicTo(2,3, 1,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void testIntersect1(skiatest::Reporter* reporter) { |
| SkPath one, two; |
| one.addRect(0, 0, 6, 6, SkPath::kCW_Direction); |
| two.addRect(3, 3, 9, 9, SkPath::kCW_Direction); |
| testPathOp(reporter, one, two, kIntersect_PathOp); |
| } |
| |
| static void testUnion1(skiatest::Reporter* reporter) { |
| SkPath one, two; |
| one.addRect(0, 0, 6, 6, SkPath::kCW_Direction); |
| two.addRect(3, 3, 9, 9, SkPath::kCW_Direction); |
| testPathOp(reporter, one, two, kUnion_PathOp); |
| } |
| |
| static void testDiff1(skiatest::Reporter* reporter) { |
| SkPath one, two; |
| one.addRect(0, 0, 6, 6, SkPath::kCW_Direction); |
| two.addRect(3, 3, 9, 9, SkPath::kCW_Direction); |
| testPathOp(reporter, one, two, kDifference_PathOp); |
| } |
| |
| static void testXor1(skiatest::Reporter* reporter) { |
| SkPath one, two; |
| one.addRect(0, 0, 6, 6, SkPath::kCW_Direction); |
| two.addRect(3, 3, 9, 9, SkPath::kCW_Direction); |
| testPathOp(reporter, one, two, kXOR_PathOp); |
| } |
| |
| static void testIntersect2(skiatest::Reporter* reporter) { |
| SkPath one, two; |
| one.addRect(0, 0, 6, 6, SkPath::kCW_Direction); |
| two.addRect(0, 3, 9, 9, SkPath::kCW_Direction); |
| testPathOp(reporter, one, two, kIntersect_PathOp); |
| } |
| |
| static void testUnion2(skiatest::Reporter* reporter) { |
| SkPath one, two; |
| one.addRect(0, 0, 6, 6, SkPath::kCW_Direction); |
| two.addRect(0, 3, 9, 9, SkPath::kCW_Direction); |
| testPathOp(reporter, one, two, kUnion_PathOp); |
| } |
| |
| static void testDiff2(skiatest::Reporter* reporter) { |
| SkPath one, two; |
| one.addRect(0, 0, 6, 6, SkPath::kCW_Direction); |
| two.addRect(0, 3, 9, 9, SkPath::kCW_Direction); |
| testPathOp(reporter, one, two, kDifference_PathOp); |
| } |
| |
| static void testXor2(skiatest::Reporter* reporter) { |
| SkPath one, two; |
| one.addRect(0, 0, 6, 6, SkPath::kCW_Direction); |
| two.addRect(0, 3, 9, 9, SkPath::kCW_Direction); |
| testPathOp(reporter, one, two, kXOR_PathOp); |
| } |
| |
| static void testOp1d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| path.addRect(0, 0, 2, 2, SkPath::kCW_Direction); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void testOp2d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| path.addRect(0, 0, 2, 2, SkPath::kCW_Direction); |
| pathB.setFillType(SkPath::kEvenOdd_FillType); |
| pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void testOp3d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| path.addRect(1, 1, 2, 2, SkPath::kCW_Direction); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void testOp1u(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| path.addRect(0, 0, 3, 3, SkPath::kCW_Direction); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| testPathOp(reporter, path, pathB, kUnion_PathOp); |
| } |
| |
| static void testOp4d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| path.addRect(2, 2, 4, 4, SkPath::kCW_Direction); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void testOp5d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.addRect(0, 0, 2, 2, SkPath::kCW_Direction); |
| path.addRect(0, 0, 3, 3, SkPath::kCW_Direction); |
| pathB.setFillType(SkPath::kEvenOdd_FillType); |
| pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void testOp6d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| path.addRect(0, 0, 3, 3, SkPath::kCW_Direction); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void testOp7d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.addRect(0, 0, 2, 2, SkPath::kCW_Direction); |
| path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| pathB.setFillType(SkPath::kEvenOdd_FillType); |
| pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void testOp2u(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.addRect(0, 0, 2, 2, SkPath::kCW_Direction); |
| path.addRect(0, 0, 2, 2, SkPath::kCW_Direction); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.addRect(0, 0, 3, 3, SkPath::kCW_Direction); |
| pathB.addRect(1, 1, 2, 2, SkPath::kCW_Direction); |
| testPathOp(reporter, path, pathB, kUnion_PathOp); |
| } |
| |
| static void testOp8d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.addRect(0, 0, 640, 480); |
| pathB.moveTo(577330, 1971.72f); |
| pathB.cubicTo(10.7082f, -116.596f, 262.057f, 45.6468f, 294.694f, 1.96237f); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| static void cubicOp25i(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(2,4, 5,0, 3,2); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,5); |
| pathB.cubicTo(2,3, 1,0, 4,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void cubicOp26d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(3,4, 4,0, 3,2); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,4); |
| pathB.cubicTo(2,3, 1,0, 4,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp27d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(3,6, 1,0, 5,2); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(2,5, 1,0, 6,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp28u(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(1,4, 6,0, 3,2); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,6); |
| pathB.cubicTo(2,3, 1,0, 4,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kUnion_PathOp); |
| } |
| |
| static void cubicOp29d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(2,5, 6,0, 4,2); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,6); |
| pathB.cubicTo(2,4, 1,0, 5,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp30d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(2,5, 6,0, 5,3); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,6); |
| pathB.cubicTo(3,5, 1,0, 5,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp31d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,2); |
| path.cubicTo(0,3, 2,1, 4,0); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(1,2); |
| pathB.cubicTo(0,4, 2,0, 3,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp31u(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,2); |
| path.cubicTo(0,3, 2,1, 4,0); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(1,2); |
| pathB.cubicTo(0,4, 2,0, 3,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kUnion_PathOp); |
| } |
| |
| static void cubicOp31x(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,2); |
| path.cubicTo(0,3, 2,1, 4,0); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(1,2); |
| pathB.cubicTo(0,4, 2,0, 3,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kXOR_PathOp); |
| } |
| |
| static void cubicOp32d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(1,2, 6,0, 3,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,6); |
| pathB.cubicTo(1,3, 1,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp33i(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(1,2, 6,0, 3,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,6); |
| pathB.cubicTo(1,3, 1,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void cubicOp34d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(3,5, 2,1, 3,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(1,2); |
| pathB.cubicTo(1,3, 1,0, 5,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp35d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(1,5, 2,1, 4,0); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(1,2); |
| pathB.cubicTo(0,4, 1,0, 5,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp36u(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(1,6, 2,0, 5,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,2); |
| pathB.cubicTo(1,5, 1,0, 6,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kUnion_PathOp); |
| } |
| |
| static void cubicOp37d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(2,6, 6,1, 4,3); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(1,6); |
| pathB.cubicTo(3,4, 1,0, 6,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| #if 1 |
| // this fails to detect a cubic/cubic intersection |
| // the slight overlap is missed when the cubics are approximated by quadratics |
| // and the subsequent line/cubic intersection also (correctly) misses the intersection |
| // if the line/cubic was a matching line/approx.quadratic then the missing intersection |
| // could have been detected |
| static void cubicOp38d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(0,6, 3,2, 4,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(2,3); |
| pathB.cubicTo(1,4, 1,0, 6,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| #endif |
| |
| static void cubicOp39d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(2,3, 5,1, 4,3); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(1,5); |
| pathB.cubicTo(3,4, 1,0, 3,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp40d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(1,5, 3,2, 4,2); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(2,3); |
| pathB.cubicTo(2,4, 1,0, 5,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp41i(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(2,6, 4,3, 6,4); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(3,4); |
| pathB.cubicTo(4,6, 1,0, 6,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void cubicOp42d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(1,2, 6,5, 5,4); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(5,6); |
| pathB.cubicTo(4,5, 1,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp43d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,2); |
| path.cubicTo(1,2, 4,0, 3,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,4); |
| pathB.cubicTo(1,3, 2,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp44d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,2); |
| path.cubicTo(3,6, 4,0, 3,2); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,4); |
| pathB.cubicTo(2,3, 2,0, 6,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp45d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,2); |
| path.cubicTo(2,4, 4,0, 3,2); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,4); |
| pathB.cubicTo(2,3, 2,0, 4,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp46d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,2); |
| path.cubicTo(3,5, 5,0, 4,2); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,5); |
| pathB.cubicTo(2,4, 2,0, 5,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp47d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(1,6, 6,2, 5,4); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(2,6); |
| pathB.cubicTo(4,5, 1,0, 6,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp48d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,2); |
| path.cubicTo(2,3, 5,1, 3,2); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(1,5); |
| pathB.cubicTo(2,3, 2,0, 3,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp49d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,2); |
| path.cubicTo(1,5, 3,2, 4,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(2,3); |
| pathB.cubicTo(1,4, 2,0, 5,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp50d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,3); |
| path.cubicTo(1,6, 5,0, 5,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,5); |
| pathB.cubicTo(1,5, 3,0, 6,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp51d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,3); |
| path.cubicTo(1,2, 4,1, 6,0); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(1,4); |
| pathB.cubicTo(0,6, 3,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp52d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,2); |
| path.cubicTo(1,2, 5,4, 4,3); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(4,5); |
| pathB.cubicTo(3,4, 2,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp53d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,3); |
| path.cubicTo(1,2, 5,3, 2,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(3,5); |
| pathB.cubicTo(1,2, 3,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp54d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,4); |
| path.cubicTo(1,3, 5,4, 4,2); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(4,5); |
| pathB.cubicTo(2,4, 4,0, 3,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp55d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,5); |
| path.cubicTo(1,3, 3,2, 5,0); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(2,3); |
| pathB.cubicTo(0,5, 5,0, 3,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp56d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(2,6, 5,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,5); |
| pathB.cubicTo(1,2, 1,0, 6,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp57d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,5); |
| path.cubicTo(0,5, 5,4, 6,4); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(4,5); |
| pathB.cubicTo(4,6, 5,0, 5,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp58d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,5); |
| path.cubicTo(3,4, 6,5, 5,3); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(5,6); |
| pathB.cubicTo(3,5, 5,0, 4,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp59d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(5,6, 4,0, 4,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,4); |
| pathB.cubicTo(1,4, 1,0, 6,5); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp60d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,2); |
| path.cubicTo(4,6, 6,0, 5,2); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,6); |
| pathB.cubicTo(2,5, 2,0, 6,4); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp61d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(1,2); |
| path.cubicTo(0,5, 3,2, 6,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(2,3); |
| pathB.cubicTo(1,6, 2,1, 5,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp62d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(1,3); |
| path.cubicTo(5,6, 5,3, 5,4); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(3,5); |
| pathB.cubicTo(4,5, 3,1, 6,5); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp63d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(2,3); |
| path.cubicTo(0,4, 3,2, 5,3); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(2,3); |
| pathB.cubicTo(3,5, 3,2, 4,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp64d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.moveTo(0,1); |
| path.cubicTo(0,1, 1,0, 3,0); |
| path.lineTo(0,1); |
| path.close(); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,3, 1,0, 1,0); |
| pathB.lineTo(0,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp65d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.moveTo(0,1); |
| path.cubicTo(1,5, 1,0, 1,0); |
| path.lineTo(0,1); |
| path.close(); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,1, 1,0, 5,1); |
| pathB.lineTo(0,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void rectOp1d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.moveTo(0,1); |
| path.cubicTo(0,1, 1,0, 3,0); |
| path.lineTo(0,1); |
| path.close(); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,3, 1,0, 1,0); |
| pathB.lineTo(0,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp66u(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(2,6, 4,2, 5,3); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(2,4); |
| pathB.cubicTo(3,5, 1,0, 6,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kUnion_PathOp); |
| } |
| |
| static void cubicOp67u(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.moveTo(3,5); |
| path.cubicTo(1,6, 5,0, 3,1); |
| path.lineTo(3,5); |
| path.close(); |
| pathB.moveTo(0,5); |
| pathB.cubicTo(1,3, 5,3, 6,1); |
| pathB.lineTo(0,5); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kUnion_PathOp); |
| } |
| |
| static void cubicOp68u(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.moveTo(0,5); |
| path.cubicTo(4,5, 4,1, 5,0); |
| path.close(); |
| pathB.moveTo(1,4); |
| pathB.cubicTo(0,5, 5,0, 5,4); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kUnion_PathOp); |
| } |
| |
| static void cubicOp69d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.moveTo(1,3); |
| path.cubicTo(0,1, 3,1, 2,0); |
| path.close(); |
| pathB.moveTo(1,3); |
| pathB.cubicTo(0,2, 3,1, 1,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| SkPathOp ops[] = { |
| kUnion_PathOp, |
| kXOR_PathOp, |
| kReverseDifference_PathOp, |
| kXOR_PathOp, |
| kReverseDifference_PathOp, |
| }; |
| |
| static void rRect1(skiatest::Reporter* reporter) { |
| SkScalar xA = SkFloatToScalar(0.65f); |
| SkScalar xB = SkFloatToScalar(10.65f); |
| SkScalar xC = SkFloatToScalar(20.65f); |
| SkScalar xD = SkFloatToScalar(30.65f); |
| SkScalar xE = SkFloatToScalar(40.65f); |
| SkScalar xF = SkFloatToScalar(50.65f); |
| |
| SkScalar yA = SkFloatToScalar(0.65f); |
| SkScalar yB = SkFloatToScalar(10.65f); |
| SkScalar yC = SkFloatToScalar(20.65f); |
| SkScalar yD = SkFloatToScalar(30.65f); |
| SkScalar yE = SkFloatToScalar(40.65f); |
| SkScalar yF = SkFloatToScalar(50.65f); |
| SkPath paths[5]; |
| SkRect rects[5]; |
| rects[0].set(xB, yB, xE, yE); |
| paths[0].addRoundRect(rects[0], SkIntToScalar(5), SkIntToScalar(5)); // red |
| rects[1].set(xA, yA, xD, yD); |
| paths[1].addRoundRect(rects[1], SkIntToScalar(5), SkIntToScalar(5)); // green |
| rects[2].set(xC, yA, xF, yD); |
| paths[2].addRoundRect(rects[2], SkIntToScalar(5), SkIntToScalar(5)); // blue |
| rects[3].set(xA, yC, xD, yF); |
| paths[3].addRoundRect(rects[3], SkIntToScalar(5), SkIntToScalar(5)); // yellow |
| rects[4].set(xC, yC, xF, yF); |
| paths[4].addRoundRect(rects[4], SkIntToScalar(5), SkIntToScalar(5)); // cyan |
| SkPath path; |
| path.setFillType(SkPath::kInverseEvenOdd_FillType); |
| for (int index = 0; index < 5; ++index) { |
| testPathOp(reporter, path, paths[index], ops[index]); |
| Op(path, paths[index], ops[index], &path); |
| } |
| } |
| |
| static void skp1(skiatest::Reporter* reporter) { |
| SkPath path; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.moveTo(189,7); |
| path.cubicTo(189,5.34314585f, 190.34314f,4, 192,4); |
| path.lineTo(243,4); |
| path.cubicTo(244.65686f,4, 246,5.34314585f, 246,7); |
| path.lineTo(246,21); |
| path.cubicTo(246,22.6568546f, 244.65686f,24, 243,24); |
| path.lineTo(192,24); |
| path.cubicTo(190.34314f,24, 189,22.6568546f, 189,21); |
| path.lineTo(189,7); |
| path.close(); |
| path.moveTo(191,8); |
| path.cubicTo(191,6.89543009f, 191.895432f,6, 193,6); |
| path.lineTo(242,6); |
| path.cubicTo(243.104568f,6, 244,6.89543009f, 244,8); |
| path.lineTo(244,20); |
| path.cubicTo(244,21.1045704f, 243.104568f,22, 242,22); |
| path.lineTo(193,22); |
| path.cubicTo(191.895432f,22, 191,21.1045704f, 191,20); |
| path.lineTo(191,8); |
| path.close(); |
| SkPath pathB; |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(189,4); |
| pathB.lineTo(199,14); |
| pathB.lineTo(236,14); |
| pathB.lineTo(246,4); |
| pathB.lineTo(189,4); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void skp2(skiatest::Reporter* reporter) { |
| SkPath path; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.moveTo(253.000000f, 11757.0000f); |
| path.lineTo(253.000000f, 222.000000f); |
| path.lineTo(823.000000f, 222.000000f); |
| path.lineTo(823.000000f, 11757.0000f); |
| path.lineTo(253.000000f, 11757.0000f); |
| path.close(); |
| SkPath pathB; |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(258.000000f, 1028.00000f); |
| pathB.lineTo(258.000000f, 1027.00000f); |
| pathB.lineTo(823.000000f, 1027.00000f); |
| pathB.lineTo(823.000000f, 1028.00000f); |
| pathB.lineTo(258.000000f, 1028.00000f); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void skp3(skiatest::Reporter* reporter) { |
| SkPath path; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.moveTo(717.000000f, 507.000000f); |
| path.lineTo(717.000000f, 425.000000f); |
| path.lineTo(973.000000f, 425.000000f); |
| path.lineTo(973.000000f, 507.000000f); |
| path.quadTo(973.000000f, 508.242645f, 972.121582f, 509.121613f); |
| path.quadTo(971.242615f, 510.000000f, 970.000000f, 510.000000f); |
| path.lineTo(720.000000f, 510.000000f); |
| path.quadTo(718.757385f, 510.000000f, 717.878418f, 509.121613f); |
| path.quadTo(717.000000f, 508.242645f, 717.000000f, 507.000000f); |
| path.close(); |
| path.moveTo(719.000000f, 426.000000f); |
| path.lineTo(971.000000f, 426.000000f); |
| path.lineTo(971.000000f, 506.000000f); |
| path.cubicTo(971.000000f, 507.104584f, 970.104553f, 508.000000f, 969.000000f, 508.000000f); |
| path.lineTo(721.000000f, 508.000000f); |
| path.cubicTo(719.895447f, 508.000000f, 719.000000f, 507.104584f, 719.000000f, 506.000000f); |
| path.lineTo(719.000000f, 426.000000f); |
| path.close(); |
| SkPath pathB; |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(717.000000f, 510.000000f); |
| pathB.lineTo(760.000000f, 467.000000f); |
| pathB.lineTo(930.000000f, 467.000000f); |
| pathB.lineTo(973.000000f, 510.000000f); |
| pathB.lineTo(717.000000f, 510.000000f); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void skp4(skiatest::Reporter* reporter) { |
| SkPath path; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.moveTo(230.756805f, 591.756775f); |
| path.quadTo(232.514725f, 590.000000f, 235.000000f, 590.000000f); |
| path.lineTo(300.000000f, 590.000000f); |
| path.quadTo(302.485291f, 590.000000f, 304.243195f, 591.756775f); |
| path.quadTo(306.000000f, 593.514709f, 306.000000f, 596.000000f); |
| path.lineTo(306.000000f, 617.000000f); |
| path.lineTo(229.000000f, 617.000000f); |
| path.lineTo(229.000000f, 596.000000f); |
| path.quadTo(229.000000f, 593.514709f, 230.756805f, 591.756775f); |
| path.close(); |
| path.moveTo(231.000000f, 597.000000f); |
| path.cubicTo(231.000000f, 594.238586f, 233.238571f, 592.000000f, 236.000000f, 592.000000f); |
| path.lineTo(299.000000f, 592.000000f); |
| path.cubicTo(301.761414f, 592.000000f, 304.000000f, 594.238586f, 304.000000f, 597.000000f); |
| path.lineTo(304.000000f, 616.000000f); |
| path.lineTo(231.000000f, 616.000000f); |
| path.lineTo(231.000000f, 597.000000f); |
| path.close(); |
| SkPath pathB; |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(306.000000f, 590.000000f); |
| pathB.lineTo(292.000000f, 604.000000f); |
| pathB.lineTo(305.000000f, 617.000000f); |
| pathB.lineTo(306.000000f, 617.000000f); |
| pathB.lineTo(306.000000f, 590.000000f); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void skp5(skiatest::Reporter* reporter) { |
| SkPath path; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.moveTo(18.0000000f, 226.000000f); |
| path.quadTo(14.6862917f, 226.000000f, 12.3423996f, 228.342407f); |
| path.quadTo(10.0000000f, 230.686295f, 10.0000000f, 234.000000f); |
| path.lineTo(10.0000000f, 253.000000f); |
| path.lineTo(1247.00000f, 253.000000f); |
| path.lineTo(1247.00000f, 234.000000f); |
| path.quadTo(1247.00000f, 230.686295f, 1244.65759f, 228.342407f); |
| path.quadTo(1242.31372f, 226.000000f, 1239.00000f, 226.000000f); |
| path.lineTo(18.0000000f, 226.000000f); |
| path.close(); |
| SkPath pathB; |
| pathB.setFillType(SkPath::kInverseWinding_FillType); |
| pathB.moveTo(18.0000000f, 226.000000f); |
| pathB.lineTo(1239.00000f, 226.000000f); |
| pathB.cubicTo(1243.41833f, 226.000000f, 1247.00000f, 229.581726f, 1247.00000f, 234.000000f); |
| pathB.lineTo(1247.00000f, 252.000000f); |
| pathB.lineTo(10.0000000f, 252.000000f); |
| pathB.lineTo(10.0000000f, 234.000000f); |
| pathB.cubicTo(10.0000000f, 229.581726f, 13.5817204f, 226.000000f, 18.0000000f, 226.000000f); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void cubicOp70d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(0,5, 4,0, 5,0); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,4); |
| pathB.cubicTo(0,5, 1,0, 5,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp71d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(0,5, 4,1, 6,4); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(1,4); |
| pathB.cubicTo(4,6, 1,0, 5,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp72i(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(0,5, 5,2, 5,4); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(2,5); |
| pathB.cubicTo(4,5, 1,0, 5,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void cubicOp73d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(3,4, 4,0, 6,4); |
| path.lineTo(0,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,4); |
| pathB.cubicTo(4,6, 1,0, 4,3); |
| pathB.lineTo(0,4); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp74d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(1,5, 5,1, 5,1); |
| path.lineTo(0,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(1,5); |
| pathB.cubicTo(1,5, 1,0, 5,1); |
| pathB.lineTo(1,5); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp75d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(0,4, 5,1, 6,4); |
| path.lineTo(0,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(1,5); |
| pathB.cubicTo(4,6, 1,0, 4,0); |
| pathB.lineTo(1,5); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp76u(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(0,2, 2,0, 5,3); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,2); |
| pathB.cubicTo(3,5, 1,0, 2,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kUnion_PathOp); |
| } |
| |
| static void cubicOp77i(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(1,3, 2,0, 3,2); |
| path.lineTo(0,1); |
| path.close(); |
| pathB.setFillType(SkPath::kEvenOdd_FillType); |
| pathB.moveTo(0,2); |
| pathB.cubicTo(2,3, 1,0, 3,1); |
| pathB.lineTo(0,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void cubicOp78u(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.moveTo(1,6); |
| path.cubicTo(1,6, 5,0, 6,1); |
| path.lineTo(1,6); |
| path.close(); |
| pathB.setFillType(SkPath::kEvenOdd_FillType); |
| pathB.moveTo(0,5); |
| pathB.cubicTo(1,6, 6,1, 6,1); |
| pathB.lineTo(0,5); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kUnion_PathOp); |
| } |
| |
| static void cubicOp79u(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(1,3, 1,0, 6,4); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(4,6, 1,0, 3,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void cubicOp80i(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(2,3, 2,1, 4,3); |
| path.lineTo(0,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(1,2); |
| pathB.cubicTo(3,4, 1,0, 3,2); |
| pathB.lineTo(1,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void cubicOp81d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(4,6, 4,3, 5,4); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(3,4); |
| pathB.cubicTo(4,5, 1,0, 6,4); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void cubicOp82i(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(2,3, 5,2, 3,0); |
| path.lineTo(0,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(2,5); |
| pathB.cubicTo(0,3, 1,0, 3,2); |
| pathB.lineTo(2,5); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void cubicOp83i(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,1); |
| path.cubicTo(0,3, 2,1, 4,1); |
| path.lineTo(0,1); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(1,2); |
| pathB.cubicTo(1,4, 1,0, 3,0); |
| pathB.lineTo(1,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void cubicOp84d(skiatest::Reporter* reporter) { |
| SkPath path, pathB; |
| path.setFillType(SkPath::kWinding_FillType); |
| path.moveTo(0,4); |
| path.cubicTo(2,3, 6,3, 3,2); |
| path.close(); |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(3,6); |
| pathB.cubicTo(2,3, 4,0, 3,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_PathOp); |
| } |
| |
| static void skpClip1(skiatest::Reporter* reporter) { |
| SkPath path; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.moveTo(1126.17114f, 877.171204f); |
| path.quadTo(1127.34314f, 876.000000f, 1129.00000f, 876.000000f); |
| path.lineTo(1243.00000f, 876.000000f); |
| path.quadTo(1244.65686f, 876.000000f, 1245.82886f, 877.171204f); |
| path.quadTo(1247.00000f, 878.343140f, 1247.00000f, 880.000000f); |
| path.lineTo(1247.00000f, 907.000000f); |
| path.lineTo(1246.00000f, 907.000000f); |
| path.lineTo(1246.00000f, 880.000000f); |
| path.cubicTo(1246.00000f, 878.343140f, 1244.65686f, 877.000000f, 1243.00000f, 877.000000f); |
| path.lineTo(1129.00000f, 877.000000f); |
| path.cubicTo(1127.34314f, 877.000000f, 1126.00000f, 878.343140f, 1126.00000f, 880.000000f); |
| path.lineTo(1126.00000f, 907.000000f); |
| path.lineTo(1125.00000f, 907.000000f); |
| path.lineTo(1125.00000f, 880.000000f); |
| path.quadTo(1125.00000f, 878.343140f, 1126.17114f, 877.171204f); |
| path.close(); |
| SkPath pathB; |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(1247.00000f, 876.000000f); |
| pathB.lineTo(1231.00000f, 892.000000f); |
| pathB.lineTo(1246.00000f, 907.000000f); |
| pathB.lineTo(1247.00000f, 907.000000f); |
| pathB.lineTo(1247.00000f, 876.000000f); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void skpClip2(skiatest::Reporter* reporter) { |
| SkPath path; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.moveTo(134.000000f, 11414.0000f); |
| path.cubicTo(131.990234f, 11414.0000f, 130.326660f, 11415.4824f, 130.042755f, 11417.4131f); |
| path.cubicTo(130.233124f, 11418.3193f, 131.037079f, 11419.0000f, 132.000000f, 11419.0000f); |
| path.lineTo(806.000000f, 11419.0000f); |
| path.cubicTo(806.962891f, 11419.0000f, 807.766907f, 11418.3193f, 807.957275f, 11417.4131f); |
| path.cubicTo(807.673401f, 11415.4824f, 806.009766f, 11414.0000f, 804.000000f, 11414.0000f); |
| path.lineTo(134.000000f, 11414.0000f); |
| path.close(); |
| SkPath pathB; |
| pathB.setFillType(SkPath::kInverseWinding_FillType); |
| pathB.moveTo(132.000000f, 11415.0000f); |
| pathB.lineTo(806.000000f, 11415.0000f); |
| pathB.cubicTo(807.104553f, 11415.0000f, 808.000000f, 11415.4473f, 808.000000f, 11416.0000f); |
| pathB.lineTo(808.000000f, 11417.0000f); |
| pathB.cubicTo(808.000000f, 11418.1045f, 807.104553f, 11419.0000f, 806.000000f, 11419.0000f); |
| pathB.lineTo(132.000000f, 11419.0000f); |
| pathB.cubicTo(130.895432f, 11419.0000f, 130.000000f, 11418.1045f, 130.000000f, 11417.0000f); |
| pathB.lineTo(130.000000f, 11416.0000f); |
| pathB.cubicTo(130.000000f, 11415.4473f, 130.895432f, 11415.0000f, 132.000000f, 11415.0000f); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void skp96prezzi1(skiatest::Reporter* reporter) { |
| SkPath path; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.moveTo(157.464005f, 670.463989f); |
| path.quadTo(158.928925f, 669.000000f, 161.000000f, 669.000000f); |
| path.lineTo(248.000000f, 669.000000f); |
| path.quadTo(250.071075f, 669.000000f, 251.535995f, 670.463989f); |
| path.quadTo(253.000000f, 671.928955f, 253.000000f, 674.000000f); |
| path.lineTo(253.000000f, 706.000000f); |
| path.lineTo(251.000000f, 706.000000f); |
| path.lineTo(251.000000f, 675.000000f); |
| path.cubicTo(251.000000f, 672.790833f, 249.209137f, 671.000000f, 247.000000f, 671.000000f); |
| path.lineTo(162.000000f, 671.000000f); |
| path.cubicTo(159.790863f, 671.000000f, 158.000000f, 672.790833f, 158.000000f, 675.000000f); |
| path.lineTo(158.000000f, 706.000000f); |
| path.lineTo(156.000000f, 706.000000f); |
| path.lineTo(156.000000f, 674.000000f); |
| path.quadTo(156.000000f, 671.928955f, 157.464005f, 670.463989f); |
| path.close(); |
| SkPath pathB; |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(156.000000f, 669.000000f); |
| pathB.lineTo(178.500000f, 691.500000f); |
| pathB.lineTo(230.500000f, 691.500000f); |
| pathB.lineTo(253.000000f, 669.000000f); |
| pathB.lineTo(156.000000f, 669.000000f); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void skpancestry_com1(skiatest::Reporter* reporter) { |
| SkPath path; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.moveTo(161.000000f, 925.000000f); |
| path.cubicTo(159.874390f, 925.000000f, 158.835663f, 925.371948f, 158.000000f, 925.999634f); |
| path.lineTo(158.000000f, 926.000000f); |
| path.lineTo(1108.00000f, 926.000000f); |
| path.lineTo(1108.00000f, 925.999634f); |
| path.cubicTo(1107.16443f, 925.371948f, 1106.12561f, 925.000000f, 1105.00000f, 925.000000f); |
| path.lineTo(161.000000f, 925.000000f); |
| path.close(); |
| SkPath pathB; |
| pathB.setFillType(SkPath::kEvenOdd_FillType); |
| pathB.moveTo(161.000000f, 926.000000f); |
| pathB.lineTo(1105.00000f, 926.000000f); |
| pathB.cubicTo(1107.20911f, 926.000000f, 1109.00000f, 927.790833f, 1109.00000f, 930.000000f); |
| pathB.lineTo(1109.00000f, 956.000000f); |
| pathB.cubicTo(1109.00000f, 958.209167f, 1107.20911f, 960.000000f, 1105.00000f, 960.000000f); |
| pathB.lineTo(161.000000f, 960.000000f); |
| pathB.cubicTo(158.790863f, 960.000000f, 157.000000f, 958.209167f, 157.000000f, 956.000000f); |
| pathB.lineTo(157.000000f, 930.000000f); |
| pathB.cubicTo(157.000000f, 927.790833f, 158.790863f, 926.000000f, 161.000000f, 926.000000f); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void skpeldorado_com_ua1(skiatest::Reporter* reporter) { |
| SkPath path; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.moveTo(286.695129f, 291.000000f); |
| path.lineTo(229.304855f, 561.000000f); |
| path.lineTo(979.304871f, 561.000000f); |
| path.lineTo(1036.69507f, 291.000000f); |
| path.lineTo(286.695129f, 291.000000f); |
| path.close(); |
| SkPath pathB; |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(1006.69513f, 291.000000f); |
| pathB.cubicTo(1023.26367f, 291.000000f, 1033.84021f, 304.431458f, 1030.31836f, 321.000000f); |
| pathB.lineTo(985.681519f, 531.000000f); |
| pathB.cubicTo(982.159790f, 547.568542f, 965.873413f, 561.000000f, 949.304871f, 561.000000f); |
| pathB.lineTo(259.304871f, 561.000000f); |
| pathB.cubicTo(242.736313f, 561.000000f, 232.159805f, 547.568542f, 235.681549f, 531.000000f); |
| pathB.lineTo(280.318420f, 321.000000f); |
| pathB.cubicTo(283.840179f, 304.431458f, 300.126587f, 291.000000f, 316.695129f, 291.000000f); |
| pathB.lineTo(1006.69513f, 291.000000f); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void skpbyte_com1(skiatest::Reporter* reporter) { |
| SkPath path; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.moveTo(968.000000f, 14.0000000f); |
| path.cubicTo(965.238586f, 14.0000000f, 963.000000f, 16.2385769f, 963.000000f, 19.0000000f); |
| path.lineTo(963.000000f, 32.0000000f); |
| path.cubicTo(963.000000f, 34.7614250f, 965.238586f, 37.0000000f, 968.000000f, 37.0000000f); |
| path.lineTo(1034.00000f, 37.0000000f); |
| path.cubicTo(1036.76147f, 37.0000000f, 1039.00000f, 34.7614250f, 1039.00000f, 32.0000000f); |
| path.lineTo(1039.00000f, 19.0000000f); |
| path.cubicTo(1039.00000f, 16.2385769f, 1036.76147f, 14.0000000f, 1034.00000f, 14.0000000f); |
| path.lineTo(968.000000f, 14.0000000f); |
| path.close(); |
| SkPath pathB; |
| pathB.setFillType(SkPath::kInverseWinding_FillType); |
| pathB.moveTo(968.000000f, 14.0000000f); |
| pathB.lineTo(1034.00000f, 14.0000000f); |
| pathB.cubicTo(1036.76147f, 14.0000000f, 1039.00000f, 16.2385750f, 1039.00000f, 19.0000000f); |
| pathB.lineTo(1039.00000f, 32.0000000f); |
| pathB.cubicTo(1039.00000f, 34.2091408f, 1036.76147f, 36.0000000f, 1034.00000f, 36.0000000f); |
| pathB.lineTo(968.000000f, 36.0000000f); |
| pathB.cubicTo(965.238586f, 36.0000000f, 963.000000f, 34.2091408f, 963.000000f, 32.0000000f); |
| pathB.lineTo(963.000000f, 19.0000000f); |
| pathB.cubicTo(963.000000f, 16.2385750f, 965.238586f, 14.0000000f, 968.000000f, 14.0000000f); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| } |
| |
| static void skphealth_com76(skiatest::Reporter* reporter) { |
| SkPath path; |
| path.setFillType(SkPath::kEvenOdd_FillType); |
| path.moveTo(708.099182f, 7.09919119f); |
| path.lineTo(708.099182f, 7.09920025f); |
| path.quadTo(704.000000f, 11.2010098f, 704.000000f, 17.0000000f); |
| path.lineTo(704.000000f, 33.0000000f); |
| path.lineTo(705.000000f, 33.0000000f); |
| path.lineTo(705.000000f, 17.0000000f); |
| path.cubicTo(705.000000f, 13.4101496f, 706.455078f, 10.1601505f, 708.807617f, 7.80761385f); |
| path.lineTo(708.099182f, 7.09919119f); |
| path.close(); |
| SkPath pathB; |
| pathB.setFillType(SkPath::kWinding_FillType); |
| pathB.moveTo(704.000000f, 3.00000000f); |
| #if 0 |
| pathB.lineTo(719.500000f, 3.00000000f); |
| pathB.lineTo(705.000000f, 33.0000000f); |
| pathB.lineTo(704.000000f, 33.0000000f); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| #else |
| pathB.lineTo(704.000000f, 33.0000000f); |
| pathB.lineTo(705.000000f, 33.0000000f); |
| pathB.lineTo(719.500000f, 3.00000000f); |
| testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| #endif |
| } |
| |
| static void skpahrefs_com88(skiatest::Reporter* reporter) {
|
| SkPath path;
|
| path.setFillType(SkPath::kEvenOdd_FillType);
|
| path.moveTo(1099.82886f, 7.17117119f);
|
| path.lineTo(1099.12134f, 7.87867832f);
|
| path.cubicTo(1099.66418f, 8.42157173f, 1100.00000f, 9.17157173f, 1100.00000f, 10.0000000f);
|
| path.lineTo(1100.00000f, 28.0000000f);
|
| path.cubicTo(1100.00000f, 29.6568546f, 1098.65686f, 31.0000000f, 1097.00000f, 31.0000000f);
|
| path.lineTo(1088.00000f, 31.0000000f);
|
| path.lineTo(1088.00000f, 32.0000000f);
|
| path.lineTo(1097.00000f, 32.0000000f);
|
| path.quadTo(1098.65686f, 32.0000000f, 1099.82886f, 30.8288002f);
|
| path.quadTo(1101.00000f, 29.6568546f, 1101.00000f, 28.0000000f);
|
| path.lineTo(1101.00000f, 10.0000000f);
|
| path.quadTo(1101.00000f, 8.34314537f, 1099.82886f, 7.17119980f);
|
| path.lineTo(1099.82886f, 7.17117119f);
|
| path.close();
|
| SkPath pathB;
|
| pathB.setFillType(SkPath::kWinding_FillType);
|
| pathB.moveTo(1101.00000f, 6.00000000f);
|
| pathB.lineTo(1088.00000f, 6.00000000f);
|
| pathB.lineTo(1088.00000f, 19.0000000f);
|
| pathB.lineTo(1101.00000f, 32.0000000f);
|
| testPathOp(reporter, path, pathB, kIntersect_PathOp);
|
| }
|
| |
| static void skpahrefs_com29(skiatest::Reporter* reporter) {
|
| SkPath path;
|
| path.setFillType(SkPath::kEvenOdd_FillType);
|
| path.moveTo(1037.17114f, 7.17119980f);
|
| path.quadTo(1038.34314f, 6.00000000f, 1040.00000f, 6.00000000f);
|
| path.lineTo(1074.00000f, 6.00000000f);
|
| path.lineTo(1074.00000f, 32.0000000f);
|
| path.lineTo(1040.00000f, 32.0000000f);
|
| path.quadTo(1038.34314f, 32.0000000f, 1037.17114f, 30.8288002f);
|
| path.quadTo(1036.00000f, 29.6568546f, 1036.00000f, 28.0000000f);
|
| path.lineTo(1036.00000f, 10.0000000f);
|
| path.quadTo(1036.00000f, 8.34314537f, 1037.17114f, 7.17119980f);
|
| path.close();
|
| path.moveTo(1037.00000f, 10.0000000f);
|
| path.cubicTo(1037.00000f, 8.34314537f, 1038.34314f, 7.00000000f, 1040.00000f, 7.00000000f);
|
| path.lineTo(1073.00000f, 7.00000000f);
|
| path.lineTo(1073.00000f, 31.0000000f);
|
| path.lineTo(1040.00000f, 31.0000000f);
|
| path.cubicTo(1038.34314f, 31.0000000f, 1037.00000f, 29.6568546f, 1037.00000f, 28.0000000f);
|
| path.lineTo(1037.00000f, 10.0000000f);
|
| path.close();
|
| SkPath pathB;
|
| pathB.setFillType(SkPath::kWinding_FillType);
|
| pathB.moveTo(1036.00000f, 32.0000000f);
|
| pathB.lineTo(1049.00000f, 19.0000000f);
|
| pathB.lineTo(1073.00000f, 31.0000000f);
|
| pathB.lineTo(1074.00000f, 32.0000000f);
|
| testPathOp(reporter, path, pathB, kIntersect_PathOp);
|
| }
|
| |
| static void cubicOp85d(skiatest::Reporter* reporter) {
|
| SkPath path;
|
| path.setFillType(SkPath::kWinding_FillType);
|
| path.moveTo(0,1);
|
| path.cubicTo(1,6, 1,0, 6,2);
|
| path.close();
|
| SkPath pathB;
|
| pathB.setFillType(SkPath::kWinding_FillType);
|
| pathB.moveTo(0,1);
|
| pathB.cubicTo(2,6, 1,0, 6,1);
|
| pathB.close();
|
| testPathOp(reporter, path, pathB, kDifference_PathOp);
|
| } |
| |
| #if 0 // FIXME |
| // this fails because the pair of nearly coincident cubics intersect at the ends |
| // but the line connected to one of the cubics at the same point does not intersect |
| // the other |
| static void skpkkiste_to98(skiatest::Reporter* reporter) {
|
| SkPath path;
|
| path.setFillType(SkPath::kEvenOdd_FillType);
|
| path.moveTo(96, 122);
|
| path.cubicTo(94.6192932f, 122, 93.3692932f, 122.559647f, 92.4644699f, 123.46447f);
|
| path.lineTo(94.1715698f, 125.17157f);
|
| path.cubicTo(94.8954315f, 124.447708f, 95.8954315f, 124, 97, 124);
|
| path.lineTo(257, 124);
|
| path.cubicTo(258.104553f, 124, 259.104584f, 124.447708f, 259.82843f, 125.17157f);
|
| path.lineTo(261.535522f, 123.46447f);
|
| path.cubicTo(260.630707f, 122.559647f, 259.380707f, 122, 258, 122);
|
| path.lineTo(96, 122);
|
| path.close();
|
| SkPath pathB;
|
| pathB.setFillType(SkPath::kWinding_FillType);
|
| pathB.moveTo(258, 122);
|
| pathB.cubicTo(260.761414f, 122, 263, 124.238579f, 263, 127);
|
| pathB.lineTo(263, 284);
|
| pathB.cubicTo(263, 286.761414f, 260.761414f, 289, 258, 289);
|
| pathB.lineTo(96, 289);
|
| pathB.cubicTo(93.2385788f, 289, 91, 286.761414f, 91, 284);
|
| pathB.lineTo(91, 127);
|
| pathB.cubicTo(91, 124.238579f, 93.2385788f, 122, 96, 122);
|
| pathB.lineTo(258, 122);
|
| pathB.close();
|
| testPathOp(reporter, path, pathB, kIntersect_PathOp);
|
| }
|
| #endif |
| |
| static void (*firstTest)(skiatest::Reporter* ) = 0; |
| |
| static struct TestDesc tests[] = { |
| // TEST(skpkkiste_to98), |
| TEST(skpahrefs_com29), |
| TEST(cubicOp85d), |
| TEST(skpahrefs_com88), |
| TEST(skphealth_com76), |
| TEST(skpancestry_com1), |
| TEST(skpbyte_com1), |
| TEST(skpeldorado_com_ua1), |
| TEST(skp96prezzi1), |
| TEST(skpClip2), |
| TEST(skpClip1), |
| TEST(cubicOp84d), |
| TEST(cubicOp83i), |
| TEST(cubicOp82i), |
| TEST(cubicOp81d), |
| TEST(cubicOp80i), |
| TEST(cubicOp79u), |
| TEST(cubicOp78u), |
| TEST(cubicOp77i), |
| TEST(cubicOp76u), |
| TEST(cubicOp75d), |
| TEST(cubicOp74d), |
| TEST(cubicOp73d), |
| TEST(cubicOp72i), |
| TEST(cubicOp71d), |
| TEST(skp5), |
| TEST(skp4), |
| TEST(skp3), |
| TEST(skp2), |
| TEST(skp1), |
| TEST(rRect1), |
| TEST(cubicOp70d), |
| TEST(cubicOp69d), |
| TEST(cubicOp68u), |
| TEST(cubicOp67u), |
| TEST(cubicOp66u), |
| TEST(rectOp1d), |
| TEST(cubicOp65d), |
| TEST(cubicOp64d), |
| TEST(cubicOp63d), |
| TEST(cubicOp62d), |
| TEST(cubicOp61d), |
| TEST(cubicOp60d), |
| TEST(cubicOp59d), |
| TEST(cubicOp58d), |
| TEST(cubicOp57d), |
| TEST(cubicOp56d), |
| TEST(cubicOp55d), |
| TEST(cubicOp54d), |
| TEST(cubicOp53d), |
| TEST(cubicOp52d), |
| TEST(cubicOp51d), |
| TEST(cubicOp50d), |
| TEST(cubicOp49d), |
| TEST(cubicOp48d), |
| TEST(cubicOp47d), |
| TEST(cubicOp46d), |
| TEST(cubicOp45d), |
| TEST(cubicOp44d), |
| TEST(cubicOp43d), |
| TEST(cubicOp42d), |
| TEST(cubicOp41i), |
| TEST(cubicOp40d), |
| TEST(cubicOp39d), |
| TEST(cubicOp38d), |
| TEST(cubicOp37d), |
| TEST(cubicOp36u), |
| TEST(cubicOp35d), |
| TEST(cubicOp34d), |
| TEST(cubicOp33i), |
| TEST(cubicOp32d), |
| TEST(cubicOp31d), |
| TEST(cubicOp31x), |
| TEST(cubicOp31u), |
| TEST(cubicOp30d), |
| TEST(cubicOp29d), |
| TEST(cubicOp28u), |
| TEST(cubicOp27d), |
| TEST(cubicOp26d), |
| TEST(cubicOp25i), |
| TEST(testOp8d), |
| TEST(testDiff1), |
| TEST(testIntersect1), |
| TEST(testUnion1), |
| TEST(testXor1), |
| TEST(testDiff2), |
| TEST(testIntersect2), |
| TEST(testUnion2), |
| TEST(testXor2), |
| TEST(testOp1d), |
| TEST(testOp2d), |
| TEST(testOp3d), |
| TEST(testOp1u), |
| TEST(testOp4d), |
| TEST(testOp5d), |
| TEST(testOp6d), |
| TEST(testOp7d), |
| TEST(testOp2u), |
| |
| TEST(cubicOp24d), |
| TEST(cubicOp23d), |
| TEST(cubicOp22d), |
| TEST(cubicOp21d), |
| TEST(cubicOp20d), |
| TEST(cubicOp19i), |
| TEST(cubicOp18d), |
| TEST(cubicOp17d), |
| TEST(cubicOp16d), |
| TEST(cubicOp15d), |
| TEST(cubicOp14d), |
| TEST(cubicOp13d), |
| TEST(cubicOp12d), |
| TEST(cubicOp11d), |
| TEST(cubicOp10d), |
| TEST(cubicOp1i), |
| TEST(cubicOp9d), |
| TEST(quadOp9d), |
| TEST(lineOp9d), |
| TEST(cubicOp8d), |
| TEST(cubicOp7d), |
| TEST(cubicOp6d), |
| TEST(cubicOp5d), |
| TEST(cubicOp3d), |
| TEST(cubicOp2d), |
| TEST(cubicOp1d), |
| }; |
| |
| static const size_t testCount = SK_ARRAY_COUNT(tests); |
| |
| static struct TestDesc subTests[] = { |
| TEST(cubicOp6d), |
| TEST(cubicOp8d), |
| TEST(cubicOp70d), |
| TEST(cubicOp16d), |
| TEST(skp5), |
| }; |
| |
| static const size_t subTestCount = SK_ARRAY_COUNT(subTests); |
| |
| static void (*firstSubTest)(skiatest::Reporter* ) = 0; |
| |
| static bool runSubTestsFirst = false; |
| static bool runReverse = false; |
| static void (*stopTest)(skiatest::Reporter* ) = 0; |
| |
| static void PathOpsOpTest(skiatest::Reporter* reporter) { |
| #ifdef SK_DEBUG |
| gDebugMaxWindSum = 4; |
| gDebugMaxWindValue = 4; |
| #endif |
| #if DEBUG_SHOW_TEST_NAME |
| strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); |
| #endif |
| if (runSubTestsFirst) { |
| RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, runReverse); |
| } |
| RunTestSet(reporter, tests, testCount, firstTest, stopTest, runReverse); |
| if (!runSubTestsFirst) { |
| RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, runReverse); |
| } |
| #ifdef SK_DEBUG |
| gDebugMaxWindSum = SK_MaxS32; |
| gDebugMaxWindValue = SK_MaxS32; |
| #endif |
| } |
| |
| #include "TestClassDef.h" |
| DEFINE_TESTCLASS_SHORT(PathOpsOpTest) |