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/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