Reland blitFatAntiRect with guard to avoid overhead in MaskAdditiveBlitter

This results in ~15% (~700ns vs ~600ns) speedup for
path_fill_small_rect bench in 8888 config. Some skps have a lot of stroked
horizontal/vertical lines (e.g., bar charts) so this improvement could
have a great impact there. For example, cereal converts Microsoft word docx
to PNGs on server and the sample docx has a big bar chart. That inspired
this improvement.

Bug: skia:
Change-Id: If191b8beca58c5c08b356b64ffef93d51761fd0a
Reviewed-on: https://skia-review.googlesource.com/50043
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Yuqian Li <liyuqian@google.com>
diff --git a/src/core/SkScanPriv.h b/src/core/SkScanPriv.h
index f8d3bb2..8883be0 100644
--- a/src/core/SkScanPriv.h
+++ b/src/core/SkScanPriv.h
@@ -117,6 +117,23 @@
     return false;
 }
 
+// Check if the path is a rect and fat enough after clipping; if so, blit it.
+static inline bool TryBlitFatAntiRect(SkBlitter* blitter, const SkPath& path, const SkIRect& clip) {
+    SkRect rect;
+    if (!path.isRect(&rect)) {
+        return false; // not rect
+    }
+    if (!rect.intersect(SkRect::Make(clip))) {
+        return true; // The intersection is empty. Hence consider it done.
+    }
+    SkIRect bounds = rect.roundOut();
+    if (bounds.width() < 3 || bounds.height() < 3) {
+        return false; // not fat
+    }
+    blitter->blitFatAntiRect(rect);
+    return true;
+}
+
 using FillPathFunc = std::function<void(const SkPath& path, SkBlitter* blitter, bool isInverse,
         const SkIRect& ir, const SkRegion* clipRgn, const SkIRect* clipRect, bool forceRLE)>;