caryclark@google.com | 7dfbb07 | 2013-04-22 14:37:05 +0000 | [diff] [blame] | 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 | */ |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 7 | #include "tests/PathOpsExtendedTest.h" |
caryclark@google.com | 7dfbb07 | 2013-04-22 14:37:05 +0000 | [diff] [blame] | 8 | |
tfarina@chromium.org | 78e7b4e | 2014-01-02 21:45:03 +0000 | [diff] [blame] | 9 | DEF_TEST(PathOpsInverse, reporter) { |
Mike Reed | 30bc527 | 2019-11-22 18:34:02 +0000 | [diff] [blame] | 10 | const SkPathDirection dirs[] = {SkPathDirection::kCW, SkPathDirection::kCCW}; |
Mike Reed | 7d34dc7 | 2019-11-26 12:17:17 -0500 | [diff] [blame] | 11 | const SkPathFillType fts[] = { |
| 12 | SkPathFillType::kWinding, SkPathFillType::kEvenOdd, |
| 13 | SkPathFillType::kInverseWinding, SkPathFillType::kInverseEvenOdd |
| 14 | }; |
caryclark@google.com | 7dfbb07 | 2013-04-22 14:37:05 +0000 | [diff] [blame] | 15 | SkPath one, two; |
Cary Clark | 4533f3d | 2018-08-08 09:48:09 -0400 | [diff] [blame] | 16 | int testCount = 0; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 17 | for (int op = kDifference_SkPathOp; op <= kReverseDifference_SkPathOp; ++op) { |
Mike Reed | 7d34dc7 | 2019-11-26 12:17:17 -0500 | [diff] [blame] | 18 | for (auto oneFill : fts) { |
Mike Reed | 30bc527 | 2019-11-22 18:34:02 +0000 | [diff] [blame] | 19 | for (auto oneDir : dirs) { |
caryclark@google.com | 7dfbb07 | 2013-04-22 14:37:05 +0000 | [diff] [blame] | 20 | one.reset(); |
Mike Reed | 7d34dc7 | 2019-11-26 12:17:17 -0500 | [diff] [blame] | 21 | one.setFillType(oneFill); |
Mike Reed | 30bc527 | 2019-11-22 18:34:02 +0000 | [diff] [blame] | 22 | one.addRect(0, 0, 6, 6, oneDir); |
Mike Reed | 7d34dc7 | 2019-11-26 12:17:17 -0500 | [diff] [blame] | 23 | for (auto twoFill : fts) { |
Mike Reed | 30bc527 | 2019-11-22 18:34:02 +0000 | [diff] [blame] | 24 | for (auto twoDir : dirs) { |
caryclark@google.com | 7dfbb07 | 2013-04-22 14:37:05 +0000 | [diff] [blame] | 25 | two.reset(); |
Mike Reed | 7d34dc7 | 2019-11-26 12:17:17 -0500 | [diff] [blame] | 26 | two.setFillType(twoFill); |
Mike Reed | 30bc527 | 2019-11-22 18:34:02 +0000 | [diff] [blame] | 27 | two.addRect(3, 3, 9, 9, twoDir); |
Cary Clark | 4533f3d | 2018-08-08 09:48:09 -0400 | [diff] [blame] | 28 | SkString testName; |
| 29 | testName.printf("inverseTest%d", ++testCount); |
| 30 | testPathOp(reporter, one, two, (SkPathOp) op, testName.c_str()); |
caryclark@google.com | 7dfbb07 | 2013-04-22 14:37:05 +0000 | [diff] [blame] | 31 | } |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | } |
| 36 | } |