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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 inline bool isRect() const { return kRect_Type == this->getType(); } | 96 inline bool isRect() const { return kRect_Type == this->getType(); } |
97 inline bool isOval() const { return kOval_Type == this->getType(); } | 97 inline bool isOval() const { return kOval_Type == this->getType(); } |
98 inline bool isSimple() const { return kSimple_Type == this->getType(); } | 98 inline bool isSimple() const { return kSimple_Type == this->getType(); } |
99 inline bool isSimpleCircular() const { | 99 inline bool isSimpleCircular() const { |
100 return this->isSimple() && fRadii[0].fX == fRadii[0].fY; | 100 return this->isSimple() && fRadii[0].fX == fRadii[0].fY; |
101 } | 101 } |
102 inline bool isComplex() const { return kComplex_Type == this->getType(); } | 102 inline bool isComplex() const { return kComplex_Type == this->getType(); } |
103 | 103 |
104 bool allCornersCircular() const; | 104 bool allCornersCircular() const; |
105 | 105 |
| 106 /** |
| 107 * Are both x-radii the same on the two left corners, and similar for the to
p, right, and |
| 108 * bottom. When this is the case the four ellipse centers form a rectangle. |
| 109 */ |
| 110 bool isNinePatch() const { |
| 111 return fRadii[kUpperLeft_Corner].fX == fRadii[kLowerLeft_Corner].fX && |
| 112 fRadii[kUpperRight_Corner].fX == fRadii[kLowerRight_Corner].fX && |
| 113 fRadii[kUpperLeft_Corner].fY == fRadii[kUpperRight_Corner].fY && |
| 114 fRadii[kLowerLeft_Corner].fY == fRadii[kLowerRight_Corner].fY; |
| 115 } |
| 116 |
106 SkScalar width() const { return fRect.width(); } | 117 SkScalar width() const { return fRect.width(); } |
107 SkScalar height() const { return fRect.height(); } | 118 SkScalar height() const { return fRect.height(); } |
108 | 119 |
109 /** | 120 /** |
110 * Set this RR to the empty rectangle (0,0,0,0) with 0 x & y radii. | 121 * Set this RR to the empty rectangle (0,0,0,0) with 0 x & y radii. |
111 */ | 122 */ |
112 void setEmpty() { | 123 void setEmpty() { |
113 fRect.setEmpty(); | 124 fRect.setEmpty(); |
114 memset(fRadii, 0, sizeof(fRadii)); | 125 memset(fRadii, 0, sizeof(fRadii)); |
115 fType = kEmpty_Type; | 126 fType = kEmpty_Type; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 // uninitialized data | 297 // uninitialized data |
287 | 298 |
288 void computeType() const; | 299 void computeType() const; |
289 bool checkCornerContainment(SkScalar x, SkScalar y) const; | 300 bool checkCornerContainment(SkScalar x, SkScalar y) const; |
290 | 301 |
291 // to access fRadii directly | 302 // to access fRadii directly |
292 friend class SkPath; | 303 friend class SkPath; |
293 }; | 304 }; |
294 | 305 |
295 #endif | 306 #endif |
OLD | NEW |