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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 fStrokeRec.setHairlineStyle(); | 106 fStrokeRec.setHairlineStyle(); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 /** Is this style a fill with no path effect? */ | 110 /** Is this style a fill with no path effect? */ |
111 bool isSimpleFill() const { return fStrokeRec.isFillStyle() && !fPathEffect;
} | 111 bool isSimpleFill() const { return fStrokeRec.isFillStyle() && !fPathEffect;
} |
112 | 112 |
113 /** Is this style a hairline with no path effect? */ | 113 /** Is this style a hairline with no path effect? */ |
114 bool isSimpleHairline() const { return fStrokeRec.isHairlineStyle() && !fPat
hEffect; } | 114 bool isSimpleHairline() const { return fStrokeRec.isHairlineStyle() && !fPat
hEffect; } |
115 | 115 |
116 bool couldBeHairline() const { | |
117 // If the original stroke rec has hairline style then either a null or d
ash patheffect | |
118 // would preserve the hairline status. An arbitrary path effect could in
troduce hairline | |
119 // style. | |
120 return this->strokeRec().isHairlineStyle() || this->hasNonDashPathEffect
(); | |
121 } | |
122 | |
123 SkPathEffect* pathEffect() const { return fPathEffect.get(); } | 116 SkPathEffect* pathEffect() const { return fPathEffect.get(); } |
124 | 117 |
125 bool hasPathEffect() const { return SkToBool(fPathEffect.get()); } | 118 bool hasPathEffect() const { return SkToBool(fPathEffect.get()); } |
126 | 119 |
127 bool hasNonDashPathEffect() const { return fPathEffect.get() && !this->isDas
hed(); } | 120 bool hasNonDashPathEffect() const { return fPathEffect.get() && !this->isDas
hed(); } |
128 | 121 |
129 bool isDashed() const { return SkPathEffect::kDash_DashType == fDashInfo.fTy
pe; } | 122 bool isDashed() const { return SkPathEffect::kDash_DashType == fDashInfo.fTy
pe; } |
130 SkScalar dashPhase() const { | 123 SkScalar dashPhase() const { |
131 SkASSERT(this->isDashed()); | 124 SkASSERT(this->isDashed()); |
132 return fDashInfo.fPhase; | 125 return fDashInfo.fPhase; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 }; | 202 }; |
210 | 203 |
211 bool applyPathEffect(SkPath* dst, SkStrokeRec* strokeRec, const SkPath& src)
const; | 204 bool applyPathEffect(SkPath* dst, SkStrokeRec* strokeRec, const SkPath& src)
const; |
212 | 205 |
213 SkStrokeRec fStrokeRec; | 206 SkStrokeRec fStrokeRec; |
214 sk_sp<SkPathEffect> fPathEffect; | 207 sk_sp<SkPathEffect> fPathEffect; |
215 DashInfo fDashInfo; | 208 DashInfo fDashInfo; |
216 }; | 209 }; |
217 | 210 |
218 #endif | 211 #endif |
OLD | NEW |