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 #ifndef GrStyle_DEFINED | 8 #ifndef GrStyle_DEFINED |
9 #define GrStyle_DEFINED | 9 #define GrStyle_DEFINED |
10 | 10 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 const SkStrokeRec& strokeRec() const { return fStrokeRec; } | 129 const SkStrokeRec& strokeRec() const { return fStrokeRec; } |
130 | 130 |
131 /** Hairline or fill styles without path effects make no alterations to a ge
ometry. */ | 131 /** Hairline or fill styles without path effects make no alterations to a ge
ometry. */ |
132 bool applies() const { | 132 bool applies() const { |
133 return this->pathEffect() || (!fStrokeRec.isFillStyle() && !fStrokeRec.i
sHairlineStyle()); | 133 return this->pathEffect() || (!fStrokeRec.isFillStyle() && !fStrokeRec.i
sHairlineStyle()); |
134 } | 134 } |
135 | 135 |
136 /** | 136 /** |
137 * Applies just the path effect and returns remaining stroke information. Th
is will fail if | 137 * Applies just the path effect and returns remaining stroke information. Th
is will fail if |
138 * there is no path effect. | 138 * there is no path effect. dst may or may not have been overwritten on fail
ure. |
139 */ | 139 */ |
140 bool applyPathEffectToPath(SkPath* dst, SkStrokeRec* remainingStoke, const S
kPath& src) const; | 140 bool SK_WARN_UNUSED_RESULT applyPathEffectToPath(SkPath* dst, SkStrokeRec* r
emainingStoke, |
| 141 const SkPath& src) const; |
141 | 142 |
142 /** If this succeeds then the result path should be filled or hairlined as i
ndicated by the | 143 /** If this succeeds then the result path should be filled or hairlined as i
ndicated by the |
143 returned SkStrokeRec::InitStyle value. Will fail if there is no path eff
ect and the | 144 returned SkStrokeRec::InitStyle value. Will fail if there is no path eff
ect and the |
144 strokerec doesn't change the geometry. */ | 145 strokerec doesn't change the geometry. When this fails the outputs may o
r may not have |
145 bool applyToPath(SkPath* dst, SkStrokeRec::InitStyle* fillOrHairline, const
SkPath& src) const; | 146 been overwritten. |
| 147 */ |
| 148 bool SK_WARN_UNUSED_RESULT applyToPath(SkPath* dst, SkStrokeRec::InitStyle*
fillOrHairline, |
| 149 const SkPath& src) const; |
146 | 150 |
147 /** Given bounds of a path compute the bounds of path with the style applied
. */ | 151 /** Given bounds of a path compute the bounds of path with the style applied
. */ |
148 void adjustBounds(SkRect* dst, const SkRect& src) const { | 152 void adjustBounds(SkRect* dst, const SkRect& src) const { |
149 if (this->pathEffect()) { | 153 if (this->pathEffect()) { |
150 this->pathEffect()->computeFastBounds(dst, src); | 154 this->pathEffect()->computeFastBounds(dst, src); |
151 } else { | 155 } else { |
152 SkScalar radius = fStrokeRec.getInflationRadius(); | 156 SkScalar radius = fStrokeRec.getInflationRadius(); |
153 *dst = src.makeOutset(radius, radius); | 157 *dst = src.makeOutset(radius, radius); |
154 } | 158 } |
155 } | 159 } |
(...skipping 19 matching lines...) Expand all Loading... |
175 SkScalar fPhase; | 179 SkScalar fPhase; |
176 SkAutoSTArray<4, SkScalar> fIntervals; | 180 SkAutoSTArray<4, SkScalar> fIntervals; |
177 }; | 181 }; |
178 | 182 |
179 SkStrokeRec fStrokeRec; | 183 SkStrokeRec fStrokeRec; |
180 sk_sp<SkPathEffect> fPathEffect; | 184 sk_sp<SkPathEffect> fPathEffect; |
181 DashInfo fDashInfo; | 185 DashInfo fDashInfo; |
182 }; | 186 }; |
183 | 187 |
184 #endif | 188 #endif |
OLD | NEW |