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

Unified Diff: src/pathops/SkPathOpsBounds.h

Issue 21359002: path ops work in progress (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove space Created 7 years, 3 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 | « src/pathops/SkOpSpan.h ('k') | src/pathops/SkPathOpsCommon.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkPathOpsBounds.h
diff --git a/src/pathops/SkPathOpsBounds.h b/src/pathops/SkPathOpsBounds.h
index 61ef7bb874c07cef9202ac75fe016d85edc23cce..07ad5d4ba9d02221dafbd703e0b89fe334f0921c 100644
--- a/src/pathops/SkPathOpsBounds.h
+++ b/src/pathops/SkPathOpsBounds.h
@@ -13,8 +13,10 @@
// SkPathOpsBounds, unlike SkRect, does not consider a line to be empty.
struct SkPathOpsBounds : public SkRect {
static bool Intersects(const SkPathOpsBounds& a, const SkPathOpsBounds& b) {
- return a.fLeft <= b.fRight && b.fLeft <= a.fRight &&
- a.fTop <= b.fBottom && b.fTop <= a.fBottom;
+ return AlmostLessOrEqualUlps(a.fLeft, b.fRight)
+ && AlmostLessOrEqualUlps(b.fLeft, a.fRight)
+ && AlmostLessOrEqualUlps(a.fTop, b.fBottom)
+ && AlmostLessOrEqualUlps(b.fTop, a.fBottom);
}
// Note that add(), unlike SkRect::join() or SkRect::growToInclude()
@@ -38,6 +40,13 @@ struct SkPathOpsBounds : public SkRect {
if (pt.fY > fBottom) fBottom = pt.fY;
}
+ bool almostContains(const SkPoint& pt) {
+ return AlmostLessOrEqualUlps(fLeft, pt.fX)
+ && AlmostLessOrEqualUlps(pt.fX, fRight)
+ && AlmostLessOrEqualUlps(fTop, pt.fY)
+ && AlmostLessOrEqualUlps(pt.fY, fBottom);
+ }
+
// unlike isEmpty(), this permits lines, but not points
// FIXME: unused for now
bool isReallyEmpty() const {
« no previous file with comments | « src/pathops/SkOpSpan.h ('k') | src/pathops/SkPathOpsCommon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698