Index: src/pathops/SkPathOpsBounds.h |
diff --git a/src/pathops/SkPathOpsBounds.h b/src/pathops/SkPathOpsBounds.h |
index b99f36f5d969a2572c95e401c38aa68e56a6a467..610d7233a3130b52d7cd6a25311c33fac20d0e07 100644 |
--- a/src/pathops/SkPathOpsBounds.h |
+++ b/src/pathops/SkPathOpsBounds.h |
@@ -33,6 +33,13 @@ struct SkPathOpsBounds : public SkRect { |
add(toAdd.fLeft, toAdd.fTop, toAdd.fRight, toAdd.fBottom); |
} |
+ void add(const SkPoint& pt) { |
+ if (pt.fX < fLeft) fLeft = pt.fX; |
+ if (pt.fY < fTop) fTop = pt.fY; |
+ if (pt.fX > fRight) fRight = pt.fX; |
+ if (pt.fY > fBottom) fBottom = pt.fY; |
+ } |
+ |
void add(const SkDPoint& pt) { |
if (pt.fX < fLeft) fLeft = SkDoubleToScalar(pt.fX); |
if (pt.fY < fTop) fTop = SkDoubleToScalar(pt.fY); |
@@ -40,13 +47,18 @@ struct SkPathOpsBounds : public SkRect { |
if (pt.fY > fBottom) fBottom = SkDoubleToScalar(pt.fY); |
} |
- bool almostContains(const SkPoint& pt) { |
+ bool almostContains(const SkPoint& pt) const { |
return AlmostLessOrEqualUlps(fLeft, pt.fX) |
&& AlmostLessOrEqualUlps(pt.fX, fRight) |
&& AlmostLessOrEqualUlps(fTop, pt.fY) |
&& AlmostLessOrEqualUlps(pt.fY, fBottom); |
} |
+ bool contains(const SkPoint& pt) const { |
+ return fLeft <= pt.fX && fTop <= pt.fY && |
+ fRight >= pt.fX && fBottom >= pt.fY; |
+ } |
+ |
typedef SkRect INHERITED; |
}; |