remove redundant rect methods

Bug: skia:9328
Change-Id: Idc20e125a4a4725c88e291b49e33cc56805836ae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235832
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index a3703ba..65a11b9 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -4,6 +4,8 @@
 
 -----
 
+  * Remove 4-parameter variant of SkRect::join() and intersect()
+
 Milestone 78
 
   * Added RELEASE_NOTES.txt file
diff --git a/docs/examples/Rect_intersect_2.cpp b/docs/examples/Rect_intersect_2.cpp
index fe02b1b..5880df4 100644
--- a/docs/examples/Rect_intersect_2.cpp
+++ b/docs/examples/Rect_intersect_2.cpp
@@ -5,7 +5,7 @@
 REG_FIDDLE(Rect_intersect_2, 256, 256, true, 0) {
 void draw(SkCanvas* canvas) {
     SkRect leftRect =  { 10, 40, 50, 80 };
-    SkDebugf("%s intersection: ", leftRect.intersect(30, 60, 70, 90) ? "" : "no ");
+    SkDebugf("%s intersection: ", leftRect.intersect({30, 60, 70, 90}) ? "" : "no ");
     SkDebugf("%g, %g, %g, %g\n", leftRect.left(), leftRect.top(),
                                  leftRect.right(), leftRect.bottom());
 }
diff --git a/docs/examples/Rect_intersects_3.cpp b/docs/examples/Rect_intersects_3.cpp
index 51ead19..3752917 100644
--- a/docs/examples/Rect_intersects_3.cpp
+++ b/docs/examples/Rect_intersects_3.cpp
@@ -5,6 +5,6 @@
 REG_FIDDLE(Rect_intersects_3, 256, 256, true, 0) {
 void draw(SkCanvas* canvas) {
     SkRect rect = { 10, 40, 50, 80 };
-    SkDebugf("%s intersection", rect.intersects(30, 60, 70, 90) ? "" : "no ");
+    SkDebugf("%s intersection", rect.intersects({30, 60, 70, 90}) ? "" : "no ");
 }
 }  // END FIDDLE
diff --git a/docs/examples/Rect_join.cpp b/docs/examples/Rect_join.cpp
index 341e381..8fe2ce4 100644
--- a/docs/examples/Rect_join.cpp
+++ b/docs/examples/Rect_join.cpp
@@ -5,7 +5,7 @@
 REG_FIDDLE(Rect_join, 256, 256, true, 0) {
 void draw(SkCanvas* canvas) {
     SkRect rect = { 10, 20, 15, 25};
-    rect.join(50, 60, 55, 65);
+    rect.join({50, 60, 55, 65});
     SkDebugf("join: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
 }
 }  // END FIDDLE
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index 086d29f..8b9da27 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -1231,22 +1231,11 @@
         @return   true if r and SkRect have area in common
     */
     bool intersect(const SkRect& r);
-
-    /** Constructs SkRect to intersect from (left, top, right, bottom). Does not sort
-        construction.
-
-        Returns true if SkRect intersects construction, and sets SkRect to intersection.
-        Returns false if SkRect does not intersect construction, and leaves SkRect unchanged.
-
-        Returns false if either construction or SkRect is empty, leaving SkRect unchanged.
-
-        @param left    x-axis minimum of constructed SkRect
-        @param top     y-axis minimum of constructed SkRect
-        @param right   x-axis maximum of constructed SkRect
-        @param bottom  y-axis maximum of constructed SkRect
-        @return        true if construction and SkRect have area in common
-    */
-    bool intersect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom);
+#ifdef SK_SUPPORT_LEGACY_RECT_PARAMS
+    bool intersect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) {
+        return this->intersect({left, top, right, bottom});
+    }
+#endif
 
     /** Returns true if a intersects b, and sets SkRect to intersection.
         Returns false if a does not intersect b, and leaves SkRect unchanged.
@@ -1272,32 +1261,22 @@
 
 public:
 
-    /** Constructs SkRect to intersect from (left, top, right, bottom). Does not sort
-        construction.
-
-        Returns true if SkRect intersects construction.
-        Returns false if either construction or SkRect is empty, or do not intersect.
-
-        @param left    x-axis minimum of constructed SkRect
-        @param top     y-axis minimum of constructed SkRect
-        @param right   x-axis maximum of constructed SkRect
-        @param bottom  y-axis maximum of constructed SkRect
-        @return        true if construction and SkRect have area in common
-    */
-    bool intersects(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) const {
-        return Intersects(fLeft, fTop, fRight, fBottom, left, top, right, bottom);
-    }
-
     /** Returns true if SkRect intersects r.
-        Returns false if either r or SkRect is empty, or do not intersect.
+     Returns false if either r or SkRect is empty, or do not intersect.
 
-        @param r  SkRect to intersect
-        @return   true if r and SkRect have area in common
-    */
+     @param r  SkRect to intersect
+     @return   true if r and SkRect have area in common
+     */
     bool intersects(const SkRect& r) const {
         return Intersects(fLeft, fTop, fRight, fBottom,
                           r.fLeft, r.fTop, r.fRight, r.fBottom);
     }
+#ifdef SK_SUPPORT_LEGACY_RECT_PARAMS
+    bool intersects(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) const {
+        return Intersects(fLeft, fTop, fRight, fBottom, left, top, right, bottom);
+    }
+#endif
+
 
     /** Returns true if a intersects b.
         Returns false if either a or b is empty, or do not intersect.
@@ -1311,21 +1290,6 @@
                           b.fLeft, b.fTop, b.fRight, b.fBottom);
     }
 
-    /** Constructs SkRect to intersect from (left, top, right, bottom). Does not sort
-        construction.
-
-        Sets SkRect to the union of itself and the construction.
-
-        Has no effect if construction is empty. Otherwise, if SkRect is empty, sets
-        SkRect to construction.
-
-        @param left    x-axis minimum of constructed SkRect
-        @param top     y-axis minimum of constructed SkRect
-        @param right   x-axis maximum of constructed SkRect
-        @param bottom  y-axis maximum of constructed SkRect
-    */
-    void join(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom);
-
     /** Sets SkRect to the union of itself and r.
 
         Has no effect if r is empty. Otherwise, if SkRect is empty, sets
@@ -1333,9 +1297,12 @@
 
         @param r  expansion SkRect
     */
-    void join(const SkRect& r) {
-        this->join(r.fLeft, r.fTop, r.fRight, r.fBottom);
+    void join(const SkRect& r);
+#ifdef SK_SUPPORT_LEGACY_RECT_PARAMS
+    void join(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) {
+        this->join({left, top, right, bottom});
     }
+#endif
 
     /** Sets SkRect to the union of itself and r.
 
diff --git a/samplecode/SampleXfer.cpp b/samplecode/SampleXfer.cpp
index dfea45d..fdbda8b 100644
--- a/samplecode/SampleXfer.cpp
+++ b/samplecode/SampleXfer.cpp
@@ -58,7 +58,7 @@
     }
 
     bool hitTest(SkScalar x, SkScalar y) {
-        return fRect.intersects(x - 1, y - 1, x + 1, y + 1);
+        return fRect.intersects({x - 1, y - 1, x + 1, y + 1});
     }
 };
 
diff --git a/src/core/SkRect.cpp b/src/core/SkRect.cpp
index 0964a1a..4253a26 100644
--- a/src/core/SkRect.cpp
+++ b/src/core/SkRect.cpp
@@ -93,36 +93,30 @@
     do { if (!(L < R && T < B)) return false; } while (0)
     // do the !(opposite) check so we return false if either arg is NaN
 
-bool SkRect::intersect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) {
-    CHECK_INTERSECT(left, top, right, bottom, fLeft, fTop, fRight, fBottom);
+bool SkRect::intersect(const SkRect& r) {
+    CHECK_INTERSECT(r.fLeft, r.fTop, r.fRight, r.fBottom, fLeft, fTop, fRight, fBottom);
     this->setLTRB(L, T, R, B);
     return true;
 }
 
-bool SkRect::intersect(const SkRect& r) {
-    return this->intersect(r.fLeft, r.fTop, r.fRight, r.fBottom);
-}
-
 bool SkRect::intersect(const SkRect& a, const SkRect& b) {
     CHECK_INTERSECT(a.fLeft, a.fTop, a.fRight, a.fBottom, b.fLeft, b.fTop, b.fRight, b.fBottom);
     this->setLTRB(L, T, R, B);
     return true;
 }
 
-void SkRect::join(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) {
-    // do nothing if the params are empty
-    if (left >= right || top >= bottom) {
+void SkRect::join(const SkRect& r) {
+    if (r.isEmpty()) {
         return;
     }
 
-    // if we are empty, just assign
-    if (fLeft >= fRight || fTop >= fBottom) {
-        this->set(left, top, right, bottom);
+    if (this->isEmpty()) {
+        *this = r;
     } else {
-        fLeft   = SkMinScalar(fLeft, left);
-        fTop    = SkMinScalar(fTop, top);
-        fRight  = SkMaxScalar(fRight, right);
-        fBottom = SkMaxScalar(fBottom, bottom);
+        fLeft   = SkMinScalar(fLeft, r.fLeft);
+        fTop    = SkMinScalar(fTop, r.fTop);
+        fRight  = SkMaxScalar(fRight, r.fRight);
+        fBottom = SkMaxScalar(fBottom, r.fBottom);
     }
 }
 
diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.cpp b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
index 8f5309e..b280820 100644
--- a/src/gpu/vk/GrVkGpuCommandBuffer.cpp
+++ b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
@@ -217,9 +217,8 @@
             cbInfo.fBounds = SkRect::MakeWH(vkRT->width(), vkRT->height());
         }
 
-        if (cbInfo.fBounds.intersect(0, 0,
-                                     SkIntToScalar(fRenderTarget->width()),
-                                     SkIntToScalar(fRenderTarget->height()))) {
+        if (cbInfo.fBounds.intersect(SkRect::MakeIWH(fRenderTarget->width(),
+                                                     fRenderTarget->height()))) {
             // Make sure we do the following layout changes after all copies, uploads, or any other
             // pre-work is done since we may change the layouts in the pre-work. Also since the
             // draws will be submitted in different render passes, we need to guard againts write