add more MakeFoo factories for SkRect

git-svn-id: http://skia.googlecode.com/svn/trunk@541 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@android.com 2010-04-12 21:21:59 +00:00
parent 1c0c5a0a52
commit 2687ae05cb

View File

@ -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; }