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/tests/AAClipTest.cpp b/tests/AAClipTest.cpp
index 26c1ec1..776cd52 100644
--- a/tests/AAClipTest.cpp
+++ b/tests/AAClipTest.cpp
@@ -318,6 +318,30 @@
     }
 }
 
+static void test_really_a_rect(skiatest::Reporter* reporter) {
+    SkRRect rrect;
+    rrect.setRectXY(SkRect::MakeWH(100, 100), 5, 5);
+
+    SkPath path;
+    path.addRRect(rrect);
+
+    SkAAClip clip;
+    clip.setPath(path);
+
+    REPORTER_ASSERT(reporter, clip.getBounds() == SkIRect::MakeWH(100, 100));
+    REPORTER_ASSERT(reporter, !clip.isRect());
+
+    // This rect should intersect the clip, but slice-out all of the "soft" parts,
+    // leaving just a rect.
+    const SkIRect ir = SkIRect::MakeLTRB(10, -10, 50, 90);
+    
+    clip.op(ir, SkRegion::kIntersect_Op);
+
+    REPORTER_ASSERT(reporter, clip.getBounds() == SkIRect::MakeLTRB(10, 0, 50, 90));
+    // the clip recognized that that it is just a rect!
+    REPORTER_ASSERT(reporter, clip.isRect());
+}
+
 #include "SkRasterClip.h"
 
 static void copyToMask(const SkRasterClip& rc, SkMask* mask) {
@@ -404,4 +428,5 @@
     test_path_with_hole(reporter);
     test_regressions();
     test_nearly_integral(reporter);
+    test_really_a_rect(reporter);
 }