• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2013 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 #include "include/core/SkPath.h"
8 #include "include/core/SkPathTypes.h"
9 #include "include/core/SkString.h"
10 #include "include/pathops/SkPathOps.h"
11 #include "tests/PathOpsExtendedTest.h"
12 #include "tests/Test.h"
13 
DEF_TEST(PathOpsInverse,reporter)14 DEF_TEST(PathOpsInverse, reporter) {
15     const SkPathDirection dirs[] = {SkPathDirection::kCW, SkPathDirection::kCCW};
16     const SkPathFillType fts[] = {
17         SkPathFillType::kWinding,        SkPathFillType::kEvenOdd,
18         SkPathFillType::kInverseWinding, SkPathFillType::kInverseEvenOdd
19     };
20     SkPath one, two;
21     int testCount = 0;
22     for (int op = kDifference_SkPathOp; op <= kReverseDifference_SkPathOp; ++op) {
23         for (auto oneFill : fts) {
24             for (auto oneDir : dirs) {
25                 one.reset();
26                 one.setFillType(oneFill);
27                 one.addRect(0, 0, 6, 6, oneDir);
28                 for (auto twoFill : fts) {
29                     for (auto twoDir : dirs) {
30                         two.reset();
31                         two.setFillType(twoFill);
32                         two.addRect(3, 3, 9, 9, twoDir);
33                         SkString testName;
34                         testName.printf("inverseTest%d", ++testCount);
35                         testPathOp(reporter, one, two, (SkPathOp) op, testName.c_str());
36                     }
37                 }
38             }
39         }
40     }
41 }
42