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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 case Type::kEmpty: | 189 case Type::kEmpty: |
190 return true; | 190 return true; |
191 case Type::kRRect: | 191 case Type::kRRect: |
192 return true; | 192 return true; |
193 case Type::kPath: | 193 case Type::kPath: |
194 return false; | 194 return false; |
195 } | 195 } |
196 return false; | 196 return false; |
197 } | 197 } |
198 | 198 |
| 199 uint32_t segmentMask() const { |
| 200 switch (fType) { |
| 201 case Type::kEmpty: |
| 202 return 0; |
| 203 case Type::kRRect: |
| 204 if (fRRect.getType() == SkRRect::kOval_Type) { |
| 205 return SkPath::kConic_SegmentMask; |
| 206 } else if (fRRect.getType() == SkRRect::kRect_Type) { |
| 207 return SkPath::kLine_SegmentMask; |
| 208 } |
| 209 return SkPath::kLine_SegmentMask | SkPath::kConic_SegmentMask; |
| 210 case Type::kPath: |
| 211 return fPath.get()->getSegmentMasks(); |
| 212 } |
| 213 return 0; |
| 214 } |
| 215 |
199 /** | 216 /** |
200 * Gets the size of the key for the shape represented by this GrShape (ignor
ing its styling). | 217 * Gets the size of the key for the shape represented by this GrShape (ignor
ing its styling). |
201 * A negative value is returned if the shape has no key (shouldn't be cached
). | 218 * A negative value is returned if the shape has no key (shouldn't be cached
). |
202 */ | 219 */ |
203 int unstyledKeySize() const; | 220 int unstyledKeySize() const; |
204 | 221 |
205 /** | 222 /** |
206 * Writes unstyledKeySize() bytes into the provided pointer. Assumes that th
ere is enough | 223 * Writes unstyledKeySize() bytes into the provided pointer. Assumes that th
ere is enough |
207 * space allocated for the key and that unstyledKeySize() does not return a
negative value | 224 * space allocated for the key and that unstyledKeySize() does not return a
negative value |
208 * for this shape. | 225 * for this shape. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 311 |
295 Type fType; | 312 Type fType; |
296 SkRRect fRRect; | 313 SkRRect fRRect; |
297 SkPath::Direction fRRectDir; | 314 SkPath::Direction fRRectDir; |
298 unsigned fRRectStart; | 315 unsigned fRRectStart; |
299 SkTLazy<SkPath> fPath; | 316 SkTLazy<SkPath> fPath; |
300 GrStyle fStyle; | 317 GrStyle fStyle; |
301 SkAutoSTArray<8, uint32_t> fInheritedKey; | 318 SkAutoSTArray<8, uint32_t> fInheritedKey; |
302 }; | 319 }; |
303 #endif | 320 #endif |
OLD | NEW |