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

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

Issue 14200044: RoundRect contains (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Jim fixed everything Created 7 years, 8 months 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
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 * 244 *
245 * It is valid for dst == this. 245 * It is valid for dst == this.
246 */ 246 */
247 void outset(SkScalar dx, SkScalar dy, SkRRect* dst) const { 247 void outset(SkScalar dx, SkScalar dy, SkRRect* dst) const {
248 this->inset(-dx, -dy, dst); 248 this->inset(-dx, -dy, dst);
249 } 249 }
250 void outset(SkScalar dx, SkScalar dy) { 250 void outset(SkScalar dx, SkScalar dy) {
251 this->inset(-dx, -dy, this); 251 this->inset(-dx, -dy, this);
252 } 252 }
253 253
254 /**
255 * Returns true if 'rect' is wholy inside the RR, and both
256 * are not empty.
257 */
258 bool contains(const SkRect& rect) const;
259
254 SkDEBUGCODE(void validate() const;) 260 SkDEBUGCODE(void validate() const;)
255 261
256 enum { 262 enum {
257 kSizeInMemory = 12 * sizeof(SkScalar) 263 kSizeInMemory = 12 * sizeof(SkScalar)
258 }; 264 };
259 265
260 /** 266 /**
261 * Write the rrect into the specified buffer. This is guaranteed to always 267 * Write the rrect into the specified buffer. This is guaranteed to always
262 * write kSizeInMemory bytes, and that value is guaranteed to always be 268 * write kSizeInMemory bytes, and that value is guaranteed to always be
263 * a multiple of 4. Return kSizeInMemory. 269 * a multiple of 4. Return kSizeInMemory.
264 */ 270 */
265 uint32_t writeToMemory(void* buffer) const; 271 uint32_t writeToMemory(void* buffer) const;
266 272
267 /** 273 /**
268 * Read the rrect from the specified buffer. This is guaranteed to always 274 * Read the rrect from the specified buffer. This is guaranteed to always
269 * read kSizeInMemory bytes, and that value is guaranteed to always be 275 * read kSizeInMemory bytes, and that value is guaranteed to always be
270 * a multiple of 4. Return kSizeInMemory. 276 * a multiple of 4. Return kSizeInMemory.
271 */ 277 */
272 uint32_t readFromMemory(const void* buffer); 278 uint32_t readFromMemory(const void* buffer);
273 279
274 private: 280 private:
275 SkRect fRect; 281 SkRect fRect;
276 // Radii order is UL, UR, LR, LL. Use Corner enum to index into fRadii[] 282 // Radii order is UL, UR, LR, LL. Use Corner enum to index into fRadii[]
277 SkVector fRadii[4]; 283 SkVector fRadii[4];
278 mutable Type fType; 284 mutable Type fType;
279 // TODO: add padding so we can use memcpy for flattening and not copy 285 // TODO: add padding so we can use memcpy for flattening and not copy
280 // uninitialized data 286 // uninitialized data
281 287
282 void computeType() const; 288 void computeType() const;
289 bool checkCornerContainment(SkScalar x, SkScalar y) const;
283 290
284 // to access fRadii directly 291 // to access fRadii directly
285 friend class SkPath; 292 friend class SkPath;
286 }; 293 };
287 294
288 #endif 295 #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