| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 b.fRadii[0].asScalars(), 8); | 192 b.fRadii[0].asScalars(), 8); |
| 193 } | 193 } |
| 194 | 194 |
| 195 friend bool operator!=(const SkRRect& a, const SkRRect& b) { | 195 friend bool operator!=(const SkRRect& a, const SkRRect& b) { |
| 196 return a.fRect != b.fRect || | 196 return a.fRect != b.fRect || |
| 197 !SkScalarsEqual(a.fRadii[0].asScalars(), | 197 !SkScalarsEqual(a.fRadii[0].asScalars(), |
| 198 b.fRadii[0].asScalars(), 8); | 198 b.fRadii[0].asScalars(), 8); |
| 199 } | 199 } |
| 200 | 200 |
| 201 /** | 201 /** |
| 202 * Returns true if (p.fX,p.fY) is inside the RR, and the RR | |
| 203 * is not empty. | |
| 204 * | |
| 205 * Contains treats the left and top differently from the right and bottom. | |
| 206 * The left and top coordinates of the RR are themselves considered | |
| 207 * to be inside, while the right and bottom are not. All the points on the | |
| 208 * edges of the corners are considered to be inside. | |
| 209 */ | |
| 210 bool contains(const SkPoint& p) const { | |
| 211 return contains(p.fX, p.fY); | |
| 212 } | |
| 213 | |
| 214 /** | |
| 215 * Returns true if (x,y) is inside the RR, and the RR | |
| 216 * is not empty. | |
| 217 * | |
| 218 * Contains treats the left and top differently from the right and bottom. | |
| 219 * The left and top coordinates of the RR are themselves considered | |
| 220 * to be inside, while the right and bottom are not. All the points on the | |
| 221 * edges of the corners are considered to be inside. | |
| 222 */ | |
| 223 bool contains(SkScalar x, SkScalar y) const; | |
| 224 | |
| 225 /** | |
| 226 * Call inset on the bounds, and adjust the radii to reflect what happens | 202 * Call inset on the bounds, and adjust the radii to reflect what happens |
| 227 * in stroking: If the corner is sharp (no curvature), leave it alone, | 203 * in stroking: If the corner is sharp (no curvature), leave it alone, |
| 228 * otherwise we grow/shrink the radii by the amount of the inset. If a | 204 * otherwise we grow/shrink the radii by the amount of the inset. If a |
| 229 * given radius becomes negative, it is pinned to 0. | 205 * given radius becomes negative, it is pinned to 0. |
| 230 * | 206 * |
| 231 * It is valid for dst == this. | 207 * It is valid for dst == this. |
| 232 */ | 208 */ |
| 233 void inset(SkScalar dx, SkScalar dy, SkRRect* dst) const; | 209 void inset(SkScalar dx, SkScalar dy, SkRRect* dst) const; |
| 234 | 210 |
| 235 void inset(SkScalar dx, SkScalar dy) { | 211 void inset(SkScalar dx, SkScalar dy) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 // uninitialized data | 262 // uninitialized data |
| 287 | 263 |
| 288 void computeType() const; | 264 void computeType() const; |
| 289 bool checkCornerContainment(SkScalar x, SkScalar y) const; | 265 bool checkCornerContainment(SkScalar x, SkScalar y) const; |
| 290 | 266 |
| 291 // to access fRadii directly | 267 // to access fRadii directly |
| 292 friend class SkPath; | 268 friend class SkPath; |
| 293 }; | 269 }; |
| 294 | 270 |
| 295 #endif | 271 #endif |
| OLD | NEW |