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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 fAppliedPEThenStroke.asPath(&a); | 81 fAppliedPEThenStroke.asPath(&a); |
82 fAppliedFull.asPath(&b); | 82 fAppliedFull.asPath(&b); |
83 REPORTER_ASSERT(r, a == b); | 83 REPORTER_ASSERT(r, a == b); |
84 | 84 |
85 // Check that the same path is produced when style is applied by GrShape
and GrStyle. | 85 // Check that the same path is produced when style is applied by GrShape
and GrStyle. |
86 SkPath preStyle; | 86 SkPath preStyle; |
87 SkPath postPathEffect; | 87 SkPath postPathEffect; |
88 SkPath postAllStyle; | 88 SkPath postAllStyle; |
89 | 89 |
90 fBase.asPath(&preStyle); | 90 fBase.asPath(&preStyle); |
91 SkStrokeRec postPathEffectStrokeRec(SkStrokeRec::kFill_InitStyle); | 91 SkStrokeRec postPEStrokeRec(SkStrokeRec::kFill_InitStyle); |
92 if (fBase.style().applyPathEffectToPath(&postPathEffect, &postPathEffect
StrokeRec, | 92 if (fBase.style().applyPathEffectToPath(&postPathEffect, &postPEStrokeRe
c, preStyle)) { |
93 preStyle)) { | 93 // run postPathEffect through GrShape to get any geometry reductions
that would have |
| 94 // occurred to fAppliedPE. |
| 95 GrShape(postPathEffect, GrStyle(postPEStrokeRec, nullptr)).asPath(&p
ostPathEffect); |
| 96 |
94 SkPath testPath; | 97 SkPath testPath; |
95 fAppliedPE.asPath(&testPath); | 98 fAppliedPE.asPath(&testPath); |
96 REPORTER_ASSERT(r, testPath == postPathEffect); | 99 REPORTER_ASSERT(r, testPath == postPathEffect); |
97 REPORTER_ASSERT(r, | 100 REPORTER_ASSERT(r, postPEStrokeRec.hasEqualEffect(fAppliedPE.style()
.strokeRec())); |
98 postPathEffectStrokeRec.hasEqualEffect(fAppliedPE.st
yle().strokeRec())); | |
99 } | 101 } |
100 SkStrokeRec::InitStyle fillOrHairline; | 102 SkStrokeRec::InitStyle fillOrHairline; |
101 if (fBase.style().applyToPath(&postAllStyle, &fillOrHairline, preStyle))
{ | 103 if (fBase.style().applyToPath(&postAllStyle, &fillOrHairline, preStyle))
{ |
| 104 // run postPathEffect through GrShape to get any reductions that wou
ld have occurred |
| 105 // to fAppliedFull. |
| 106 GrShape(postAllStyle, GrStyle(fillOrHairline)).asPath(&postAllStyle)
; |
| 107 |
102 SkPath testPath; | 108 SkPath testPath; |
103 fAppliedFull.asPath(&testPath); | 109 fAppliedFull.asPath(&testPath); |
104 REPORTER_ASSERT(r, testPath == postAllStyle); | 110 REPORTER_ASSERT(r, testPath == postAllStyle); |
105 if (fillOrHairline == SkStrokeRec::kFill_InitStyle) { | 111 if (fillOrHairline == SkStrokeRec::kFill_InitStyle) { |
106 REPORTER_ASSERT(r, fAppliedFull.style().isSimpleFill()); | 112 REPORTER_ASSERT(r, fAppliedFull.style().isSimpleFill()); |
107 } else { | 113 } else { |
108 REPORTER_ASSERT(r, fAppliedFull.style().isSimpleHairline()); | 114 REPORTER_ASSERT(r, fAppliedFull.style().isSimpleHairline()); |
109 } | 115 } |
110 } | 116 } |
111 } | 117 } |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 } | 852 } |
847 } | 853 } |
848 | 854 |
849 // Test a volatile empty path. | 855 // Test a volatile empty path. |
850 test_volatile_path(reporter, SkPath(), true); | 856 test_volatile_path(reporter, SkPath(), true); |
851 | 857 |
852 test_empty_shape(reporter); | 858 test_empty_shape(reporter); |
853 } | 859 } |
854 | 860 |
855 #endif | 861 #endif |
OLD | NEW |