From 097a3513535ad854c1b049c32c080ec875ab1411 Mon Sep 17 00:00:00 2001 From: "reed@android.com" Date: Tue, 13 Jul 2010 18:35:14 +0000 Subject: add SkRegion::setRects(), and its unit tests git-svn-id: http://skia.googlecode.com/svn/trunk@588 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkRect.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'include/core/SkRect.h') 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; } -- cgit v1.2.3