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

Unified Diff: include/core/SkRRect.h

Issue 14200044: RoundRect contains (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Fixed test 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkRRect.cpp » ('j') | src/core/SkRRect.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkRRect.h
===================================================================
--- include/core/SkRRect.h (revision 8834)
+++ include/core/SkRRect.h (working copy)
@@ -200,27 +200,33 @@
/**
* Returns true if (p.fX,p.fY) is inside the RR, and the RR
- * is not empty.
+ * is not empty. The 'loose' parameter controls the containment
+ * policly on the right and bottom edges (loose -> "<="; !loose ->
+ * "<"). It should be set to true when the point should be considered
+ * "in" when it lies on a R/B edge (e.g., the right edge of an SkRect).
*
* Contains treats the left and top differently from the right and bottom.
* The left and top coordinates of the RR are themselves considered
* to be inside, while the right and bottom are not. All the points on the
* edges of the corners are considered to be inside.
*/
- bool contains(const SkPoint& p) const {
- return contains(p.fX, p.fY);
+ bool contains(const SkPoint& p, bool loose = false) const {
+ return contains(p.fX, p.fY, loose);
}
/**
* Returns true if (x,y) is inside the RR, and the RR
- * is not empty.
+ * is not empty. The 'loose' parameter controls the containment
+ * policly on the right and bottom edges (loose -> "<="; !loose ->
+ * "<"). It should be set to true when the point should be considered
+ * "in" when it lies on a R/B edge (e.g., the right edge of an SkRect).
*
* Contains treats the left and top differently from the right and bottom.
* The left and top coordinates of the RR are themselves considered
* to be inside, while the right and bottom are not. All the points on the
* edges of the corners are considered to be inside.
*/
- bool contains(SkScalar x, SkScalar y) const;
+ bool contains(SkScalar x, SkScalar y, bool loose = false) const;
/**
* Call inset on the bounds, and adjust the radii to reflect what happens
@@ -251,6 +257,17 @@
this->inset(-dx, -dy, this);
}
+ /**
+ * Returns true if 'rect' is wholy inside the RR, and both
+ * are not empty.
+ *
+ * Contains treats the left and top differently from the right and bottom.
+ * The left and top coordinates of the RR are themselves considered
+ * to be inside, while the right and bottom are not. All the points on the
+ * edges of the corners are considered to be inside.
+ */
+ bool contains(const SkRect& rect) const;
+
SkDEBUGCODE(void validate() const;)
enum {
« no previous file with comments | « no previous file | src/core/SkRRect.cpp » ('j') | src/core/SkRRect.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698