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 |
11 #include "SkRect.h" | 11 #include "SkRect.h" |
12 #include "SkPoint.h" | 12 #include "SkPoint.h" |
13 | 13 |
14 class SkPath; | 14 class SkPath; |
15 class SkMatrix; | |
15 | 16 |
16 // Path forward: | 17 // Path forward: |
17 // core work | 18 // core work |
18 // add validate method (all radii positive, all radii sums < rect size, etc .) | 19 // add validate method (all radii positive, all radii sums < rect size, etc .) |
19 // add contains(SkRect&) - for clip stack | 20 // add contains(SkRect&) - for clip stack |
20 // add contains(SkRRect&) - for clip stack | 21 // add contains(SkRRect&) - for clip stack |
21 // add heart rect computation (max rect inside RR) | 22 // add heart rect computation (max rect inside RR) |
22 // add 9patch rect computation | 23 // add 9patch rect computation |
23 // add growToInclude(SkPath&) | 24 // add growToInclude(SkPath&) |
24 // analysis | 25 // analysis |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 */ | 271 */ |
271 uint32_t writeToMemory(void* buffer) const; | 272 uint32_t writeToMemory(void* buffer) const; |
272 | 273 |
273 /** | 274 /** |
274 * Read the rrect from the specified buffer. This is guaranteed to always | 275 * Read the rrect from the specified buffer. This is guaranteed to always |
275 * read kSizeInMemory bytes, and that value is guaranteed to always be | 276 * read kSizeInMemory bytes, and that value is guaranteed to always be |
276 * a multiple of 4. Return kSizeInMemory. | 277 * a multiple of 4. Return kSizeInMemory. |
277 */ | 278 */ |
278 uint32_t readFromMemory(const void* buffer); | 279 uint32_t readFromMemory(const void* buffer); |
279 | 280 |
281 /** | |
282 * Transform by the specified matrix, and put the result in dst. | |
283 * | |
284 * @param matrix SkMatrix specifying the transform. Must only contain | |
285 * scale and/or translate, or this call will fail. | |
robertphillips
2013/10/30 23:55:02
this is a const method?! Are we really going to al
scroggo
2013/10/31 17:40:35
This seemed like an odd pattern to me, but I was k
| |
286 * @param dst SkRRect to store the result. If NULL, the transform will | |
287 * be performed on this. | |
288 * @return true on success, false on failure. If false, dst is unmodified. | |
289 */ | |
290 bool transform(const SkMatrix& matrix, SkRRect* dst) const; | |
291 | |
280 private: | 292 private: |
281 SkRect fRect; | 293 SkRect fRect; |
282 // Radii order is UL, UR, LR, LL. Use Corner enum to index into fRadii[] | 294 // Radii order is UL, UR, LR, LL. Use Corner enum to index into fRadii[] |
283 SkVector fRadii[4]; | 295 SkVector fRadii[4]; |
284 mutable Type fType; | 296 mutable Type fType; |
285 // TODO: add padding so we can use memcpy for flattening and not copy | 297 // TODO: add padding so we can use memcpy for flattening and not copy |
286 // uninitialized data | 298 // uninitialized data |
287 | 299 |
288 void computeType() const; | 300 void computeType() const; |
289 bool checkCornerContainment(SkScalar x, SkScalar y) const; | 301 bool checkCornerContainment(SkScalar x, SkScalar y) const; |
290 | 302 |
291 // to access fRadii directly | 303 // to access fRadii directly |
292 friend class SkPath; | 304 friend class SkPath; |
293 }; | 305 }; |
294 | 306 |
295 #endif | 307 #endif |
OLD | NEW |