add accessors to irect
authorreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 3 Oct 2011 20:27:14 +0000 (20:27 +0000)
committerreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 3 Oct 2011 20:27:14 +0000 (20:27 +0000)
git-svn-id: http://skia.googlecode.com/svn/trunk@2399 2bbb7eff-a529-9590-31e7-b0007b416f81

include/core/SkRect.h

index f221cc8..1399fbd 100644 (file)
@@ -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));