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

Unified Diff: src/core/SkPath.cpp

Issue 51953003: remove contains(x,y) for rects and rrects ... not well defined, and unused (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | « include/core/SkRect.h ('k') | src/core/SkRRect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPath.cpp
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 9df62850fd2eb5bc9cf442dc4675b7091cded8c1..786d0936f4554fd32d2ab09c8434525d5c6b0cad 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -2961,14 +2961,17 @@ static int winding_line(const SkPoint pts[], SkScalar x, SkScalar y) {
return dir;
}
+static bool contains_inclusive(const SkRect& r, SkScalar x, SkScalar y) {
robertphillips 2013/10/30 17:18:48 shouldn't that be "<= r.fBottom"?
reed1 2013/10/30 17:38:53 doh! good catch. done.
+ return r.fLeft <= x && x <= r.fRight && r.fTop <= y && y < r.fBottom;
+}
+
bool SkPath::contains(SkScalar x, SkScalar y) const {
bool isInverse = this->isInverseFillType();
if (this->isEmpty()) {
return isInverse;
}
- const SkRect& bounds = this->getBounds();
- if (!bounds.contains(x, y)) {
+ if (!contains_inclusive(this->getBounds(), x, y)) {
return isInverse;
}
« no previous file with comments | « include/core/SkRect.h ('k') | src/core/SkRRect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698