OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 SkRRect_DEFINED | 8 #ifndef SkRRect_DEFINED |
9 #define SkRRect_DEFINED | 9 #define SkRRect_DEFINED |
10 | 10 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 /** | 88 /** |
89 * Returns the RR's sub type. | 89 * Returns the RR's sub type. |
90 */ | 90 */ |
91 Type getType() const { | 91 Type getType() const { |
92 SkDEBUGCODE(this->validate();) | 92 SkDEBUGCODE(this->validate();) |
93 | 93 |
94 if (kUnknown_Type == fType) { | 94 if (kUnknown_Type == fType) { |
95 this->computeType(); | 95 this->computeType(); |
96 } | 96 } |
97 SkASSERT(kUnknown_Type != fType); | 97 SkASSERT(kUnknown_Type != fType); |
98 return fType; | 98 return static_cast<Type>(fType); |
99 } | 99 } |
100 | 100 |
101 Type type() const { return this->getType(); } | 101 Type type() const { return this->getType(); } |
102 | 102 |
103 inline bool isEmpty() const { return kEmpty_Type == this->getType(); } | 103 inline bool isEmpty() const { return kEmpty_Type == this->getType(); } |
104 inline bool isRect() const { return kRect_Type == this->getType(); } | 104 inline bool isRect() const { return kRect_Type == this->getType(); } |
105 inline bool isOval() const { return kOval_Type == this->getType(); } | 105 inline bool isOval() const { return kOval_Type == this->getType(); } |
106 inline bool isSimple() const { return kSimple_Type == this->getType(); } | 106 inline bool isSimple() const { return kSimple_Type == this->getType(); } |
107 inline bool isSimpleCircular() const { | 107 inline bool isSimpleCircular() const { |
108 return this->isSimple() && fRadii[0].fX == fRadii[0].fY; | 108 return this->isSimple() && fRadii[0].fX == fRadii[0].fY; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 * Prints the rrect using SkDebugf. This is intended for Skia development de
bugging. Don't | 297 * Prints the rrect using SkDebugf. This is intended for Skia development de
bugging. Don't |
298 * rely on the existence of this function or the formatting of its output. | 298 * rely on the existence of this function or the formatting of its output. |
299 */ | 299 */ |
300 void dump() const; | 300 void dump() const; |
301 #endif | 301 #endif |
302 | 302 |
303 private: | 303 private: |
304 SkRect fRect; | 304 SkRect fRect; |
305 // Radii order is UL, UR, LR, LL. Use Corner enum to index into fRadii[] | 305 // Radii order is UL, UR, LR, LL. Use Corner enum to index into fRadii[] |
306 SkVector fRadii[4]; | 306 SkVector fRadii[4]; |
307 mutable Type fType; | 307 // use an explicitly sized type so we're sure the class is dense (no uniniti
alized bytes) |
| 308 mutable int32_t fType; |
308 // TODO: add padding so we can use memcpy for flattening and not copy | 309 // TODO: add padding so we can use memcpy for flattening and not copy |
309 // uninitialized data | 310 // uninitialized data |
310 | 311 |
311 void computeType() const; | 312 void computeType() const; |
312 bool checkCornerContainment(SkScalar x, SkScalar y) const; | 313 bool checkCornerContainment(SkScalar x, SkScalar y) const; |
313 | 314 |
314 // to access fRadii directly | 315 // to access fRadii directly |
315 friend class SkPath; | 316 friend class SkPath; |
316 }; | 317 }; |
317 | 318 |
318 #endif | 319 #endif |
OLD | NEW |