OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "PathOpsExtendedTest.h" | 8 #include "PathOpsExtendedTest.h" |
9 #include "PathOpsTestCommon.h" | 9 #include "PathOpsTestCommon.h" |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 REPORTER_ASSERT(reporter, builder.resolve(&result)); | 24 REPORTER_ASSERT(reporter, builder.resolve(&result)); |
25 REPORTER_ASSERT(reporter, result.isEmpty()); | 25 REPORTER_ASSERT(reporter, result.isEmpty()); |
26 | 26 |
27 SkPath rectPath; | 27 SkPath rectPath; |
28 rectPath.setFillType(SkPath::kEvenOdd_FillType); | 28 rectPath.setFillType(SkPath::kEvenOdd_FillType); |
29 rectPath.addRect(0, 1, 2, 3, SkPath::kCW_Direction); | 29 rectPath.addRect(0, 1, 2, 3, SkPath::kCW_Direction); |
30 builder.add(rectPath, kUnion_SkPathOp); | 30 builder.add(rectPath, kUnion_SkPathOp); |
31 REPORTER_ASSERT(reporter, builder.resolve(&result)); | 31 REPORTER_ASSERT(reporter, builder.resolve(&result)); |
32 bool closed; | 32 bool closed; |
33 SkPath::Direction dir; | 33 SkPath::Direction dir; |
34 REPORTER_ASSERT(reporter, result.isRect(NULL, &closed, &dir)); | 34 REPORTER_ASSERT(reporter, result.isRect(nullptr, &closed, &dir)); |
35 REPORTER_ASSERT(reporter, closed); | 35 REPORTER_ASSERT(reporter, closed); |
36 REPORTER_ASSERT(reporter, dir == SkPath::kCCW_Direction); | 36 REPORTER_ASSERT(reporter, dir == SkPath::kCCW_Direction); |
37 int pixelDiff = comparePaths(reporter, __FUNCTION__, rectPath, result); | 37 int pixelDiff = comparePaths(reporter, __FUNCTION__, rectPath, result); |
38 REPORTER_ASSERT(reporter, pixelDiff == 0); | 38 REPORTER_ASSERT(reporter, pixelDiff == 0); |
39 | 39 |
40 rectPath.reset(); | 40 rectPath.reset(); |
41 rectPath.setFillType(SkPath::kEvenOdd_FillType); | 41 rectPath.setFillType(SkPath::kEvenOdd_FillType); |
42 rectPath.addRect(0, 1, 2, 3, SkPath::kCCW_Direction); | 42 rectPath.addRect(0, 1, 2, 3, SkPath::kCCW_Direction); |
43 builder.add(rectPath, kUnion_SkPathOp); | 43 builder.add(rectPath, kUnion_SkPathOp); |
44 REPORTER_ASSERT(reporter, builder.resolve(&result)); | 44 REPORTER_ASSERT(reporter, builder.resolve(&result)); |
45 REPORTER_ASSERT(reporter, result.isRect(NULL, &closed, &dir)); | 45 REPORTER_ASSERT(reporter, result.isRect(nullptr, &closed, &dir)); |
46 REPORTER_ASSERT(reporter, closed); | 46 REPORTER_ASSERT(reporter, closed); |
47 REPORTER_ASSERT(reporter, dir == SkPath::kCCW_Direction); | 47 REPORTER_ASSERT(reporter, dir == SkPath::kCCW_Direction); |
48 REPORTER_ASSERT(reporter, rectPath == result); | 48 REPORTER_ASSERT(reporter, rectPath == result); |
49 | 49 |
50 builder.add(rectPath, kDifference_SkPathOp); | 50 builder.add(rectPath, kDifference_SkPathOp); |
51 REPORTER_ASSERT(reporter, builder.resolve(&result)); | 51 REPORTER_ASSERT(reporter, builder.resolve(&result)); |
52 REPORTER_ASSERT(reporter, result.isEmpty()); | 52 REPORTER_ASSERT(reporter, result.isEmpty()); |
53 | 53 |
54 SkPath rect2, rect3; | 54 SkPath rect2, rect3; |
55 rect2.addRect(2, 1, 4, 3, SkPath::kCW_Direction); | 55 rect2.addRect(2, 1, 4, 3, SkPath::kCW_Direction); |
56 rect3.addRect(4, 1, 5, 3, SkPath::kCCW_Direction); | 56 rect3.addRect(4, 1, 5, 3, SkPath::kCCW_Direction); |
57 builder.add(rectPath, kUnion_SkPathOp); | 57 builder.add(rectPath, kUnion_SkPathOp); |
58 builder.add(rect2, kUnion_SkPathOp); | 58 builder.add(rect2, kUnion_SkPathOp); |
59 builder.add(rect3, kUnion_SkPathOp); | 59 builder.add(rect3, kUnion_SkPathOp); |
60 REPORTER_ASSERT(reporter, builder.resolve(&result)); | 60 REPORTER_ASSERT(reporter, builder.resolve(&result)); |
61 REPORTER_ASSERT(reporter, result.isRect(NULL, &closed, &dir)); | 61 REPORTER_ASSERT(reporter, result.isRect(nullptr, &closed, &dir)); |
62 REPORTER_ASSERT(reporter, closed); | 62 REPORTER_ASSERT(reporter, closed); |
63 SkRect expected; | 63 SkRect expected; |
64 expected.set(0, 1, 5, 3); | 64 expected.set(0, 1, 5, 3); |
65 REPORTER_ASSERT(reporter, result.getBounds() == expected); | 65 REPORTER_ASSERT(reporter, result.getBounds() == expected); |
66 | 66 |
67 SkPath circle1, circle2, circle3; | 67 SkPath circle1, circle2, circle3; |
68 circle1.addCircle(5, 6, 4, SkPath::kCW_Direction); | 68 circle1.addCircle(5, 6, 4, SkPath::kCW_Direction); |
69 circle2.addCircle(7, 4, 8, SkPath::kCCW_Direction); | 69 circle2.addCircle(7, 4, 8, SkPath::kCCW_Direction); |
70 circle3.addCircle(6, 5, 6, SkPath::kCW_Direction); | 70 circle3.addCircle(6, 5, 6, SkPath::kCW_Direction); |
71 SkPath opCompare; | 71 SkPath opCompare; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 inner.addRect(757798030.f, 30, 757798030.f+100, 30+60); // <rect x="75779803
0" y="30" width="100" height="60" /> | 264 inner.addRect(757798030.f, 30, 757798030.f+100, 30+60); // <rect x="75779803
0" y="30" width="100" height="60" /> |
265 clipRect.addPath(inner); | 265 clipRect.addPath(inner); |
266 | 266 |
267 SkOpBuilder builder; | 267 SkOpBuilder builder; |
268 builder.add(clipCircle, kUnion_SkPathOp); | 268 builder.add(clipCircle, kUnion_SkPathOp); |
269 builder.add(clipRect, kDifference_SkPathOp); | 269 builder.add(clipRect, kDifference_SkPathOp); |
270 SkPath result; | 270 SkPath result; |
271 builder.resolve(&result); | 271 builder.resolve(&result); |
272 } | 272 } |
273 | 273 |
OLD | NEW |