Chromium Code Reviews| 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 30 matching lines...) Expand all Loading... | |
| 41 static const GrStyle& SimpleHairline() { | 41 static const GrStyle& SimpleHairline() { |
| 42 static const GrStyle kHairline(SkStrokeRec::kHairline_InitStyle); | 42 static const GrStyle kHairline(SkStrokeRec::kHairline_InitStyle); |
| 43 return kHairline; | 43 return kHairline; |
| 44 } | 44 } |
| 45 | 45 |
| 46 enum class Apply { | 46 enum class Apply { |
| 47 kPathEffectOnly, | 47 kPathEffectOnly, |
| 48 kPathEffectAndStrokeRec | 48 kPathEffectAndStrokeRec |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 /** | 51 /** |
|
robertphillips
2016/05/04 20:27:00
do to -> due to ?
bsalomon
2016/05/04 20:29:22
Done.
| |
| 52 * Optional flags for computing keys that may remove unnecessary variation i n the key do to | |
| 53 * style settings that don't affect particular classes of geometry. | |
| 54 */ | |
| 55 enum KeyFlags { | |
| 56 // The shape being styled has no open contours. | |
| 57 kClosed_KeyFlag = 0x1 | |
| 58 }; | |
| 59 | |
| 60 /** | |
| 52 * Computes the key length for a GrStyle. The return will be negative if it cannot be turned | 61 * Computes the key length for a GrStyle. The return will be negative if it cannot be turned |
| 53 * into a key. This occurs when there is a path effect that is not a dash. T he key can | 62 * into a key. This occurs when there is a path effect that is not a dash. T he key can |
| 54 * either reflect just the path effect (if one) or the path effect and the s trokerec. Note | 63 * either reflect just the path effect (if one) or the path effect and the s trokerec. Note |
| 55 * that a simple fill has a zero sized key. | 64 * that a simple fill has a zero sized key. |
| 56 */ | 65 */ |
| 57 static int KeySize(const GrStyle& , Apply); | 66 static int KeySize(const GrStyle& , Apply, uint32_t flags = 0); |
|
bsalomon
2016/05/04 20:17:10
KeySize doesn't actually use this but figured it w
| |
| 58 | 67 |
| 59 /** | 68 /** |
| 60 * Writes a unique key for the style into the provided buffer. This function assumes the buffer | 69 * Writes a unique key for the style into the provided buffer. This function assumes the buffer |
| 61 * has room for at least KeySize() values. It assumes that KeySize() returns a non-negative | 70 * has room for at least KeySize() values. It assumes that KeySize() returns a non-negative |
| 62 * value for the style and Apply param. This is written so that the key for just dash | 71 * value for the combination of GrStyle, Apply and flags params. This is wri tten so that the key |
| 63 * application followed by the key for the remaining SkStrokeRec is the same as the key for | 72 * for just dash application followed by the key for the remaining SkStrokeR ec is the same as |
| 64 * applying dashing and SkStrokeRec all at once. | 73 * the key for applying dashing and SkStrokeRec all at once. |
| 65 */ | 74 */ |
| 66 static void WriteKey(uint32_t*, const GrStyle&, Apply); | 75 static void WriteKey(uint32_t*, const GrStyle&, Apply, uint32_t flags = 0); |
| 67 | 76 |
| 68 GrStyle() : GrStyle(SkStrokeRec::kFill_InitStyle) {} | 77 GrStyle() : GrStyle(SkStrokeRec::kFill_InitStyle) {} |
| 69 | 78 |
| 70 explicit GrStyle(SkStrokeRec::InitStyle initStyle) : fStrokeRec(initStyle) { } | 79 explicit GrStyle(SkStrokeRec::InitStyle initStyle) : fStrokeRec(initStyle) { } |
| 71 | 80 |
| 72 GrStyle(const SkStrokeRec& strokeRec, SkPathEffect* pe) : fStrokeRec(strokeR ec) { | 81 GrStyle(const SkStrokeRec& strokeRec, SkPathEffect* pe) : fStrokeRec(strokeR ec) { |
| 73 SkASSERT(SkStrokeRec::kStrokeAndFill_Style != strokeRec.getStyle()); | 82 SkASSERT(SkStrokeRec::kStrokeAndFill_Style != strokeRec.getStyle()); |
| 74 this->initPathEffect(pe); | 83 this->initPathEffect(pe); |
| 75 } | 84 } |
| 76 | 85 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 SkScalar fPhase; | 180 SkScalar fPhase; |
| 172 SkAutoSTArray<4, SkScalar> fIntervals; | 181 SkAutoSTArray<4, SkScalar> fIntervals; |
| 173 }; | 182 }; |
| 174 | 183 |
| 175 SkStrokeRec fStrokeRec; | 184 SkStrokeRec fStrokeRec; |
| 176 sk_sp<SkPathEffect> fPathEffect; | 185 sk_sp<SkPathEffect> fPathEffect; |
| 177 DashInfo fDashInfo; | 186 DashInfo fDashInfo; |
| 178 }; | 187 }; |
| 179 | 188 |
| 180 #endif | 189 #endif |
| OLD | NEW |