| /* |
| * 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 "include/core/SkPath.h" |
| #include "include/core/SkPathTypes.h" |
| #include "include/core/SkPoint.h" |
| #include "include/core/SkRect.h" |
| #include "include/core/SkScalar.h" |
| #include "include/core/SkString.h" |
| #include "include/core/SkTypes.h" |
| #include "include/pathops/SkPathOps.h" |
| #include "include/private/base/SkDebug.h" |
| #include "include/private/base/SkFloatBits.h" |
| #include "include/utils/SkParsePath.h" |
| #include "src/core/SkGeometry.h" |
| #include "src/pathops/SkPathOpsCubic.h" |
| #include "src/pathops/SkPathOpsPoint.h" |
| #include "src/pathops/SkPathOpsQuad.h" |
| #include "tests/PathOpsDebug.h" |
| #include "tests/PathOpsExtendedTest.h" |
| #include "tests/PathOpsTestCommon.h" |
| #include "tests/Test.h" |
| |
| #include <cstddef> |
| #include <iterator> |
| |
| class PathTest_Private { |
| public: |
| PathTest_Private(SkPath* path) |
| : fPath(path) {} |
| |
| void setPt(int index, SkScalar x, SkScalar y) { |
| fPath->setPt(index, x, y); |
| } |
| |
| SkPath* fPath; |
| }; |
| |
| static void path_edit(const SkPoint& from, const SkPoint& to, SkPath* path) { |
| PathTest_Private testPath(path); |
| for (int index = 0; index < path->countPoints(); ++index) { |
| if (SkDPoint::ApproximatelyEqual(path->getPoint(index), from)) { |
| testPath.setPt(index, to.fX, to.fY); |
| return; |
| } |
| } |
| } |
| |
| static void cubicOp1d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(0,2, 1,0, 1,0); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,1, 1,0, 2,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp2d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,2); |
| path.cubicTo(0,1, 1,0, 1,0); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,1, 2,0, 1,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp3d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(2,3, 1,0, 1,0); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,1, 1,0, 3,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp5d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(0,2, 1,0, 2,0); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,2, 1,0, 2,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp6d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(0,6, 1,0, 3,0); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,3, 1,0, 6,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp7d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(3,4, 1,0, 3,0); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,3, 1,0, 4,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp8d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(0,5, 1,0, 4,0); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,4, 1,0, 5,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp9d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(1,6, 1,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(1,2, 1,0, 6,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void quadOp9d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.quadTo(1,6, 1.5f,1); |
| path.quadTo(1.5f,0.5f, 2,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| 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_SkPathOp, filename); |
| } |
| |
| static void lineOp9d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| 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(SkPathFillType::kWinding); |
| 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_SkPathOp, filename); |
| } |
| |
| static void cubicOp1i(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(1,2, 1,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(1,2, 1,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void cubicOp10d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(1,3, 1,0, 4,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(1,4, 1,0, 3,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp11d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(3,4, 1,0, 5,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(1,5, 1,0, 4,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp12d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(1,6, 1,0, 1,0); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(0,1, 1,0, 6,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp13d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(4,5, 1,0, 5,3); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(3,5, 1,0, 5,4); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp14d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(0,2, 2,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,2); |
| pathB.cubicTo(1,2, 1,0, 2,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp15d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(3,6, 2,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,2); |
| pathB.cubicTo(1,2, 1,0, 6,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp16d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,2); |
| path.cubicTo(0,1, 3,0, 1,0); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,3); |
| pathB.cubicTo(0,1, 2,0, 1,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp17d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,2); |
| path.cubicTo(0,2, 4,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,4); |
| pathB.cubicTo(1,2, 2,0, 2,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp18d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(3,5, 2,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,2); |
| pathB.cubicTo(1,2, 1,0, 5,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp19i(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,2); |
| path.cubicTo(0,1, 2,1, 6,2); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(1,2); |
| pathB.cubicTo(2,6, 2,0, 1,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void cubicOp20d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(0,1, 6,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,6); |
| pathB.cubicTo(1,2, 1,0, 1,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp21d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(0,1, 2,1, 6,5); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(1,2); |
| pathB.cubicTo(5,6, 1,0, 1,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp22d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(2,3, 3,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,3); |
| pathB.cubicTo(1,2, 1,0, 3,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp23d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(1,2, 4,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,4); |
| pathB.cubicTo(1,2, 1,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp24d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(1,2, 2,0, 3,2); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,2); |
| pathB.cubicTo(2,3, 1,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void testIntersect1(skiatest::Reporter* reporter, const char* filename) { |
| SkPath one, two; |
| one.addRect(0, 0, 6, 6, SkPathDirection::kCW); |
| two.addRect(3, 3, 9, 9, SkPathDirection::kCW); |
| testPathOp(reporter, one, two, kIntersect_SkPathOp, filename); |
| } |
| |
| static void testUnion1(skiatest::Reporter* reporter, const char* filename) { |
| SkPath one, two; |
| one.addRect(0, 0, 6, 6, SkPathDirection::kCW); |
| two.addRect(3, 3, 9, 9, SkPathDirection::kCW); |
| testPathOp(reporter, one, two, kUnion_SkPathOp, filename); |
| } |
| |
| static void testDiff1(skiatest::Reporter* reporter, const char* filename) { |
| SkPath one, two; |
| one.addRect(0, 0, 6, 6, SkPathDirection::kCW); |
| two.addRect(3, 3, 9, 9, SkPathDirection::kCW); |
| testPathOp(reporter, one, two, kDifference_SkPathOp, filename); |
| } |
| |
| static void testXor1(skiatest::Reporter* reporter, const char* filename) { |
| SkPath one, two; |
| one.addRect(0, 0, 6, 6, SkPathDirection::kCW); |
| two.addRect(3, 3, 9, 9, SkPathDirection::kCW); |
| testPathOp(reporter, one, two, kXOR_SkPathOp, filename); |
| } |
| |
| static void testIntersect2(skiatest::Reporter* reporter, const char* filename) { |
| SkPath one, two; |
| one.addRect(0, 0, 6, 6, SkPathDirection::kCW); |
| two.addRect(0, 3, 9, 9, SkPathDirection::kCW); |
| testPathOp(reporter, one, two, kIntersect_SkPathOp, filename); |
| } |
| |
| static void testUnion2(skiatest::Reporter* reporter, const char* filename) { |
| SkPath one, two; |
| one.addRect(0, 0, 6, 6, SkPathDirection::kCW); |
| two.addRect(0, 3, 9, 9, SkPathDirection::kCW); |
| testPathOp(reporter, one, two, kUnion_SkPathOp, filename); |
| } |
| |
| static void testDiff2(skiatest::Reporter* reporter, const char* filename) { |
| SkPath one, two; |
| one.addRect(0, 0, 6, 6, SkPathDirection::kCW); |
| two.addRect(0, 3, 9, 9, SkPathDirection::kCW); |
| testPathOp(reporter, one, two, kDifference_SkPathOp, filename); |
| } |
| |
| static void testXor2(skiatest::Reporter* reporter, const char* filename) { |
| SkPath one, two; |
| one.addRect(0, 0, 6, 6, SkPathDirection::kCW); |
| two.addRect(0, 3, 9, 9, SkPathDirection::kCW); |
| testPathOp(reporter, one, two, kXOR_SkPathOp, filename); |
| } |
| |
| static void testOp1d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| path.addRect(0, 0, 2, 2, SkPathDirection::kCW); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void testOp2d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| path.addRect(0, 0, 2, 2, SkPathDirection::kCW); |
| pathB.setFillType(SkPathFillType::kEvenOdd); |
| pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void testOp3d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| path.addRect(1, 1, 2, 2, SkPathDirection::kCW); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void testOp1u(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| path.addRect(0, 0, 3, 3, SkPathDirection::kCW); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename); |
| } |
| |
| static void testOp4d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| path.addRect(2, 2, 4, 4, SkPathDirection::kCW); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void testOp5d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| path.addRect(0, 0, 2, 2, SkPathDirection::kCW); |
| path.addRect(0, 0, 3, 3, SkPathDirection::kCW); |
| pathB.setFillType(SkPathFillType::kEvenOdd); |
| pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void testOp6d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| path.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| path.addRect(0, 0, 3, 3, SkPathDirection::kCW); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void testOp7d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| path.addRect(0, 0, 2, 2, SkPathDirection::kCW); |
| path.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| pathB.setFillType(SkPathFillType::kEvenOdd); |
| pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void testOp2u(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| path.addRect(0, 0, 2, 2, SkPathDirection::kCW); |
| path.addRect(0, 0, 2, 2, SkPathDirection::kCW); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.addRect(0, 0, 3, 3, SkPathDirection::kCW); |
| pathB.addRect(1, 1, 2, 2, SkPathDirection::kCW); |
| testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename); |
| } |
| |
| static void testOp8d(skiatest::Reporter* reporter, const char* filename) { |
| 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_SkPathOp, filename); |
| } |
| static void cubicOp25i(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(2,4, 5,0, 3,2); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,5); |
| pathB.cubicTo(2,3, 1,0, 4,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void cubicOp26d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(3,4, 4,0, 3,2); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,4); |
| pathB.cubicTo(2,3, 1,0, 4,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp27d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(3,6, 1,0, 5,2); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(2,5, 1,0, 6,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp28u(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(1,4, 6,0, 3,2); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,6); |
| pathB.cubicTo(2,3, 1,0, 4,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename); |
| } |
| |
| static void cubicOp29d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(2,5, 6,0, 4,2); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,6); |
| pathB.cubicTo(2,4, 1,0, 5,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp30d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(2,5, 6,0, 5,3); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,6); |
| pathB.cubicTo(3,5, 1,0, 5,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp31d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,2); |
| path.cubicTo(0,3, 2,1, 4,0); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(1,2); |
| pathB.cubicTo(0,4, 2,0, 3,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp31u(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,2); |
| path.cubicTo(0,3, 2,1, 4,0); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(1,2); |
| pathB.cubicTo(0,4, 2,0, 3,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename); |
| } |
| |
| static void cubicOp31x(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,2); |
| path.cubicTo(0,3, 2,1, 4,0); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(1,2); |
| pathB.cubicTo(0,4, 2,0, 3,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kXOR_SkPathOp, filename); |
| } |
| |
| static void cubicOp32d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(1,2, 6,0, 3,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,6); |
| pathB.cubicTo(1,3, 1,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp33i(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(1,2, 6,0, 3,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,6); |
| pathB.cubicTo(1,3, 1,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void cubicOp34d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(3,5, 2,1, 3,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(1,2); |
| pathB.cubicTo(1,3, 1,0, 5,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp35d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(1,5, 2,1, 4,0); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(1,2); |
| pathB.cubicTo(0,4, 1,0, 5,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp36u(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(1,6, 2,0, 5,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,2); |
| pathB.cubicTo(1,5, 1,0, 6,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename); |
| } |
| |
| static void cubicOp37d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(2,6, 6,1, 4,3); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(1,6); |
| pathB.cubicTo(3,4, 1,0, 6,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp38d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(0,6, 3,2, 4,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(2,3); |
| pathB.cubicTo(1,4, 1,0, 6,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp39d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(2,3, 5,1, 4,3); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(1,5); |
| pathB.cubicTo(3,4, 1,0, 3,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp40d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(1,5, 3,2, 4,2); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(2,3); |
| pathB.cubicTo(2,4, 1,0, 5,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp41i(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(2,6, 4,3, 6,4); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(3,4); |
| pathB.cubicTo(4,6, 1,0, 6,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void cubicOp42d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(1,2, 6,5, 5,4); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(5,6); |
| pathB.cubicTo(4,5, 1,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp43d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,2); |
| path.cubicTo(1,2, 4,0, 3,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,4); |
| pathB.cubicTo(1,3, 2,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp44d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,2); |
| path.cubicTo(3,6, 4,0, 3,2); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,4); |
| pathB.cubicTo(2,3, 2,0, 6,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp45d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,2); |
| path.cubicTo(2,4, 4,0, 3,2); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,4); |
| pathB.cubicTo(2,3, 2,0, 4,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp46d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,2); |
| path.cubicTo(3,5, 5,0, 4,2); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,5); |
| pathB.cubicTo(2,4, 2,0, 5,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp47d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(1,6, 6,2, 5,4); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(2,6); |
| pathB.cubicTo(4,5, 1,0, 6,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp48d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,2); |
| path.cubicTo(2,3, 5,1, 3,2); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(1,5); |
| pathB.cubicTo(2,3, 2,0, 3,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp49d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,2); |
| path.cubicTo(1,5, 3,2, 4,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(2,3); |
| pathB.cubicTo(1,4, 2,0, 5,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp50d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,3); |
| path.cubicTo(1,6, 5,0, 5,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,5); |
| pathB.cubicTo(1,5, 3,0, 6,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp51d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,3); |
| path.cubicTo(1,2, 4,1, 6,0); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(1,4); |
| pathB.cubicTo(0,6, 3,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp52d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,2); |
| path.cubicTo(1,2, 5,4, 4,3); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(4,5); |
| pathB.cubicTo(3,4, 2,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp53d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,3); |
| path.cubicTo(1,2, 5,3, 2,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(3,5); |
| pathB.cubicTo(1,2, 3,0, 2,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp54d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,4); |
| path.cubicTo(1,3, 5,4, 4,2); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(4,5); |
| pathB.cubicTo(2,4, 4,0, 3,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp55d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,5); |
| path.cubicTo(1,3, 3,2, 5,0); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(2,3); |
| pathB.cubicTo(0,5, 5,0, 3,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp56d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(2,6, 5,0, 2,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,5); |
| pathB.cubicTo(1,2, 1,0, 6,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp57d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,5); |
| path.cubicTo(0,5, 5,4, 6,4); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(4,5); |
| pathB.cubicTo(4,6, 5,0, 5,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp58d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,5); |
| path.cubicTo(3,4, 6,5, 5,3); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(5,6); |
| pathB.cubicTo(3,5, 5,0, 4,3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp59d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(5,6, 4,0, 4,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,4); |
| pathB.cubicTo(1,4, 1,0, 6,5); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp60d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,2); |
| path.cubicTo(4,6, 6,0, 5,2); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,6); |
| pathB.cubicTo(2,5, 2,0, 6,4); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp61d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(1,2); |
| path.cubicTo(0,5, 3,2, 6,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(2,3); |
| pathB.cubicTo(1,6, 2,1, 5,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp62d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(1,3); |
| path.cubicTo(5,6, 5,3, 5,4); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(3,5); |
| pathB.cubicTo(4,5, 3,1, 6,5); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp63d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(2,3); |
| path.cubicTo(0,4, 3,2, 5,3); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(2,3); |
| pathB.cubicTo(3,5, 3,2, 4,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp64d(skiatest::Reporter* reporter, const char* filename) { |
| 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_SkPathOp, filename); |
| } |
| |
| static void cubicOp65d(skiatest::Reporter* reporter, const char* filename) { |
| 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_SkPathOp, filename); |
| } |
| |
| static void rectOp1d(skiatest::Reporter* reporter, const char* filename) { |
| 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_SkPathOp, filename); |
| } |
| |
| static void cubicOp66u(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(2,6, 4,2, 5,3); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(2,4); |
| pathB.cubicTo(3,5, 1,0, 6,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename); |
| } |
| |
| static void cubicOp67u(skiatest::Reporter* reporter, const char* filename) { |
| 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_SkPathOp, filename); |
| } |
| |
| static void cubicOp68u(skiatest::Reporter* reporter, const char* filename) { |
| 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_SkPathOp, filename); |
| } |
| |
| static void cubicOp69d(skiatest::Reporter* reporter, const char* filename) { |
| 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_SkPathOp, filename); |
| } |
| |
| SkPathOp ops[] = { |
| kUnion_SkPathOp, |
| kXOR_SkPathOp, |
| kReverseDifference_SkPathOp, |
| kXOR_SkPathOp, |
| kReverseDifference_SkPathOp, |
| }; |
| |
| static void rRect1(skiatest::Reporter* reporter, const char* filename) { |
| SkScalar xA = 0.65f; |
| SkScalar xB = 10.65f; |
| SkScalar xC = 20.65f; |
| SkScalar xD = 30.65f; |
| SkScalar xE = 40.65f; |
| SkScalar xF = 50.65f; |
| |
| SkScalar yA = 0.65f; |
| SkScalar yB = 10.65f; |
| SkScalar yC = 20.65f; |
| SkScalar yD = 30.65f; |
| SkScalar yE = 40.65f; |
| SkScalar yF = 50.65f; |
| SkPath paths[5]; |
| SkRect rects[5]; |
| rects[0].setLTRB(xB, yB, xE, yE); |
| paths[0].addRoundRect(rects[0], SkIntToScalar(5), SkIntToScalar(5)); // red |
| rects[1].setLTRB(xA, yA, xD, yD); |
| paths[1].addRoundRect(rects[1], SkIntToScalar(5), SkIntToScalar(5)); // green |
| rects[2].setLTRB(xC, yA, xF, yD); |
| paths[2].addRoundRect(rects[2], SkIntToScalar(5), SkIntToScalar(5)); // blue |
| rects[3].setLTRB(xA, yC, xD, yF); |
| paths[3].addRoundRect(rects[3], SkIntToScalar(5), SkIntToScalar(5)); // yellow |
| rects[4].setLTRB(xC, yC, xF, yF); |
| paths[4].addRoundRect(rects[4], SkIntToScalar(5), SkIntToScalar(5)); // cyan |
| SkPath path; |
| path.setFillType(SkPathFillType::kInverseEvenOdd); |
| for (int index = 0; index < 5; ++index) { |
| SkString uniqueName; |
| uniqueName.printf("%s%d", filename, index); |
| testPathOp(reporter, path, paths[index], ops[index], uniqueName.c_str()); |
| REPORTER_ASSERT(reporter, Op(path, paths[index], ops[index], &path)); |
| } |
| } |
| |
| static void skp1(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| 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(SkPathFillType::kWinding); |
| 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_SkPathOp, filename); |
| } |
| |
| static void skp2(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| 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(SkPathFillType::kWinding); |
| 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_SkPathOp, filename); |
| } |
| |
| static void skp3(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| 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(SkPathFillType::kWinding); |
| 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_SkPathOp, filename); |
| } |
| |
| static void skp4(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| 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(SkPathFillType::kWinding); |
| 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_SkPathOp, filename); |
| } |
| |
| static void skp5(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| 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(SkPathFillType::kInverseWinding); |
| 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_SkPathOp, filename); |
| } |
| |
| static void cubicOp70d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(0,5, 4,0, 5,0); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,4); |
| pathB.cubicTo(0,5, 1,0, 5,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp71d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(0,5, 4,1, 6,4); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(1,4); |
| pathB.cubicTo(4,6, 1,0, 5,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp72i(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(0,5, 5,2, 5,4); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(2,5); |
| pathB.cubicTo(4,5, 1,0, 5,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void cubicOp73d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(3,4, 4,0, 6,4); |
| path.lineTo(0,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,4); |
| pathB.cubicTo(4,6, 1,0, 4,3); |
| pathB.lineTo(0,4); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp74d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(1,5, 5,1, 5,1); |
| path.lineTo(0,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(1,5); |
| pathB.cubicTo(1,5, 1,0, 5,1); |
| pathB.lineTo(1,5); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp75d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(0,4, 5,1, 6,4); |
| path.lineTo(0,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(1,5); |
| pathB.cubicTo(4,6, 1,0, 4,0); |
| pathB.lineTo(1,5); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp76u(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(0,2, 2,0, 5,3); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,2); |
| pathB.cubicTo(3,5, 1,0, 2,0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename); |
| } |
| |
| static void cubicOp77i(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| path.moveTo(0,1); |
| path.cubicTo(1,3, 2,0, 3,2); |
| path.lineTo(0,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kEvenOdd); |
| pathB.moveTo(0,2); |
| pathB.cubicTo(2,3, 1,0, 3,1); |
| pathB.lineTo(0,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void cubicOp78u(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| path.moveTo(1,6); |
| path.cubicTo(1,6, 5,0, 6,1); |
| path.lineTo(1,6); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kEvenOdd); |
| pathB.moveTo(0,5); |
| pathB.cubicTo(1,6, 6,1, 6,1); |
| pathB.lineTo(0,5); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename); |
| } |
| |
| static void cubicOp79u(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(1,3, 1,0, 6,4); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(4,6, 1,0, 3,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void cubicOp80i(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(2,3, 2,1, 4,3); |
| path.lineTo(0,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(1,2); |
| pathB.cubicTo(3,4, 1,0, 3,2); |
| pathB.lineTo(1,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void cubicOp81d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(4,6, 4,3, 5,4); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(3,4); |
| pathB.cubicTo(4,5, 1,0, 6,4); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void cubicOp82i(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| path.moveTo(0,1); |
| path.cubicTo(2,3, 5,2, 3,0); |
| path.lineTo(0,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(2,5); |
| pathB.cubicTo(0,3, 1,0, 3,2); |
| pathB.lineTo(2,5); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void cubicOp83i(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(0,3, 2,1, 4,1); |
| path.lineTo(0,1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(1,2); |
| pathB.cubicTo(1,4, 1,0, 3,0); |
| pathB.lineTo(1,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void cubicOp84d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,4); |
| path.cubicTo(2,3, 6,3, 3,2); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(3,6); |
| pathB.cubicTo(2,3, 4,0, 3,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void skpClip1(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| 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(SkPathFillType::kWinding); |
| 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_SkPathOp, filename); |
| } |
| |
| static void skpClip2(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| 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(SkPathFillType::kInverseWinding); |
| 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_SkPathOp, filename); |
| } |
| |
| static void skp96prezzi1(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| 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(SkPathFillType::kWinding); |
| 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_SkPathOp, filename); |
| } |
| |
| static void skpancestry_com1(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| 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(SkPathFillType::kEvenOdd); |
| 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_SkPathOp, filename); |
| } |
| |
| static void skpeldorado_com_ua1(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| 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(SkPathFillType::kWinding); |
| 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_SkPathOp, filename); |
| } |
| |
| static void skpbyte_com1(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| 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(SkPathFillType::kInverseWinding); |
| 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_SkPathOp, filename); |
| } |
| |
| static void skphealth_com76(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| 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(SkPathFillType::kWinding); |
| pathB.moveTo(704.000000f, 3.00000000f); |
| pathB.lineTo(704.000000f, 33.0000000f); |
| pathB.lineTo(705.000000f, 33.0000000f); |
| pathB.lineTo(719.500000f, 3.00000000f); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void skpahrefs_com88(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| 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(SkPathFillType::kWinding); |
| 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_SkPathOp, filename); |
| } |
| |
| static void skpahrefs_com29(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| 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(SkPathFillType::kWinding); |
| 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_SkPathOp, filename); |
| } |
| |
| static void cubicOp85d(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(1,6, 1,0, 6,2); |
| path.close(); |
| SkPath pathB; |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,1); |
| pathB.cubicTo(2,6, 1,0, 6,1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
| } |
| |
| static void skpkkiste_to98(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| 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(SkPathFillType::kWinding); |
| 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_SkPathOp, filename); |
| } |
| |
| static void issue1417(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path1; |
| path1.moveTo(122.58908843994140625f, 82.2836456298828125f); |
| path1.quadTo(129.8215789794921875f, 80, 138, 80); |
| path1.quadTo(147.15692138671875f, 80, 155.1280364990234375f, 82.86279296875f); |
| path1.lineTo(161.1764678955078125f, 100); |
| path1.lineTo(161.1764678955078125f, 100); |
| path1.lineTo(115.29412078857421875f, 100); |
| path1.lineTo(115.29412078857421875f, 100); |
| path1.lineTo(122.58908843994140625f, 82.2836456298828125f); |
| path1.lineTo(122.58908843994140625f, 82.2836456298828125f); |
| path1.close(); |
| path1.moveTo(98.68194580078125f, 140.343841552734375f); |
| path1.lineTo(115.29412078857421875f, 100); |
| path1.lineTo(115.29412078857421875f, 100); |
| path1.lineTo(97.9337615966796875f, 100); |
| path1.lineTo(97.9337615966796875f, 100); |
| path1.quadTo(88, 112.94264984130859375f, 88, 130); |
| path1.quadTo(88, 131.544830322265625f, 88.08148956298828125f, 133.0560302734375f); |
| path1.lineTo(98.68194580078125f, 140.343841552734375f); |
| path1.lineTo(98.68194580078125f, 140.343841552734375f); |
| path1.close(); |
| path1.moveTo(136.969696044921875f, 166.6666717529296875f); |
| path1.lineTo(98.68194580078125f, 140.343841552734375f); |
| path1.lineTo(98.68194580078125f, 140.343841552734375f); |
| path1.lineTo(93.45894622802734375f, 153.02825927734375f); |
| path1.lineTo(93.45894622802734375f, 153.02825927734375f); |
| path1.quadTo(96.94116973876953125f, 159.65185546875f, 102.64466094970703125f, 165.3553466796875f); |
| path1.quadTo(110.7924652099609375f, 173.503143310546875f, 120.8179779052734375f, 177.1177825927734375f); |
| path1.lineTo(136.969696044921875f, 166.6666717529296875f); |
| path1.lineTo(136.969696044921875f, 166.6666717529296875f); |
| path1.close(); |
| path1.moveTo(175.8309783935546875f, 141.5211334228515625f); |
| path1.lineTo(136.969696044921875f, 166.6666717529296875f); |
| path1.lineTo(136.969696044921875f, 166.6666717529296875f); |
| path1.lineTo(153.15728759765625f, 177.7956390380859375f); |
| path1.lineTo(153.15728759765625f, 177.7956390380859375f); |
| path1.quadTo(164.392425537109375f, 174.318267822265625f, 173.3553466796875f, 165.3553466796875f); |
| path1.quadTo(177.805816650390625f, 160.9048614501953125f, 180.90380859375f, 155.8941650390625f); |
| path1.lineTo(175.8309783935546875f, 141.5211334228515625f); |
| path1.lineTo(175.8309783935546875f, 141.5211334228515625f); |
| path1.close(); |
| path1.moveTo(175.8309783935546875f, 141.5211334228515625f); |
| path1.lineTo(187.8782806396484375f, 133.7258148193359375f); |
| path1.lineTo(187.8782806396484375f, 133.7258148193359375f); |
| path1.quadTo(188, 131.8880615234375f, 188, 130); |
| path1.quadTo(188, 112.942657470703125f, 178.0662384033203125f, 100); |
| path1.lineTo(161.1764678955078125f, 100); |
| path1.lineTo(161.1764678955078125f, 100); |
| path1.lineTo(175.8309783935546875f, 141.5211334228515625f); |
| path1.lineTo(175.8309783935546875f, 141.5211334228515625f); |
| path1.close(); |
| |
| SkPath path2; |
| path2.moveTo(174.117645263671875f, 100); |
| path2.lineTo(161.1764678955078125f, 100); |
| path2.lineTo(161.1764678955078125f, 100); |
| path2.lineTo(155.1280364990234375f, 82.86279296875f); |
| path2.lineTo(155.1280364990234375f, 82.86279296875f); |
| path2.quadTo(153.14971923828125f, 82.15229034423828125f, 151.098419189453125f, 81.618133544921875f); |
| path2.lineTo(143.5294189453125f, 100); |
| path2.lineTo(143.5294189453125f, 100); |
| path2.lineTo(161.1764678955078125f, 100); |
| path2.lineTo(161.1764678955078125f, 100); |
| path2.lineTo(168.23529052734375f, 120); |
| path2.lineTo(168.23529052734375f, 120); |
| path2.lineTo(181.1764678955078125f, 120); |
| path2.lineTo(181.1764678955078125f, 120); |
| path2.lineTo(186.3661956787109375f, 134.7042236328125f); |
| path2.lineTo(186.3661956787109375f, 134.7042236328125f); |
| path2.lineTo(187.8782806396484375f, 133.7258148193359375f); |
| path2.lineTo(187.8782806396484375f, 133.7258148193359375f); |
| path2.quadTo(188, 131.8880615234375f, 188, 130); |
| path2.quadTo(188, 124.80947113037109375f, 187.080169677734375f, 120); |
| path2.lineTo(181.1764678955078125f, 120); |
| path2.lineTo(181.1764678955078125f, 120); |
| path2.lineTo(174.117645263671875f, 100); |
| path2.lineTo(174.117645263671875f, 100); |
| path2.close(); |
| path2.moveTo(88.91983795166015625f, 120); |
| path2.lineTo(107.0588226318359375f, 120); |
| path2.lineTo(107.0588226318359375f, 120); |
| path2.lineTo(98.68194580078125f, 140.343841552734375f); |
| path2.lineTo(98.68194580078125f, 140.343841552734375f); |
| path2.lineTo(88.08148956298828125f, 133.0560302734375f); |
| path2.lineTo(88.08148956298828125f, 133.0560302734375f); |
| path2.quadTo(88, 131.544830322265625f, 88, 130); |
| path2.quadTo(88, 124.80951690673828125f, 88.91983795166015625f, 120); |
| path2.close(); |
| path2.moveTo(96.67621612548828125f, 145.21490478515625f); |
| path2.lineTo(98.68194580078125f, 140.343841552734375f); |
| path2.lineTo(98.68194580078125f, 140.343841552734375f); |
| path2.lineTo(120.68767547607421875f, 155.4727783203125f); |
| path2.lineTo(120.68767547607421875f, 155.4727783203125f); |
| path2.lineTo(118.68194580078125f, 160.343841552734375f); |
| path2.lineTo(118.68194580078125f, 160.343841552734375f); |
| path2.lineTo(96.67621612548828125f, 145.21490478515625f); |
| path2.lineTo(96.67621612548828125f, 145.21490478515625f); |
| path2.close(); |
| path2.moveTo(113.232177734375f, 173.5789947509765625f); |
| path2.quadTo(116.8802642822265625f, 175.69805908203125f, 120.8179779052734375f, 177.1177825927734375f); |
| path2.lineTo(132.2864990234375f, 169.6969757080078125f); |
| path2.lineTo(132.2864990234375f, 169.6969757080078125f); |
| path2.lineTo(118.68194580078125f, 160.343841552734375f); |
| path2.lineTo(118.68194580078125f, 160.343841552734375f); |
| path2.lineTo(113.232177734375f, 173.5789947509765625f); |
| path2.lineTo(113.232177734375f, 173.5789947509765625f); |
| path2.close(); |
| // FIXME : difficult data, circle back later |
| testPathOp(reporter, path1, path2, kUnion_SkPathOp, filename); |
| } |
| |
| static void issue1418(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path1; |
| path1.moveTo(0, 0); |
| path1.lineTo(1, 0); |
| path1.lineTo(1, 0); |
| path1.lineTo(1, 1); |
| path1.lineTo(1, 1); |
| path1.lineTo(0, 1); |
| path1.lineTo(0, 1); |
| path1.lineTo(0, 0); |
| path1.lineTo(0, 0); |
| path1.close(); |
| |
| SkPath path2; |
| path2.moveTo(0.64644664525985717773f, -0.35355341434478759766f); |
| path2.quadTo(0.79289329051971435547f, -0.50000005960464477539f, 1.0000001192092895508f, -0.50000005960464477539f); |
| path2.quadTo(1.2071068286895751953f, -0.50000005960464477539f, 1.3535535335540771484f, -0.35355341434478759766f); |
| path2.quadTo(1.5000001192092895508f, -0.20710679888725280762f, 1.5000001192092895508f, 0); |
| path2.quadTo(1.5000001192092895508f, 0.20710679888725280762f, 1.3535535335540771484f, 0.35355341434478759766f); |
| path2.quadTo(1.2071068286895751953f, 0.50000005960464477539f, 1.0000001192092895508f, 0.50000005960464477539f); |
| path2.quadTo(0.79289329051971435547f, 0.50000005960464477539f, 0.64644664525985717773f, 0.35355341434478759766f); |
| path2.quadTo(0.50000005960464477539f, 0.20710679888725280762f, 0.50000005960464477539f, 0); |
| path2.quadTo(0.50000005960464477539f, -0.20710679888725280762f, 0.64644664525985717773f, -0.35355341434478759766f); |
| testPathOp(reporter, path1, path2, kIntersect_SkPathOp, filename); |
| } |
| |
| static void cubicOp85i(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(3, 4); |
| path.cubicTo(1, 5, 4, 3, 6, 4); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(3, 4); |
| pathB.cubicTo(4, 6, 4, 3, 5, 1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void issue1418b(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path1; |
| path1.moveTo(0, 0); |
| path1.lineTo(1, 0); |
| path1.lineTo(1, 1); |
| path1.lineTo(0, 1); |
| path1.lineTo(0, 0); |
| path1.close(); |
| path1.setFillType(SkPathFillType::kWinding); |
| SkPath path2; |
| path2.moveTo(0.646446645f, -0.353553414f); |
| path2.quadTo(0.792893291f, -0.50000006f, 1.00000012f, -0.50000006f); |
| path2.quadTo(1.20710683f, -0.50000006f, 1.35355353f, -0.353553414f); |
| path2.quadTo(1.50000012f, -0.207106799f, 1.50000012f, 0); |
| path2.quadTo(1.50000012f, 0.207106799f, 1.35355353f, 0.353553414f); |
| path2.quadTo(1.20710683f, 0.50000006f, 1.00000012f, 0.50000006f); |
| path2.quadTo(0.792893291f, 0.50000006f, 0.646446645f, 0.353553414f); |
| path2.quadTo(0.50000006f, 0.207106799f, 0.50000006f, 0); |
| path2.quadTo(0.50000006f, -0.207106799f, 0.646446645f, -0.353553414f); |
| path2.close(); |
| path2.moveTo(1.00000012f, 0.50000006f); |
| path2.lineTo(1.00000012f, 1.00000012f); |
| path2.lineTo(0.50000006f, 1.00000012f); |
| path2.quadTo(0.50000006f, 0.792893291f, 0.646446645f, 0.646446645f); |
| path2.quadTo(0.792893291f, 0.50000006f, 1.00000012f, 0.50000006f); |
| path2.close(); |
| path2.setFillType(SkPathFillType::kEvenOdd); |
| testPathOp(reporter, path1, path2, kIntersect_SkPathOp, filename); |
| } |
| |
| static void rectOp1i(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| path.addRect(2, 2, 4, 4, SkPathDirection::kCW); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| pathB.addRect(0, 0, 2, 2, SkPathDirection::kCW); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void rectOp2i(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| path.addRect(0, 0, 1, 1, SkPathDirection::kCW); |
| path.addRect(0, 0, 3, 3, SkPathDirection::kCW); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.addRect(0, 0, 2, 2, SkPathDirection::kCW); |
| pathB.addRect(0, 0, 2, 2, SkPathDirection::kCW); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void rectOp3x(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| path.moveTo(0, 0); |
| path.lineTo(3, 0); |
| path.lineTo(3, 3); |
| path.lineTo(0, 3); |
| path.close(); |
| path.moveTo(2, 2); |
| path.lineTo(3, 2); |
| path.lineTo(3, 3); |
| path.lineTo(2, 3); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(1, 1); |
| pathB.lineTo(3, 1); |
| pathB.lineTo(3, 3); |
| pathB.lineTo(1, 3); |
| pathB.close(); |
| pathB.moveTo(2, 2); |
| pathB.lineTo(3, 2); |
| pathB.lineTo(3, 3); |
| pathB.lineTo(2, 3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kXOR_SkPathOp, filename); |
| } |
| |
| static void issue1435(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path1; |
| path1.moveTo(160, 60); |
| path1.lineTo(220, 230); |
| path1.lineTo(60, 120); |
| path1.lineTo(260, 120); |
| path1.lineTo(90, 230); |
| path1.lineTo(160, 60); |
| path1.close(); |
| path1.setFillType(SkPathFillType::kEvenOdd); |
| |
| SkPath path2; |
| path2.moveTo(142.589081f, 102.283646f); |
| path2.quadTo(149.821579f, 100, 158, 100); |
| path2.quadTo(167.156921f, 100, 175.128036f, 102.862793f); |
| path2.lineTo(181.176468f, 120); |
| path2.lineTo(135.294128f, 120); |
| path2.lineTo(142.589081f, 102.283646f); |
| path2.close(); |
| path2.moveTo(118.681946f, 160.343842f); |
| path2.lineTo(135.294128f, 120); |
| path2.lineTo(117.933762f, 120); |
| path2.quadTo(108, 132.942657f, 108, 150); |
| path2.quadTo(108, 151.54483f, 108.08149f, 153.05603f); |
| path2.lineTo(118.681946f, 160.343842f); |
| path2.close(); |
| path2.moveTo(156.969696f, 186.666672f); |
| path2.lineTo(118.681946f, 160.343842f); |
| path2.lineTo(113.458946f, 173.028259f); |
| path2.quadTo(116.94117f, 179.651855f, 122.644661f, 185.355347f); |
| path2.quadTo(130.792465f, 193.503143f, 140.817978f, 197.117783f); |
| path2.lineTo(156.969696f, 186.666672f); |
| path2.close(); |
| path2.moveTo(195.830978f, 161.521133f); |
| path2.lineTo(156.969696f, 186.666672f); |
| path2.lineTo(173.157288f, 197.795639f); |
| path2.quadTo(184.392426f, 194.318268f, 193.355347f, 185.355347f); |
| path2.quadTo(197.805817f, 180.904861f, 200.903809f, 175.894165f); |
| path2.lineTo(195.830978f, 161.521133f); |
| path2.close(); |
| path2.moveTo(195.830978f, 161.521133f); |
| path2.lineTo(207.878281f, 153.725815f); |
| path2.quadTo(208, 151.888062f, 208, 150); |
| path2.quadTo(208, 132.942657f, 198.066238f, 120); |
| path2.lineTo(181.176468f, 120); |
| path2.lineTo(195.830978f, 161.521133f); |
| path2.close(); |
| path2.setFillType(SkPathFillType::kEvenOdd); |
| testPathOp(reporter, path1, path2, kIntersect_SkPathOp, filename); |
| } |
| |
| static void skpkkiste_to716(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| path.moveTo(1173, 284); |
| path.cubicTo(1173, 285.125824f, 1173.37207f, 286.164734f, 1174, 287.000488f); |
| path.lineTo(1174, 123.999496f); |
| path.cubicTo(1173.37207f, 124.835243f, 1173, 125.874168f, 1173, 127); |
| path.lineTo(1173, 284); |
| path.close(); |
| SkPath pathB; |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(1340, 122); |
| pathB.cubicTo(1342.76147f, 122, 1345, 124.238579f, 1345, 127); |
| pathB.lineTo(1345, 284); |
| pathB.cubicTo(1345, 286.761414f, 1342.76147f, 289, 1340, 289); |
| pathB.lineTo(1178, 289); |
| pathB.cubicTo(1175.23853f, 289, 1173, 286.761414f, 1173, 284); |
| pathB.lineTo(1173, 127); |
| pathB.cubicTo(1173, 124.238579f, 1175.23853f, 122, 1178, 122); |
| pathB.lineTo(1340, 122); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void loopEdge1(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| path.moveTo(0,0); |
| path.lineTo(3,0); |
| path.lineTo(3,2); |
| path.lineTo(1,2); |
| path.lineTo(1,1); |
| path.lineTo(2,1); |
| path.lineTo(2,3); |
| path.lineTo(0,3); |
| path.close(); |
| SkPath pathB; |
| pathB.setFillType(SkPathFillType::kEvenOdd); |
| pathB.moveTo(1,2); |
| pathB.lineTo(2,2); |
| pathB.lineTo(2,4); |
| pathB.lineTo(1,4); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void loopEdge2(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| path.moveTo(0,0); |
| path.lineTo(3,0); |
| path.lineTo(3,2); |
| path.lineTo(1,2); |
| path.lineTo(1,1); |
| path.lineTo(2,1); |
| path.lineTo(2,3); |
| path.lineTo(0,3); |
| path.close(); |
| SkPath pathB; |
| pathB.setFillType(SkPathFillType::kEvenOdd); |
| pathB.moveTo(1 - 1e-6f,2); |
| pathB.lineTo(2 - 1e-6f,2); |
| pathB.lineTo(2 - 1e-6f,4); |
| pathB.lineTo(1 - 1e-6f,4); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void cubicOp86i(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0, 4); |
| path.cubicTo(3, 4, 6, 2, 5, 2); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kEvenOdd); |
| pathB.moveTo(2, 6); |
| pathB.cubicTo(2, 5, 4, 0, 4, 3); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
| } |
| |
| static void cubicOp87u(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(0,2, 2,0, 6,4); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,2); |
| pathB.cubicTo(4,6, 1,0, 2,0); |
| pathB.close(); |
| markTestFlakyForPathKit(); |
| testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename); |
| } |
| |
| static void cubicOp88u(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0,1); |
| path.cubicTo(2,5, 5,0, 6,4); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0,5); |
| pathB.cubicTo(4,6, 1,0, 5,2); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename); |
| } |
| |
| static void cubicOp89u(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(0, 3); |
| path.cubicTo(1, 6, 5, 0, 6, 3); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(0, 5); |
| pathB.cubicTo(3, 6, 3, 0, 6, 1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename); |
| } |
| |
| static void cubicOp90u(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| path.moveTo(0, 5); |
| path.cubicTo(1, 2, 5, 2, 4, 1); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kEvenOdd); |
| pathB.moveTo(2, 5); |
| pathB.cubicTo(1, 4, 5, 0, 2, 1); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename); |
| } |
| |
| static void cubicOp91u(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path, pathB; |
| path.setFillType(SkPathFillType::kWinding); |
| path.moveTo(1, 6); |
| path.cubicTo(0, 3, 6, 3, 5, 0); |
| path.close(); |
| pathB.setFillType(SkPathFillType::kWinding); |
| pathB.moveTo(3, 6); |
| pathB.cubicTo(0, 5, 6, 1, 3, 0); |
| pathB.close(); |
| testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename); |
| } |
| |
| static void skpaaalgarve_org53(skiatest::Reporter* reporter, const char* filename) { |
| SkPath path; |
| path.setFillType(SkPathFillType::kEvenOdd); |
| path.moveTo(-1.24344979e-014f, 348); |
| path.lineTo(258, 348); |
| path.lineTo(258, 322); |
| path.quadTo(258, 317.857849f, 255.072006f, 314.928009f); |
| path. |