add isRect() check to AAClip, to detect if a soft-clip is really just an irect

taken from (https://codereview.chromium.org/445233006/)

fix: don't assume that the first yoffset is 0, since we may have performed a translate and not
re-alloced our data.

This reverts commit 0aeea6d344f12e35e29a79f4bbc48af88f913204.

TBR=

Author: reed@google.com

Review URL: https://codereview.chromium.org/443353004
diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp
index 14152f8..5d21a47 100644
--- a/src/core/SkAAClip.cpp
+++ b/src/core/SkAAClip.cpp
@@ -684,6 +684,34 @@
 #endif
 }
 
+bool SkAAClip::isRect() const {
+    if (this->isEmpty()) {
+        return false;
+    }
+
+    const RunHead* head = fRunHead;
+    if (head->fRowCount != 1) {
+        return false;
+    }
+    const YOffset* yoff = head->yoffsets();
+    if (yoff->fY != fBounds.fBottom - 1) {
+        return false;
+    }
+
+    const uint8_t* row = head->data() + yoff->fOffset;
+    int width = fBounds.width();
+    do {
+        if (row[1] != 0xFF) {
+            return false;
+        }
+        int n = row[0];
+        SkASSERT(n <= width);
+        width -= n;
+        row += 2;
+    } while (width > 0);
+    return true;
+}
+
 bool SkAAClip::setRect(const SkRect& r, bool doAA) {
     if (r.isEmpty()) {
         return this->setEmpty();