Fix clip area behavior for REPLACE op

bug:22291400

Work around clippath-clipped-to-view-bounds behavior by
implementing REPLACE op fast path, avoiding the transition to
SkRegion/SkPath.

Change-Id: I63c1cf961db2d6e3759d83914de1036c9ac7497a
diff --git a/libs/hwui/ClipArea.cpp b/libs/hwui/ClipArea.cpp
index eb520b4..b1a6844 100644
--- a/libs/hwui/ClipArea.cpp
+++ b/libs/hwui/ClipArea.cpp
@@ -263,10 +263,11 @@
 bool ClipArea::rectangleModeClipRectWithTransform(const Rect& r,
         const mat4* transform, SkRegion::Op op) {
 
-    // TODO: we should be able to handle kReplace_Op efficiently without
-    // going through RegionMode and later falling back into RectangleMode.
-
-    if (op != SkRegion::kIntersect_Op) {
+    if (op == SkRegion::kReplace_Op && transform->rectToRect()) {
+        mClipRect = r;
+        transform->mapRect(mClipRect);
+        return true;
+    } else if (op != SkRegion::kIntersect_Op) {
         enterRegionMode();
         return regionModeClipRectWithTransform(r, transform, op);
     }