| 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 GrShape_DEFINED | 8 #ifndef GrShape_DEFINED |
| 9 #define GrShape_DEFINED | 9 #define GrShape_DEFINED |
| 10 | 10 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 return false; | 113 return false; |
| 114 } | 114 } |
| 115 if (rrect) { | 115 if (rrect) { |
| 116 *rrect = fRRect; | 116 *rrect = fRRect; |
| 117 } | 117 } |
| 118 return true; | 118 return true; |
| 119 } | 119 } |
| 120 | 120 |
| 121 void asPath(SkPath* out) const { | 121 void asPath(SkPath* out) const { |
| 122 switch (fType) { | 122 switch (fType) { |
| 123 case Type::kEmpty: |
| 124 out->reset(); |
| 125 break; |
| 123 case Type::kRRect: | 126 case Type::kRRect: |
| 124 out->reset(); | 127 out->reset(); |
| 125 out->addRRect(fRRect); | 128 out->addRRect(fRRect); |
| 126 break; | 129 break; |
| 127 case Type::kPath: | 130 case Type::kPath: |
| 128 *out = *fPath.get(); | 131 *out = *fPath.get(); |
| 129 break; | 132 break; |
| 130 case Type::kEmpty: | |
| 131 out->reset(); | |
| 132 break; | |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 /** | 136 /** |
| 137 * Is it known that the shape has no unclosed contours. This means that it w
ill not have |
| 138 * any caps if stroked (modulo the effect of any path effect). |
| 139 */ |
| 140 bool knownToBeClosed() const { |
| 141 switch (fType) { |
| 142 case Type::kEmpty: |
| 143 return true; |
| 144 case Type::kRRect: |
| 145 return true; |
| 146 case Type::kPath: |
| 147 return false; |
| 148 } |
| 149 return false; |
| 150 } |
| 151 |
| 152 /** |
| 137 * Gets the size of the key for the shape represented by this GrShape (ignor
ing its styling). | 153 * Gets the size of the key for the shape represented by this GrShape (ignor
ing its styling). |
| 138 * A negative value is returned if the shape has no key (shouldn't be cached
). | 154 * A negative value is returned if the shape has no key (shouldn't be cached
). |
| 139 */ | 155 */ |
| 140 int unstyledKeySize() const; | 156 int unstyledKeySize() const; |
| 141 | 157 |
| 142 /** | 158 /** |
| 143 * Writes unstyledKeySize() bytes into the provided pointer. Assumes that th
ere is enough | 159 * Writes unstyledKeySize() bytes into the provided pointer. Assumes that th
ere is enough |
| 144 * space allocated for the key and that unstyledKeySize() does not return a
negative value | 160 * space allocated for the key and that unstyledKeySize() does not return a
negative value |
| 145 * for this shape. | 161 * for this shape. |
| 146 */ | 162 */ |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 return Type::kPath; | 221 return Type::kPath; |
| 206 } | 222 } |
| 207 | 223 |
| 208 Type fType; | 224 Type fType; |
| 209 SkRRect fRRect; | 225 SkRRect fRRect; |
| 210 SkTLazy<SkPath> fPath; | 226 SkTLazy<SkPath> fPath; |
| 211 GrStyle fStyle; | 227 GrStyle fStyle; |
| 212 SkAutoSTArray<8, uint32_t> fInheritedKey; | 228 SkAutoSTArray<8, uint32_t> fInheritedKey; |
| 213 }; | 229 }; |
| 214 #endif | 230 #endif |
| OLD | NEW |