diff options
author | 2010-07-13 18:35:14 +0000 | |
---|---|---|
committer | 2010-07-13 18:35:14 +0000 | |
commit | 097a3513535ad854c1b049c32c080ec875ab1411 (patch) | |
tree | bdc3288c64b8ccdf5a11574068cd0a656591b583 /include/core/SkRect.h | |
parent | 930056ed27a2de58f315910e63db1ddca0bac63f (diff) |
add SkRegion::setRects(), and its unit tests
git-svn-id: http://skia.googlecode.com/svn/trunk@588 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkRect.h')
-rw-r--r-- | include/core/SkRect.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/core/SkRect.h b/include/core/SkRect.h index fbd9f7f502..00e0aaf576 100644 --- a/include/core/SkRect.h +++ b/include/core/SkRect.h @@ -27,6 +27,36 @@ struct SkIRect { int32_t fLeft, fTop, fRight, fBottom; + static SkIRect MakeEmpty() { + SkIRect r; + r.setEmpty(); + return r; + } + + static SkIRect MakeWH(int32_t w, int32_t h) { + SkIRect r; + r.set(0, 0, w, h); + return r; + } + + static SkIRect MakeSize(const SkISize& size) { + SkIRect r; + r.set(0, 0, size.width(), size.height()); + return r; + } + + static SkIRect MakeLTRB(int32_t l, int32_t t, int32_t r, int32_t b) { + SkIRect rect; + rect.set(l, t, r, b); + return rect; + } + + static SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h) { + SkIRect r; + 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; } |