diff options
Diffstat (limited to 'include/core/SkRect.h')
-rw-r--r-- | include/core/SkRect.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/core/SkRect.h b/include/core/SkRect.h index 879d81a..fbd9f7f 100644 --- a/include/core/SkRect.h +++ b/include/core/SkRect.h @@ -233,6 +233,18 @@ struct SkIRect { struct SkRect { SkScalar fLeft, fTop, fRight, fBottom; + static SkRect MakeEmpty() { + SkRect r; + r.setEmpty(); + return r; + } + + static SkRect MakeWH(SkScalar w, SkScalar h) { + SkRect r; + r.set(0, 0, w, h); + return r; + } + static SkRect MakeSize(const SkSize& size) { SkRect r; r.set(0, 0, size.width(), size.height()); @@ -250,7 +262,7 @@ struct SkRect { r.set(x, y, x + w, y + h); return r; } - + /** Return true if the rectangle's width or height are <= 0 */ bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; } |