OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 <initializer_list> | 8 #include <initializer_list> |
9 #include <functional> | 9 #include <functional> |
10 #include "Test.h" | 10 #include "Test.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // occurred to fAppliedPE. | 196 // occurred to fAppliedPE. |
197 GrShape(postPathEffect, GrStyle(postPEStrokeRec, nullptr)).asPath(&p
ostPathEffect); | 197 GrShape(postPathEffect, GrStyle(postPEStrokeRec, nullptr)).asPath(&p
ostPathEffect); |
198 | 198 |
199 SkPath testPath; | 199 SkPath testPath; |
200 fAppliedPE.asPath(&testPath); | 200 fAppliedPE.asPath(&testPath); |
201 REPORTER_ASSERT(r, testPath == postPathEffect); | 201 REPORTER_ASSERT(r, testPath == postPathEffect); |
202 REPORTER_ASSERT(r, postPEStrokeRec.hasEqualEffect(fAppliedPE.style()
.strokeRec())); | 202 REPORTER_ASSERT(r, postPEStrokeRec.hasEqualEffect(fAppliedPE.style()
.strokeRec())); |
203 } | 203 } |
204 SkStrokeRec::InitStyle fillOrHairline; | 204 SkStrokeRec::InitStyle fillOrHairline; |
205 if (fBase.style().applyToPath(&postAllStyle, &fillOrHairline, preStyle,
scale)) { | 205 if (fBase.style().applyToPath(&postAllStyle, &fillOrHairline, preStyle,
scale)) { |
206 // run postPathEffect through GrShape to get any reductions that wou
ld have occurred | |
207 // to fAppliedFull. | |
208 GrShape(postAllStyle, GrStyle(fillOrHairline)).asPath(&postAllStyle)
; | |
209 | |
210 SkPath testPath; | 206 SkPath testPath; |
211 fAppliedFull.asPath(&testPath); | 207 fAppliedFull.asPath(&testPath); |
212 REPORTER_ASSERT(r, testPath == postAllStyle); | 208 if (fBase.style().hasPathEffect()) { |
| 209 // Because GrShape always does two-stage application when there
is a path effect |
| 210 // there may be a reduction/canonicalization step between the pa
th effect and |
| 211 // strokerec not reflected in postAllStyle since it applied both
the path effect |
| 212 // and strokerec without analyzing the intermediate path. |
| 213 REPORTER_ASSERT(r, paths_fill_same(postAllStyle, testPath)); |
| 214 } else { |
| 215 // Make sure that postAllStyle sees any reductions/canonicalizat
ions that GrShape |
| 216 // would apply. |
| 217 GrShape(postAllStyle, GrStyle(fillOrHairline)).asPath(&postAllSt
yle); |
| 218 REPORTER_ASSERT(r, testPath == postAllStyle); |
| 219 } |
| 220 |
213 if (fillOrHairline == SkStrokeRec::kFill_InitStyle) { | 221 if (fillOrHairline == SkStrokeRec::kFill_InitStyle) { |
214 REPORTER_ASSERT(r, fAppliedFull.style().isSimpleFill()); | 222 REPORTER_ASSERT(r, fAppliedFull.style().isSimpleFill()); |
215 } else { | 223 } else { |
216 REPORTER_ASSERT(r, fAppliedFull.style().isSimpleHairline()); | 224 REPORTER_ASSERT(r, fAppliedFull.style().isSimpleHairline()); |
217 } | 225 } |
218 } | 226 } |
219 } | 227 } |
220 | 228 |
221 GrShape fBase; | 229 GrShape fBase; |
222 GrShape fAppliedPE; | 230 GrShape fAppliedPE; |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 REPORTER_ASSERT(reporter, testPath.fIsLine == strokePathCase.baseShape()
.asLine(nullptr)); | 1459 REPORTER_ASSERT(reporter, testPath.fIsLine == strokePathCase.baseShape()
.asLine(nullptr)); |
1452 } | 1460 } |
1453 | 1461 |
1454 // Test a volatile empty path. | 1462 // Test a volatile empty path. |
1455 test_volatile_path(reporter, SkPath(), true); | 1463 test_volatile_path(reporter, SkPath(), true); |
1456 | 1464 |
1457 test_empty_shape(reporter); | 1465 test_empty_shape(reporter); |
1458 } | 1466 } |
1459 | 1467 |
1460 #endif | 1468 #endif |
OLD | NEW |