| 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 |
| 116 SkPathEffect* pathEffect() const { return fPathEffect.get(); } | 123 SkPathEffect* pathEffect() const { return fPathEffect.get(); } |
| 117 | 124 |
| 118 bool hasPathEffect() const { return SkToBool(fPathEffect.get()); } | 125 bool hasPathEffect() const { return SkToBool(fPathEffect.get()); } |
| 119 | 126 |
| 120 bool hasNonDashPathEffect() const { return fPathEffect.get() && !this->isDas
hed(); } | 127 bool hasNonDashPathEffect() const { return fPathEffect.get() && !this->isDas
hed(); } |
| 121 | 128 |
| 122 bool isDashed() const { return SkPathEffect::kDash_DashType == fDashInfo.fTy
pe; } | 129 bool isDashed() const { return SkPathEffect::kDash_DashType == fDashInfo.fTy
pe; } |
| 123 SkScalar dashPhase() const { | 130 SkScalar dashPhase() const { |
| 124 SkASSERT(this->isDashed()); | 131 SkASSERT(this->isDashed()); |
| 125 return fDashInfo.fPhase; | 132 return fDashInfo.fPhase; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 }; | 209 }; |
| 203 | 210 |
| 204 bool applyPathEffect(SkPath* dst, SkStrokeRec* strokeRec, const SkPath& src)
const; | 211 bool applyPathEffect(SkPath* dst, SkStrokeRec* strokeRec, const SkPath& src)
const; |
| 205 | 212 |
| 206 SkStrokeRec fStrokeRec; | 213 SkStrokeRec fStrokeRec; |
| 207 sk_sp<SkPathEffect> fPathEffect; | 214 sk_sp<SkPathEffect> fPathEffect; |
| 208 DashInfo fDashInfo; | 215 DashInfo fDashInfo; |
| 209 }; | 216 }; |
| 210 | 217 |
| 211 #endif | 218 #endif |
| OLD | NEW |