Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: include/core/SkRRect.h

Issue 52703003: Add SkRRect::transform. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix a comment. Use taller RRect. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/core/SkRRect.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
286 * @param dst SkRRect to store the result. It is an error to use this,
reed1 2013/11/04 20:21:09 FYI -- we explicitly support modifying self in SkP
scroggo 2013/11/04 22:29:55 In patch set 1 I allowed modifying the SkRRect, fo
287 * which would make this function no longer const.
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
OLDNEW
« no previous file with comments | « no previous file | src/core/SkRRect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698