diff options
Diffstat (limited to 'include/core/SkRect.h')
-rw-r--r-- | include/core/SkRect.h | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/include/core/SkRect.h b/include/core/SkRect.h index c615603d7e..d9ac3a6910 100644 --- a/include/core/SkRect.h +++ b/include/core/SkRect.h @@ -718,38 +718,11 @@ struct SK_API SkRect { } /** - * Returns true if (p.fX,p.fY) is inside the rectangle, and the rectangle - * is not empty. - * - * Contains treats the left and top differently from the right and bottom. - * The left and top coordinates of the rectangle are themselves considered - * to be inside, while the right and bottom are not. Thus for the rectangle - * {0, 0, 5, 10}, (0,0) is contained, but (0,10), (5,0) and (5,10) are not. - */ - bool contains(const SkPoint& p) const { - return !this->isEmpty() && - fLeft <= p.fX && p.fX < fRight && fTop <= p.fY && p.fY < fBottom; - } - - /** - * Returns true if (x,y) is inside the rectangle, and the rectangle - * is not empty. - * - * Contains treats the left and top differently from the right and bottom. - * The left and top coordinates of the rectangle are themselves considered - * to be inside, while the right and bottom are not. Thus for the rectangle - * {0, 0, 5, 10}, (0,0) is contained, but (0,10), (5,0) and (5,10) are not. - */ - bool contains(SkScalar x, SkScalar y) const { - return !this->isEmpty() && - fLeft <= x && x < fRight && fTop <= y && y < fBottom; - } - - /** * Return true if this rectangle contains r, and if both rectangles are * not empty. */ bool contains(const SkRect& r) const { + // todo: can we eliminate the this->isEmpty check? return !r.isEmpty() && !this->isEmpty() && fLeft <= r.fLeft && fTop <= r.fTop && fRight >= r.fRight && fBottom >= r.fBottom; |