aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-10-03 20:27:14 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-10-03 20:27:14 +0000
commitc74ab1813013b169ad500fcf1fa62be551041442 (patch)
treee9abaec5919ed118a198c83d087fe039283a6f65 /include
parent7deaa3b75c94b6fc2e2207de4d13ed1834b87211 (diff)
add accessors to irect
git-svn-id: http://skia.googlecode.com/svn/trunk@2399 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkRect.h34
1 files changed, 23 insertions, 11 deletions
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index f221cc880d..1399fbd6c0 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -49,20 +49,32 @@ struct SK_API SkIRect {
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; }
- /** Returns the rectangle's width. This does not check for a valid rectangle (i.e. left <= right)
- so the result may be negative.
- */
+ int left() const { return fLeft; }
+ int top() const { return fTop; }
+ int right() const { return fRight; }
+ int bottom() const { return fBottom; }
+
+ /** return the left edge of the rect */
+ int x() const { return fLeft; }
+ /** return the top edge of the rect */
+ int y() const { return fTop; }
+ /**
+ * Returns the rectangle's width. This does not check for a valid rect
+ * (i.e. left <= right) so the result may be negative.
+ */
int width() const { return fRight - fLeft; }
-
- /** Returns the rectangle's height. This does not check for a valid rectangle (i.e. top <= bottom)
- so the result may be negative.
- */
+
+ /**
+ * Returns the rectangle's height. This does not check for a valid rect
+ * (i.e. top <= bottom) so the result may be negative.
+ */
int height() const { return fBottom - fTop; }
+
+ /**
+ * Return true if the rectangle's width or height are <= 0
+ */
+ bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; }
friend bool operator==(const SkIRect& a, const SkIRect& b) {
return !memcmp(&a, &b, sizeof(a));