more rect api simplifications
set --> setLTRB
set(pts, count) --> setBounds
Bug: skia:9328
Change-Id: I807c0598a8b23b2f721db118ec41c1607114205a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237038
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
diff --git a/bench/AAClipBench.cpp b/bench/AAClipBench.cpp
index 98bf2c0..abd7ec5 100644
--- a/bench/AAClipBench.cpp
+++ b/bench/AAClipBench.cpp
@@ -33,11 +33,9 @@
doPath ? "path" : "rect",
doAA ? "AA" : "BW");
- fClipRect.set(10.5f, 10.5f,
- 50.5f, 50.5f);
+ fClipRect.setLTRB(10.5f, 10.5f, 50.5f, 50.5f);
fClipPath.addRoundRect(fClipRect, SkIntToScalar(10), SkIntToScalar(10));
- fDrawRect.set(SkIntToScalar(0), SkIntToScalar(0),
- SkIntToScalar(100), SkIntToScalar(100));
+ fDrawRect.setWH(100, 100);
SkASSERT(fClipPath.isConvex());
}
@@ -187,7 +185,7 @@
fName.printf("aaclip_build_%s_%s", doPath ? "path" : "rect",
doAA ? "AA" : "BW");
- fRegion.setRect(0, 0, 640, 480);
+ fRegion.setRect({0, 0, 640, 480});
fRect.set(fRegion.getBounds());
fRect.inset(SK_Scalar1/4, SK_Scalar1/4);
fPath.addRoundRect(fRect, SkIntToScalar(20), SkIntToScalar(20));
diff --git a/bench/AlternatingColorPatternBench.cpp b/bench/AlternatingColorPatternBench.cpp
index 529686a..4bcf0c3 100644
--- a/bench/AlternatingColorPatternBench.cpp
+++ b/bench/AlternatingColorPatternBench.cpp
@@ -121,8 +121,8 @@
int x = (w + offset) * i;
int y = (h * offset) * j;
if (kRect_DrawType == fDrawType) {
- fRects[count].set(SkIntToScalar(x), SkIntToScalar(y),
- SkIntToScalar(x + w), SkIntToScalar(y + h));
+ fRects[count].setXYWH(SkIntToScalar(x), SkIntToScalar(y),
+ SkIntToScalar(w), SkIntToScalar(h));
} else {
fPaths[count].moveTo(SkIntToScalar(x), SkIntToScalar(y));
fPaths[count].rLineTo(SkIntToScalar(w), 0);
diff --git a/bench/BitmapBench.cpp b/bench/BitmapBench.cpp
index 365ca6f..aad28a6 100644
--- a/bench/BitmapBench.cpp
+++ b/bench/BitmapBench.cpp
@@ -113,7 +113,7 @@
SkIntToScalar(SkMin32(w, h))*3/8, p);
SkRect r;
- r.set(0, 0, SkIntToScalar(w), SkIntToScalar(h));
+ r.setWH(SkIntToScalar(w), SkIntToScalar(h));
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(SkIntToScalar(4));
p.setColor(SK_ColorBLUE);
@@ -266,7 +266,7 @@
SkRect r;
for (int x = 0; x < w; x+=2)
{
- r.set(SkIntToScalar(x), 0, SkIntToScalar(x+1), SkIntToScalar(h));
+ r.setLTRB(SkIntToScalar(x), 0, SkIntToScalar(x+1), SkIntToScalar(h));
canvas.drawRect(r, p);
}
@@ -291,7 +291,7 @@
} else if (x % 3 == 2) {
p.setColor(SK_ColorRED); // Opaque
}
- r.set(SkIntToScalar(x), 0, SkIntToScalar(x+1), SkIntToScalar(h));
+ r.setLTRB(SkIntToScalar(x), 0, SkIntToScalar(x+1), SkIntToScalar(h));
canvas.drawRect(r, p);
}
}
diff --git a/bench/BitmapRectBench.cpp b/bench/BitmapRectBench.cpp
index 563f1af..0a13362 100644
--- a/bench/BitmapRectBench.cpp
+++ b/bench/BitmapRectBench.cpp
@@ -26,7 +26,7 @@
SkIntToScalar(SkMin32(w, h))*3/8, p);
SkRect r;
- r.set(0, 0, SkIntToScalar(w), SkIntToScalar(h));
+ r.setWH(SkIntToScalar(w), SkIntToScalar(h));
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(SkIntToScalar(4));
p.setColor(SK_ColorBLUE);
@@ -74,8 +74,8 @@
fBitmap.eraseColor(SK_ColorBLACK);
draw_into_bitmap(fBitmap);
- fSrcR.iset(0, 0, kWidth, kHeight);
- fDstR.iset(0, 0, kWidth, kHeight);
+ fSrcR.setWH(SkIntToScalar(kWidth), SkIntToScalar(kHeight));
+ fDstR.setWH(SkIntToScalar(kWidth), SkIntToScalar(kHeight));
if (fSlightMatrix) {
// want fractional translate
diff --git a/bench/ChromeBench.cpp b/bench/ChromeBench.cpp
index 1457b94..a4f56e9 100644
--- a/bench/ChromeBench.cpp
+++ b/bench/ChromeBench.cpp
@@ -476,8 +476,8 @@
virtual SkIPoint onGetSize() { return SkIPoint::Make(W, H); }
void setRectangle(SkRect& current, int i) {
- current.set(0, 0,
- SkIntToScalar(gmailScrollingRectSpec[i*3+1]), SkIntToScalar(gmailScrollingRectSpec[i*3+2]));
+ current.setWH(SkIntToScalar(gmailScrollingRectSpec[i*3+1]),
+ SkIntToScalar(gmailScrollingRectSpec[i*3+2]));
}
void validateBounds(SkCanvas* canvas) {
#ifdef SK_DEBUG
diff --git a/bench/MatrixBench.cpp b/bench/MatrixBench.cpp
index 485a88a..7248d01 100644
--- a/bench/MatrixBench.cpp
+++ b/bench/MatrixBench.cpp
@@ -313,7 +313,7 @@
fM.setScale(2, 3);
fM.postTranslate(1, 2);
- fR.set(10, 10, 100, 200);
+ fR.setLTRB(10, 10, 100, 200);
}
void performTest() override {
diff --git a/bench/PathBench.cpp b/bench/PathBench.cpp
index e26f120..eb4d4a3 100644
--- a/bench/PathBench.cpp
+++ b/bench/PathBench.cpp
@@ -736,7 +736,7 @@
SkScalar ry = SkMinScalar(rect.height(), yIn);
SkRect arcRect;
- arcRect.set(-rx, -ry, rx, ry);
+ arcRect.setLTRB(-rx, -ry, rx, ry);
switch (startAngle) {
case 0:
arcRect.offset(rect.fRight - arcRect.fRight, rect.fBottom - arcRect.fBottom);
diff --git a/bench/RectBench.cpp b/bench/RectBench.cpp
index 19d36a2..7f9e0ce 100644
--- a/bench/RectBench.cpp
+++ b/bench/RectBench.cpp
@@ -72,8 +72,8 @@
h >>= fShift;
x -= w/2;
y -= h/2;
- fRects[i].set(SkIntToScalar(x), SkIntToScalar(y),
- SkIntToScalar(x+w), SkIntToScalar(y+h));
+ fRects[i].setXYWH(SkIntToScalar(x), SkIntToScalar(y),
+ SkIntToScalar(w), SkIntToScalar(h));
fRects[i].offset(offset, offset);
fColors[i] = rand.nextU() | 0xFF808080;
}
diff --git a/bench/RegionContainBench.cpp b/bench/RegionContainBench.cpp
index 0e28d41..d825320 100644
--- a/bench/RegionContainBench.cpp
+++ b/bench/RegionContainBench.cpp
@@ -42,7 +42,7 @@
fA.op(randrect(rand, i), SkRegion::kXOR_Op);
}
- fB.setRect(0, 0, H, W);
+ fB.setRect({0, 0, H, W});
}
bool isSuitableFor(Backend backend) override {
diff --git a/bench/RepeatTileBench.cpp b/bench/RepeatTileBench.cpp
index 2614450..84c52b7 100644
--- a/bench/RepeatTileBench.cpp
+++ b/bench/RepeatTileBench.cpp
@@ -25,7 +25,7 @@
SkIntToScalar(SkMin32(w, h))*3/8, p);
SkRect r;
- r.set(0, 0, SkIntToScalar(w), SkIntToScalar(h));
+ r.setWH(SkIntToScalar(w), SkIntToScalar(h));
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(SkIntToScalar(4));
p.setColor(SK_ColorBLUE);
diff --git a/bench/ScalarBench.cpp b/bench/ScalarBench.cpp
index e1403f6..714eecc 100644
--- a/bench/ScalarBench.cpp
+++ b/bench/ScalarBench.cpp
@@ -152,7 +152,7 @@
SkRect r;
for (int i = 0; i < loops; ++i) {
for (int i = 0; i < 1000; ++i) {
- r.set(fPts, PTS);
+ r.setBounds(fPts, PTS);
}
}
}
diff --git a/docs/examples/Canvas_drawRegion.cpp b/docs/examples/Canvas_drawRegion.cpp
index 4fd3907..84e4467 100644
--- a/docs/examples/Canvas_drawRegion.cpp
+++ b/docs/examples/Canvas_drawRegion.cpp
@@ -5,8 +5,8 @@
REG_FIDDLE(Canvas_drawRegion, 256, 256, false, 0) {
void draw(SkCanvas* canvas) {
SkRegion region;
- region.op( 10, 10, 50, 50, SkRegion::kUnion_Op);
- region.op( 10, 50, 90, 90, SkRegion::kUnion_Op);
+ region.op({10, 10, 50, 50}, SkRegion::kUnion_Op);
+ region.op({10, 50, 90, 90}, SkRegion::kUnion_Op);
SkPaint paint;
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
diff --git a/docs/examples/IRect_containsNoEmptyCheck.cpp b/docs/examples/IRect_containsNoEmptyCheck.cpp
index 6c51f91..5a5d274 100644
--- a/docs/examples/IRect_containsNoEmptyCheck.cpp
+++ b/docs/examples/IRect_containsNoEmptyCheck.cpp
@@ -8,7 +8,7 @@
SkIRect tests[] = { { 30, 50, 31, 51}, { 39, 49, 40, 50}, { 29, 59, 30, 60} };
for (auto contained : tests) {
bool success = rect.containsNoEmptyCheck(
- contained.left(), contained.top(), contained.right(), contained.bottom());
+ {contained.left(), contained.top(), contained.right(), contained.bottom()});
SkDebugf("rect: (%d, %d, %d, %d) %s (%d, %d, %d, %d)\n",
rect.left(), rect.top(), rect.right(), rect.bottom(),
success ? "contains" : "does not contain",
diff --git a/docs/examples/IRect_contains_2.cpp b/docs/examples/IRect_contains_2.cpp
deleted file mode 100644
index b2926cf..0000000
--- a/docs/examples/IRect_contains_2.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2019 Google LLC.
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-#include "tools/fiddle/examples.h"
-// HASH=eae55f284818d9965ec5834747d14a48
-REG_FIDDLE(IRect_contains_2, 256, 256, true, 0) {
-void draw(SkCanvas* canvas) {
- SkIRect rect = { 30, 50, 40, 60 };
- SkIRect tests[] = { { 30, 50, 31, 51}, { 39, 49, 40, 50}, { 29, 59, 30, 60} };
- for (auto contained : tests) {
- bool success = rect.contains(
- contained.left(), contained.top(), contained.right(), contained.bottom());
- SkDebugf("rect: (%d, %d, %d, %d) %s (%d, %d, %d, %d)\n",
- rect.left(), rect.top(), rect.right(), rect.bottom(),
- success ? "contains" : "does not contain",
- contained.left(), contained.top(), contained.right(), contained.bottom());
- }
-}
-} // END FIDDLE
diff --git a/docs/examples/IRect_intersect_3.cpp b/docs/examples/IRect_intersect_3.cpp
deleted file mode 100644
index 4719bad..0000000
--- a/docs/examples/IRect_intersect_3.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2019 Google LLC.
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-#include "tools/fiddle/examples.h"
-// HASH=200422990eded2f754ab9893118f2645
-REG_FIDDLE(IRect_intersect_3, 256, 256, true, 0) {
-void draw(SkCanvas* canvas) {
- SkIRect leftRect = { 10, 40, 50, 80 };
- SkDebugf("%s intersection: ", leftRect.intersect(30, 60, 70, 90) ? "" : "no ");
- SkDebugf("%d, %d, %d, %d\n", leftRect.left(), leftRect.top(),
- leftRect.right(), leftRect.bottom());
-}
-} // END FIDDLE
diff --git a/docs/examples/IRect_join.cpp b/docs/examples/IRect_join.cpp
deleted file mode 100644
index 80bbc95..0000000
--- a/docs/examples/IRect_join.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2019 Google LLC.
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-#include "tools/fiddle/examples.h"
-// HASH=c00ef06289d21db70340e465690e0e08
-REG_FIDDLE(IRect_join, 256, 256, true, 0) {
-void draw(SkCanvas* canvas) {
- SkIRect rect = { 10, 20, 15, 25};
- rect.join(50, 60, 55, 65);
- SkDebugf("join: %d, %d, %d, %d\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
-}
-} // END FIDDLE
diff --git a/docs/examples/IRect_set.cpp b/docs/examples/IRect_set.cpp
deleted file mode 100644
index aaad9cf..0000000
--- a/docs/examples/IRect_set.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2019 Google LLC.
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-#include "tools/fiddle/examples.h"
-// HASH=1912c37076b7f3bf6aebfa167e971bec
-REG_FIDDLE(IRect_set, 256, 256, true, 0) {
-void draw(SkCanvas* canvas) {
- SkIRect rect1 = {3, 4, 1, 2};
- SkDebugf("rect1: {%d, %d, %d, %d}\n", rect1.fLeft, rect1.fTop, rect1.fRight, rect1.fBottom);
- SkIRect rect2;
- rect2.set(3, 4, 1, 2);
- SkDebugf("rect2: {%d, %d, %d, %d}\n", rect2.fLeft, rect2.fTop, rect2.fRight, rect2.fBottom);
-}
-} // END FIDDLE
diff --git a/docs/examples/Image_Filter_Methods.cpp b/docs/examples/Image_Filter_Methods.cpp
index 5d747ae..25c0619 100644
--- a/docs/examples/Image_Filter_Methods.cpp
+++ b/docs/examples/Image_Filter_Methods.cpp
@@ -10,8 +10,8 @@
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(2);
SkRegion region;
- region.op( 10, 10, 50, 50, SkRegion::kUnion_Op);
- region.op( 10, 50, 90, 90, SkRegion::kUnion_Op);
+ region.op({10, 10, 50, 50}, SkRegion::kUnion_Op);
+ region.op({10, 50, 90, 90}, SkRegion::kUnion_Op);
paint.setImageFilter(SkImageFilters::Blur(5.0f, 5.0f, nullptr));
canvas->drawRegion(region, paint);
paint.setImageFilter(nullptr);
diff --git a/docs/examples/Paint_setStyle.cpp b/docs/examples/Paint_setStyle.cpp
index b720aff..0f8dba4 100644
--- a/docs/examples/Paint_setStyle.cpp
+++ b/docs/examples/Paint_setStyle.cpp
@@ -7,8 +7,8 @@
SkPaint paint;
paint.setStrokeWidth(5);
SkRegion region;
- region.op(140, 10, 160, 30, SkRegion::kUnion_Op);
- region.op(170, 40, 190, 60, SkRegion::kUnion_Op);
+ region.op({140, 10, 160, 30}, SkRegion::kUnion_Op);
+ region.op({170, 40, 190, 60}, SkRegion::kUnion_Op);
SkBitmap bitmap;
bitmap.setInfo(SkImageInfo::MakeA8(50, 50), 50);
uint8_t pixels[50][50];
diff --git a/docs/examples/Rect_iset.cpp b/docs/examples/Rect_iset.cpp
deleted file mode 100644
index 28e6d79..0000000
--- a/docs/examples/Rect_iset.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2019 Google LLC.
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-#include "tools/fiddle/examples.h"
-// HASH=18532f1aa90b76364fb8d7ea072f1892
-REG_FIDDLE(Rect_iset, 256, 256, true, 0) {
-void draw(SkCanvas* canvas) {
- SkRect rect1 = {3, 4, 1, 2};
- SkDebugf("rect1: {%g, %g, %g, %g}\n", rect1.fLeft, rect1.fTop, rect1.fRight, rect1.fBottom);
- SkRect rect2;
- rect2.iset(3, 4, 1, 2);
- SkDebugf("rect2: {%g, %g, %g, %g}\n", rect2.fLeft, rect2.fTop, rect2.fRight, rect2.fBottom);
-}
-} // END FIDDLE
diff --git a/docs/examples/Rect_isetWH.cpp b/docs/examples/Rect_isetWH.cpp
deleted file mode 100644
index 19a23f9..0000000
--- a/docs/examples/Rect_isetWH.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2019 Google LLC.
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-#include "tools/fiddle/examples.h"
-// HASH=ee6000080fc7123214ea404018cf9176
-REG_FIDDLE(Rect_isetWH, 256, 256, true, 0) {
-void draw(SkCanvas* canvas) {
- SkRect rect1 = {0, 0, 1, 2};
- SkDebugf("rect1: {%g, %g, %g, %g}\n", rect1.fLeft, rect1.fTop, rect1.fRight, rect1.fBottom);
- SkRect rect2;
- rect2.isetWH(1, 2);
- SkDebugf("rect2: {%g, %g, %g, %g}\n", rect2.fLeft, rect2.fTop, rect2.fRight, rect2.fBottom);
-}
-} // END FIDDLE
diff --git a/docs/examples/Rect_set_2.cpp b/docs/examples/Rect_set_2.cpp
deleted file mode 100644
index 0179a3e..0000000
--- a/docs/examples/Rect_set_2.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2019 Google LLC.
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-#include "tools/fiddle/examples.h"
-// HASH=9b29ea460d69b4d47323fd9e3e17721e
-REG_FIDDLE(Rect_set_2, 256, 256, true, 0) {
-void draw(SkCanvas* canvas) {
- SkRect rect1 = {3, 4, 1, 2};
- SkDebugf("rect1: {%g, %g, %g, %g}\n", rect1.fLeft, rect1.fTop, rect1.fRight, rect1.fBottom);
- SkRect rect2;
- rect2.set(3, 4, 1, 2);
- SkDebugf("rect2: {%g, %g, %g, %g}\n", rect2.fLeft, rect2.fTop, rect2.fRight, rect2.fBottom);
-}
-} // END FIDDLE
diff --git a/docs/examples/Rect_set_3.cpp b/docs/examples/Rect_set_3.cpp
deleted file mode 100644
index 0a78941..0000000
--- a/docs/examples/Rect_set_3.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2019 Google LLC.
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-#include "tools/fiddle/examples.h"
-// HASH=94295fa5197e21256171b99b4023dd48
-REG_FIDDLE(Rect_set_3, 256, 256, true, 0) {
-void draw(SkCanvas* canvas) {
- SkPoint points[] = {{3, 4}, {1, 2}, {5, 6}, {SK_ScalarNaN, 8}};
- for (int count = 0; count <= (int) SK_ARRAY_COUNT(points); ++count) {
- SkRect rect;
- rect.set(points, count);
- if (count > 0) {
- SkDebugf("added: %3g, %g ", points[count - 1].fX, points[count - 1].fY);
- } else {
- SkDebugf("%14s", " ");
- }
- SkDebugf("count: %d rect: %g, %g, %g, %g\n", count,
- rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
- }
-}
-} // END FIDDLE
diff --git a/docs/examples/Region_quickContains_2.cpp b/docs/examples/Region_quickContains_2.cpp
deleted file mode 100644
index f3ae2b60..0000000
--- a/docs/examples/Region_quickContains_2.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2019 Google LLC.
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-#include "tools/fiddle/examples.h"
-// HASH=eb6d290887e1a3a0b051b4d7b012f5e1
-REG_FIDDLE(Region_quickContains_2, 256, 256, true, 0) {
-void draw(SkCanvas* canvas) {
- auto debugster = [](const char* label, SkRegion& region) -> void {
- SkDebugf("%s: %s\n", label, region.quickContains(2, 2, 3, 3) ? "true" : "false");
- };
- SkRegion region({1, 2, 3, 4});
- debugster("quickContains 1", region);
- region.op({1, 4, 3, 6}, SkRegion::kUnion_Op);
- debugster("quickContains 2", region);
- region.op({1, 7, 3, 8}, SkRegion::kUnion_Op);
- debugster("quickContains 3", region);
-}
-} // END FIDDLE
diff --git a/docs/examples/Region_setRect_2.cpp b/docs/examples/Region_setRect_2.cpp
deleted file mode 100644
index 7c9c973..0000000
--- a/docs/examples/Region_setRect_2.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2019 Google LLC.
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-#include "tools/fiddle/examples.h"
-// HASH=5b31a1b077818a8150ad50f3b19e7bfe
-REG_FIDDLE(Region_setRect_2, 256, 256, true, 0) {
-void draw(SkCanvas* canvas) {
- auto debugster = [](const char* label, bool success, SkRegion& region) -> void {
- auto r = region.getBounds();
- SkDebugf("%14s: success:%s {%d,%d,%d,%d}\n", label, success ? "true" : "false",
- r.fLeft, r.fTop, r.fRight, r.fBottom);
- };
- SkRegion region;
- bool success = region.setRect(1, 2, 3, 4);
- debugster("set to: 1,2,3,4", success, region);
- success = region.setRect(3, 2, 1, 4);
- debugster("set to: 3,2,1,4", success, region);
-}
-} // END FIDDLE
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
index 0cab138..6d04a1d 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -249,7 +249,7 @@
SkRect bounds;
//SkPoint bPts[] = {{0.f, 0.f}, {800.f, 800.f}};
//bounds.set(bPts, 2);
- bounds.set(pts, 3);
+ bounds.setBounds(pts, 3);
SkPaint boundsPaint;
boundsPaint.setColor(0xff808080);
@@ -449,7 +449,7 @@
}
SkRect bounds;
- bounds.set(pts, 3);
+ bounds.setBounds(pts, 3);
SkPaint boundsPaint;
boundsPaint.setColor(0xff808080);
diff --git a/gm/bleed.cpp b/gm/bleed.cpp
index 5454e3a..b182fb4 100644
--- a/gm/bleed.cpp
+++ b/gm/bleed.cpp
@@ -113,7 +113,7 @@
scanline[x] = outerRingColor;
}
result->fBitmap.setImmutable();
- result->fRect.set(2, 2, width - 2, height - 2);
+ result->fRect.setLTRB(2, 2, width - 2, height - 2);
return true;
}
diff --git a/gm/coloremoji_blendmodes.cpp b/gm/coloremoji_blendmodes.cpp
index 2cdf685..250fbbb 100644
--- a/gm/coloremoji_blendmodes.cpp
+++ b/gm/coloremoji_blendmodes.cpp
@@ -128,7 +128,7 @@
SkScalar x = x0, y = y0;
for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); i++) {
SkRect r;
- r.set(x, y, x+w, y+h);
+ r.setLTRB(x, y, x+w, y+h);
SkPaint p;
p.setStyle(SkPaint::kFill_Style);
diff --git a/gm/complexclip2.cpp b/gm/complexclip2.cpp
index 4e49e8f..46e2aad 100644
--- a/gm/complexclip2.cpp
+++ b/gm/complexclip2.cpp
@@ -65,27 +65,27 @@
SkScalar yE = 40.65f;
SkScalar yF = 50.65f;
- fRects[0].set(xB, yB, xE, yE);
+ fRects[0].setLTRB(xB, yB, xE, yE);
fRRects[0].setRectXY(fRects[0], 7, 7);
fPaths[0].addRoundRect(fRects[0], 5, 5);
fRectColors[0] = SK_ColorRED;
- fRects[1].set(xA, yA, xD, yD);
+ fRects[1].setLTRB(xA, yA, xD, yD);
fRRects[1].setRectXY(fRects[1], 7, 7);
fPaths[1].addRoundRect(fRects[1], 5, 5);
fRectColors[1] = SK_ColorGREEN;
- fRects[2].set(xC, yA, xF, yD);
+ fRects[2].setLTRB(xC, yA, xF, yD);
fRRects[2].setRectXY(fRects[2], 7, 7);
fPaths[2].addRoundRect(fRects[2], 5, 5);
fRectColors[2] = SK_ColorBLUE;
- fRects[3].set(xA, yC, xD, yF);
+ fRects[3].setLTRB(xA, yC, xD, yF);
fRRects[3].setRectXY(fRects[3], 7, 7);
fPaths[3].addRoundRect(fRects[3], 5, 5);
fRectColors[3] = SK_ColorYELLOW;
- fRects[4].set(xC, yC, xF, yF);
+ fRects[4].setLTRB(xC, yC, xF, yF);
fRRects[4].setRectXY(fRects[4], 7, 7);
fPaths[4].addRoundRect(fRects[4], 5, 5);
fRectColors[4] = SK_ColorCYAN;
diff --git a/gm/drawregion.cpp b/gm/drawregion.cpp
index 0f9dcc9..8848934 100644
--- a/gm/drawregion.cpp
+++ b/gm/drawregion.cpp
@@ -36,7 +36,7 @@
void onOnceBeforeDraw() override {
for (int x = 50; x < 250; x+=2) {
for (int y = 50; y < 250; y+=2) {
- fRegion.op(x, y, x + 1, y + 1, SkRegion::kUnion_Op);
+ fRegion.op({x, y, x + 1, y + 1}, SkRegion::kUnion_Op);
}
}
}
diff --git a/gm/drawregionmodes.cpp b/gm/drawregionmodes.cpp
index b069e74..3b153a0 100644
--- a/gm/drawregionmodes.cpp
+++ b/gm/drawregionmodes.cpp
@@ -37,8 +37,8 @@
}
void onOnceBeforeDraw() override {
- fRegion.op( 50, 50, 100, 100, SkRegion::kUnion_Op);
- fRegion.op( 50, 100, 150, 150, SkRegion::kUnion_Op);
+ fRegion.op({50, 50, 100, 100}, SkRegion::kUnion_Op);
+ fRegion.op({50, 100, 150, 150}, SkRegion::kUnion_Op);
}
void onDraw(SkCanvas* canvas) override {
diff --git a/gm/fontscaler.cpp b/gm/fontscaler.cpp
index ce83a3c..b92f877 100644
--- a/gm/fontscaler.cpp
+++ b/gm/fontscaler.cpp
@@ -48,8 +48,8 @@
for (int j = 0; j < 2; ++j) {
// This used to do 6 iterations but it causes the N4 to crash in the MSAA4 config.
for (int i = 0; i < 5; ++i) {
- SkScalar x = SkIntToScalar(10);
- SkScalar y = SkIntToScalar(20);
+ SkScalar x = 10;
+ SkScalar y = 20;
SkAutoCanvasRestore acr(canvas, true);
canvas->translate(SkIntToScalar(50 + i * 230),
@@ -60,8 +60,7 @@
SkPaint p;
p.setAntiAlias(true);
SkRect r;
- r.set(x - SkIntToScalar(3), SkIntToScalar(15),
- x - SkIntToScalar(1), SkIntToScalar(280));
+ r.setLTRB(x - 3, 15, x - 1, 280);
canvas->drawRect(r, p);
}
diff --git a/gm/fontscalerdistortable.cpp b/gm/fontscalerdistortable.cpp
index 441e705..1762dbc 100644
--- a/gm/fontscalerdistortable.cpp
+++ b/gm/fontscalerdistortable.cpp
@@ -94,8 +94,7 @@
SkPaint p;
p.setAntiAlias(true);
SkRect r;
- r.set(x - SkIntToScalar(3), SkIntToScalar(15),
- x - SkIntToScalar(1), SkIntToScalar(280));
+ r.setLTRB(x - 3, 15, x - 1, 280);
canvas->drawRect(r, p);
}
diff --git a/gm/image.cpp b/gm/image.cpp
index b745b36..6211f48 100644
--- a/gm/image.cpp
+++ b/gm/image.cpp
@@ -88,16 +88,16 @@
surf->draw(canvas, 0, 160, usePaint ? &paint : nullptr);
SkRect src1, src2, src3;
- src1.iset(0, 0, surf->width(), surf->height());
- src2.iset(-surf->width() / 2, -surf->height() / 2,
- surf->width(), surf->height());
- src3.iset(0, 0, surf->width() / 2, surf->height() / 2);
+ src1.setIWH(surf->width(), surf->height());
+ src2.setLTRB(SkIntToScalar(-surf->width() / 2), SkIntToScalar(-surf->height() / 2),
+ SkIntToScalar(surf->width()), SkIntToScalar(surf->height()));
+ src3.setIWH(surf->width() / 2, surf->height() / 2);
SkRect dst1, dst2, dst3, dst4;
- dst1.set(0, 240, 65, 305);
- dst2.set(0, 320, 65, 385);
- dst3.set(0, 400, 65, 465);
- dst4.set(0, 480, 65, 545);
+ dst1.setLTRB(0, 240, 65, 305);
+ dst2.setLTRB(0, 320, 65, 385);
+ dst3.setLTRB(0, 400, 65, 465);
+ dst4.setLTRB(0, 480, 65, 545);
canvas->drawImageRect(imgR, src1, dst1, usePaint ? &paint : nullptr);
canvas->drawImageRect(imgG, src2, dst2, usePaint ? &paint : nullptr);
diff --git a/gm/polygonoffset.cpp b/gm/polygonoffset.cpp
index 9703dd0..9cdd9ea 100644
--- a/gm/polygonoffset.cpp
+++ b/gm/polygonoffset.cpp
@@ -519,7 +519,7 @@
} else {
GetSimplePolygon(index, SkPath::kCW_Direction, &data, &numPts);
}
- bounds.set(data.get(), numPts);
+ bounds.setBounds(data.get(), numPts);
if (!fConvexOnly) {
bounds.outset(kMaxOutset, kMaxOutset);
}
diff --git a/gm/samplerstress.cpp b/gm/samplerstress.cpp
index 0f8c124..1d5a241 100644
--- a/gm/samplerstress.cpp
+++ b/gm/samplerstress.cpp
@@ -111,10 +111,7 @@
SkFont font(ToolUtils::create_portable_typeface(), 72);
SkRect temp;
- temp.set(SkIntToScalar(115),
- SkIntToScalar(75),
- SkIntToScalar(144),
- SkIntToScalar(110));
+ temp.setLTRB(115, 75, 144, 110);
SkPath path;
path.addRoundRect(temp, SkIntToScalar(5), SkIntToScalar(5));
diff --git a/gm/simpleaaclip.cpp b/gm/simpleaaclip.cpp
index cb1e184..b28aaf1 100644
--- a/gm/simpleaaclip.cpp
+++ b/gm/simpleaaclip.cpp
@@ -69,10 +69,10 @@
protected:
void onOnceBeforeDraw() override {
// offset the rects a bit so we get anti-aliasing in the rect case
- fBase.set(100.65f,
- 100.65f,
- 150.65f,
- 150.65f);
+ fBase.setLTRB(100.65f,
+ 100.65f,
+ 150.65f,
+ 150.65f);
fRect = fBase;
fRect.inset(5, 5);
fRect.offset(25, 25);
diff --git a/gm/strokerects.cpp b/gm/strokerects.cpp
index 4a768e3..402f65a 100644
--- a/gm/strokerects.cpp
+++ b/gm/strokerects.cpp
@@ -45,7 +45,7 @@
SkScalar hoffset = rand.nextSScalar1();
SkScalar woffset = rand.nextSScalar1();
- r->set(x, y, x + w, y + h);
+ r->setXYWH(x, y, w, h);
r->offset(-w/2 + woffset, -h/2 + hoffset);
}
diff --git a/gm/strokes.cpp b/gm/strokes.cpp
index 0a6cc15..a2e7bfd 100644
--- a/gm/strokes.cpp
+++ b/gm/strokes.cpp
@@ -40,7 +40,7 @@
SkScalar hoffset = rand.nextSScalar1();
SkScalar woffset = rand.nextSScalar1();
- r->set(x, y, x + w, y + h);
+ r->setXYWH(x, y, w, h);
r->offset(-w/2 + woffset, -h/2 + hoffset);
paint->setColor(rand.nextU());
diff --git a/gm/windowrectangles.cpp b/gm/windowrectangles.cpp
index 5baba86..2763b8c 100644
--- a/gm/windowrectangles.cpp
+++ b/gm/windowrectangles.cpp
@@ -162,7 +162,7 @@
bool quickContains(const SkRect&) const final { return false; }
bool isRRect(const SkRect& rtBounds, SkRRect* rr, GrAA*) const final { return false; }
void getConservativeBounds(int width, int height, SkIRect* rect, bool* iior) const final {
- rect->set(0, 0, width, height);
+ rect->setWH(width, height);
if (iior) {
*iior = false;
}
diff --git a/gm/xfermodes.cpp b/gm/xfermodes.cpp
index 9b5fcc6..6ddabe7 100644
--- a/gm/xfermodes.cpp
+++ b/gm/xfermodes.cpp
@@ -103,7 +103,7 @@
{
SkCanvas c(*src);
p.setColor(ToolUtils::color_to_565(0xFFFFCC44));
- r.set(0, 0, ww*3/4, hh*3/4);
+ r.setWH(ww*3/4, hh*3/4);
c.drawOval(r, p);
}
@@ -113,7 +113,7 @@
{
SkCanvas c(*dst);
p.setColor(ToolUtils::color_to_565(0xFF66AAFF));
- r.set(ww/3, hh/3, ww*19/20, hh*19/20);
+ r.setLTRB(ww/3, hh/3, ww*19/20, hh*19/20);
c.drawRect(r, p);
}
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index 8b9da27..3e2219e 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -228,30 +228,25 @@
left and right are not sorted; left is not necessarily less than right.
top and bottom are not sorted; top is not necessarily less than bottom.
- @param left assigned to fLeft
- @param top assigned to fTop
- @param right assigned to fRight
- @param bottom assigned to fBottom
- */
- void set(int32_t left, int32_t top, int32_t right, int32_t bottom) {
- fLeft = left;
- fTop = top;
- fRight = right;
- fBottom = bottom;
- }
-
- /** Sets SkIRect to (left, top, right, bottom).
- left and right are not sorted; left is not necessarily less than right.
- top and bottom are not sorted; top is not necessarily less than bottom.
-
@param left stored in fLeft
@param top stored in fTop
@param right stored in fRight
@param bottom stored in fBottom
*/
void setLTRB(int32_t left, int32_t top, int32_t right, int32_t bottom) {
- this->set(left, top, right, bottom);
+ fLeft = left;
+ fTop = top;
+ fRight = right;
+ fBottom = bottom;
}
+#ifdef SK_SUPPORT_LEGACY_RECT_PARAMS
+ void set(int32_t left, int32_t top, int32_t right, int32_t bottom) {
+ fLeft = left;
+ fTop = top;
+ fRight = right;
+ fBottom = bottom;
+ }
+#endif
/** Sets SkIRect to: (x, y, x + width, y + height).
Does not validate input; width or height may be negative.
@@ -268,6 +263,13 @@
fBottom = Sk32_sat_add(y, height);
}
+ void setWH(int32_t width, int32_t height) {
+ fLeft = 0;
+ fTop = 0;
+ fRight = width;
+ fBottom = height;
+ }
+
/** Returns SkIRect offset by (dx, dy).
If dx is negative, SkIRect returned is moved to the left.
@@ -432,37 +434,26 @@
return x >= fLeft && x < fRight && y >= fTop && y < fBottom;
}
- /** Constructs SkIRect to intersect from (left, top, right, bottom). Does not sort
- construction.
-
- Returns true if SkIRect contains construction.
- Returns false if SkIRect is empty or construction is empty.
-
- @param left x-axis minimum of constructed SkIRect
- @param top y-axis minimum of constructed SkIRect
- @param right x-axis maximum of constructed SkIRect
- @param bottom y-axis maximum of constructed SkIRect
- @return true if all sides of SkIRect are outside construction
- */
- bool contains(int32_t left, int32_t top, int32_t right, int32_t bottom) const {
- return left < right && top < bottom && !this->isEmpty() && // check for empties
- fLeft <= left && fTop <= top &&
- fRight >= right && fBottom >= bottom;
- }
-
/** Returns true if SkIRect contains r.
- Returns false if SkIRect is empty or r is empty.
+ Returns false if SkIRect is empty or r is empty.
- SkIRect contains r when SkIRect area completely includes r area.
+ SkIRect contains r when SkIRect area completely includes r area.
- @param r SkIRect contained
- @return true if all sides of SkIRect are outside r
- */
+ @param r SkIRect contained
+ @return true if all sides of SkIRect are outside r
+ */
bool contains(const SkIRect& r) const {
return !r.isEmpty() && !this->isEmpty() && // check for empties
fLeft <= r.fLeft && fTop <= r.fTop &&
fRight >= r.fRight && fBottom >= r.fBottom;
}
+#ifdef SK_SUPPORT_LEGACY_RECT_PARAMS
+ bool contains(int32_t left, int32_t top, int32_t right, int32_t bottom) const {
+ return left < right && top < bottom && !this->isEmpty() && // check for empties
+ fLeft <= left && fTop <= top &&
+ fRight >= right && fBottom >= bottom;
+ }
+#endif
/** Returns true if SkIRect contains r.
Returns false if SkIRect is empty or r is empty.
@@ -472,30 +463,7 @@
@param r SkRect contained
@return true if all sides of SkIRect are outside r
*/
- bool contains(const SkRect& r) const;
-
- /** Constructs SkIRect from (left, top, right, bottom). Does not sort
- construction.
-
- Returns true if SkIRect contains construction.
- Asserts if SkIRect is empty or construction is empty, and if SK_DEBUG is defined.
-
- Return is undefined if SkIRect is empty or construction is empty.
-
- @param left x-axis minimum of constructed SkIRect
- @param top y-axis minimum of constructed SkIRect
- @param right x-axis maximum of constructed SkIRect
- @param bottom y-axis maximum of constructed SkIRect
- @return true if all sides of SkIRect are outside construction
- */
- bool containsNoEmptyCheck(int32_t left, int32_t top,
- int32_t right, int32_t bottom) const {
- SkASSERT(fLeft < fRight && fTop < fBottom);
- SkASSERT(left < right && top < bottom);
-
- return fLeft <= left && fTop <= top &&
- fRight >= right && fBottom >= bottom;
- }
+ inline bool contains(const SkRect& r) const;
/** Returns true if SkIRect contains construction.
Asserts if SkIRect is empty or construction is empty, and if SK_DEBUG is defined.
@@ -506,8 +474,20 @@
@return true if all sides of SkIRect are outside r
*/
bool containsNoEmptyCheck(const SkIRect& r) const {
- return containsNoEmptyCheck(r.fLeft, r.fTop, r.fRight, r.fBottom);
+ SkASSERT(fLeft < fRight && fTop < fBottom);
+ SkASSERT(r.fLeft < r.fRight && r.fTop < r.fBottom);
+ return fLeft <= r.fLeft && fTop <= r.fTop && fRight >= r.fRight && fBottom >= r.fBottom;
}
+#ifdef SK_SUPPORT_LEGACY_RECT_PARAMS
+ bool containsNoEmptyCheck(int32_t left, int32_t top,
+ int32_t right, int32_t bottom) const {
+ SkASSERT(fLeft < fRight && fTop < fBottom);
+ SkASSERT(left < right && top < bottom);
+
+ return fLeft <= left && fTop <= top &&
+ fRight >= right && fBottom >= bottom;
+ }
+#endif
/** Returns true if SkIRect intersects r, and sets SkIRect to intersection.
Returns false if SkIRect does not intersect r, and leaves SkIRect unchanged.
@@ -517,9 +497,12 @@
@param r limit of result
@return true if r and SkIRect have area in common
*/
- bool intersect(const SkIRect& r) {
- return this->intersect(*this, r);
+ bool intersect(const SkIRect& r);
+#ifdef SK_SUPPORT_LEGACY_RECT_PARAMS
+ bool intersect(int32_t left, int32_t top, int32_t right, int32_t bottom) {
+ return this->intersect(*this, {left, top, right, bottom});
}
+#endif
/** Returns true if a intersects b, and sets SkIRect to intersection.
Returns false if a does not intersect b, and leaves SkIRect unchanged.
@@ -561,24 +544,6 @@
return this->intersectNoEmptyCheck(a, b);
}
- /** Constructs SkIRect to intersect from (left, top, right, bottom). Does not sort
- construction.
-
- Returns true if SkIRect intersects construction, and sets SkIRect to intersection.
- Returns false if SkIRect does not intersect construction, and leaves SkIRect unchanged.
-
- Returns false if either construction or SkIRect is empty, leaving SkIRect unchanged.
-
- @param left x-axis minimum of constructed SkIRect
- @param top y-axis minimum of constructed SkIRect
- @param right x-axis maximum of constructed SkIRect
- @param bottom y-axis maximum of constructed SkIRect
- @return true if construction and SkIRect have area in common
- */
- bool intersect(int32_t left, int32_t top, int32_t right, int32_t bottom) {
- return this->intersect(*this, {left, top, right, bottom});
- }
-
/** Returns true if a intersects b.
Returns false if either a or b is empty, or do not intersect.
@@ -603,30 +568,18 @@
return dummy.intersectNoEmptyCheck(a, b);
}
- /** Constructs SkIRect to intersect from (left, top, right, bottom). Does not sort
- construction.
-
- Sets SkIRect to the union of itself and the construction.
-
- Has no effect if construction is empty. Otherwise, if SkIRect is empty, sets
- SkIRect to construction.
-
- @param left x-axis minimum of constructed SkIRect
- @param top y-axis minimum of constructed SkIRect
- @param right x-axis maximum of constructed SkIRect
- @param bottom y-axis maximum of constructed SkIRect
- */
- void join(int32_t left, int32_t top, int32_t right, int32_t bottom);
-
/** Sets SkIRect to the union of itself and r.
- Has no effect if r is empty. Otherwise, if SkIRect is empty, sets SkIRect to r.
+ Has no effect if r is empty. Otherwise, if SkIRect is empty, sets SkIRect to r.
- @param r expansion SkIRect
- */
- void join(const SkIRect& r) {
- this->join(r.fLeft, r.fTop, r.fRight, r.fBottom);
+ @param r expansion SkIRect
+ */
+ void join(const SkIRect& r);
+#ifdef SK_SUPPORT_LEGACY_RECT_PARAMS
+ void join(int32_t left, int32_t top, int32_t right, int32_t bottom) {
+ this->join({left, top, right, bottom});
}
+#endif
/** Swaps fLeft and fRight if fLeft is greater than fRight; and swaps
fTop and fBottom if fTop is greater than fBottom. Result may be empty,
@@ -712,9 +665,7 @@
@return bounds (0, 0, w, h)
*/
static SkRect SK_WARN_UNUSED_RESULT MakeIWH(int w, int h) {
- SkRect r;
- r.set(0, 0, SkIntToScalar(w), SkIntToScalar(h));
- return r;
+ return {0, 0, SkIntToScalar(w), SkIntToScalar(h)};
}
/** Returns constructed SkRect set to (0, 0, size.width(), size.height()). Does not
@@ -773,12 +724,10 @@
@return irect members converted to SkScalar
*/
static SkRect SK_WARN_UNUSED_RESULT Make(const SkIRect& irect) {
- SkRect r;
- r.set(SkIntToScalar(irect.fLeft),
- SkIntToScalar(irect.fTop),
- SkIntToScalar(irect.fRight),
- SkIntToScalar(irect.fBottom));
- return r;
+ return {
+ SkIntToScalar(irect.fLeft), SkIntToScalar(irect.fTop),
+ SkIntToScalar(irect.fRight), SkIntToScalar(irect.fBottom)
+ };
}
/** Returns true if fLeft is equal to or greater than fRight, or if fTop is equal
@@ -954,21 +903,14 @@
fBottom = SkIntToScalar(src.fBottom);
}
- /** Sets SkRect to (left, top, right, bottom).
- left and right are not sorted; left is not necessarily less than right.
- top and bottom are not sorted; top is not necessarily less than bottom.
-
- @param left stored in fLeft
- @param top stored in fTop
- @param right stored in fRight
- @param bottom stored in fBottom
- */
+#ifdef SK_SUPPORT_LEGACY_RECT_PARAMS
void set(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) {
fLeft = left;
fTop = top;
fRight = right;
fBottom = bottom;
}
+#endif
/** Sets SkRect to (left, top, right, bottom).
left and right are not sorted; left is not necessarily less than right.
@@ -980,54 +922,25 @@
@param bottom stored in fBottom
*/
void setLTRB(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) {
- this->set(left, top, right, bottom);
+ fLeft = left;
+ fTop = top;
+ fRight = right;
+ fBottom = bottom;
}
- /** Sets SkRect to (left, top, right, bottom).
- All parameters are promoted from integer to scalar.
- left and right are not sorted; left is not necessarily less than right.
- top and bottom are not sorted; top is not necessarily less than bottom.
-
- @param left promoted to SkScalar and stored in fLeft
- @param top promoted to SkScalar and stored in fTop
- @param right promoted to SkScalar and stored in fRight
- @param bottom promoted to SkScalar and stored in fBottom
- */
+#ifdef SK_SUPPORT_LEGACY_RECT_PARAMS
void iset(int left, int top, int right, int bottom) {
fLeft = SkIntToScalar(left);
fTop = SkIntToScalar(top);
fRight = SkIntToScalar(right);
fBottom = SkIntToScalar(bottom);
}
-
- /** Sets SkRect to (0, 0, width, height).
- width and height may be zero or negative. width and height are promoted from
- integer to SkScalar, large values may lose precision.
-
- @param width promoted to SkScalar and stored in fRight
- @param height promoted to SkScalar and stored in fBottom
- */
void isetWH(int width, int height) {
fLeft = fTop = 0;
fRight = SkIntToScalar(width);
fBottom = SkIntToScalar(height);
}
-
- /** Sets to bounds of SkPoint array with count entries. If count is zero or smaller,
- or if SkPoint array contains an infinity or NaN, sets SkRect to (0, 0, 0, 0).
-
- Result is either empty or sorted: fLeft is less than or equal to fRight, and
- fTop is less than or equal to fBottom.
-
- @param pts SkPoint array
- @param count entries in array
- */
- void set(const SkPoint pts[], int count) {
- // set() had been checking for non-finite values, so keep that behavior
- // for now. Now that we have setBoundsCheck(), we may decide to make
- // set() be simpler/faster, and not check for those.
- (void)this->setBoundsCheck(pts, count);
- }
+#endif
/** Sets to bounds of SkPoint array with count entries. If count is zero or smaller,
or if SkPoint array contains an infinity or NaN, sets to (0, 0, 0, 0).
@@ -1041,6 +954,14 @@
void setBounds(const SkPoint pts[], int count) {
(void)this->setBoundsCheck(pts, count);
}
+#ifdef SK_SUPPORT_LEGACY_RECT_PARAMS
+ void set(const SkPoint pts[], int count) {
+ // set() had been checking for non-finite values, so keep that behavior
+ // for now. Now that we have setBoundsCheck(), we may decide to make
+ // set() be simpler/faster, and not check for those.
+ (void)this->setBoundsCheck(pts, count);
+ }
+#endif
/** Sets to bounds of SkPoint array with count entries. Returns false if count is
zero or smaller, or if SkPoint array contains an infinity or NaN; in these cases
@@ -1103,6 +1024,9 @@
fRight = width;
fBottom = height;
}
+ void setIWH(int32_t width, int32_t height) {
+ this->setWH(SkIntToScalar(width), SkIntToScalar(height));
+ }
/** Returns SkRect offset by (dx, dy).
@@ -1385,8 +1309,8 @@
*/
void round(SkIRect* dst) const {
SkASSERT(dst);
- dst->set(SkScalarRoundToInt(fLeft), SkScalarRoundToInt(fTop),
- SkScalarRoundToInt(fRight), SkScalarRoundToInt(fBottom));
+ dst->setLTRB(SkScalarRoundToInt(fLeft), SkScalarRoundToInt(fTop),
+ SkScalarRoundToInt(fRight), SkScalarRoundToInt(fBottom));
}
/** Sets SkIRect by discarding the fractional portion of fLeft and fTop; and rounding
@@ -1398,8 +1322,8 @@
*/
void roundOut(SkIRect* dst) const {
SkASSERT(dst);
- dst->set(SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop),
- SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom));
+ dst->setLTRB(SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop),
+ SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom));
}
/** Sets SkRect by discarding the fractional portion of fLeft and fTop; and rounding
@@ -1410,10 +1334,8 @@
@param dst storage for SkRect
*/
void roundOut(SkRect* dst) const {
- dst->set(SkScalarFloorToScalar(fLeft),
- SkScalarFloorToScalar(fTop),
- SkScalarCeilToScalar(fRight),
- SkScalarCeilToScalar(fBottom));
+ dst->setLTRB(SkScalarFloorToScalar(fLeft), SkScalarFloorToScalar(fTop),
+ SkScalarCeilToScalar(fRight), SkScalarCeilToScalar(fBottom));
}
/** Sets SkRect by rounding up fLeft and fTop; and discarding the fractional portion
@@ -1425,8 +1347,8 @@
*/
void roundIn(SkIRect* dst) const {
SkASSERT(dst);
- dst->set(SkScalarCeilToInt(fLeft), SkScalarCeilToInt(fTop),
- SkScalarFloorToInt(fRight), SkScalarFloorToInt(fBottom));
+ dst->setLTRB(SkScalarCeilToInt(fLeft), SkScalarCeilToInt(fTop),
+ SkScalarFloorToInt(fRight), SkScalarFloorToInt(fBottom));
}
/** Returns SkIRect by adding 0.5 and discarding the fractional portion of SkRect
diff --git a/include/core/SkRegion.h b/include/core/SkRegion.h
index cfe25c5..742ac7f 100644
--- a/include/core/SkRegion.h
+++ b/include/core/SkRegion.h
@@ -177,20 +177,11 @@
@return true if rect is not empty
*/
bool setRect(const SkIRect& rect);
-
- /** Constructs SkRegion with bounds (left, top, right, bottom).
- Returns true if left is less than right and top is less than bottom; otherwise,
- constructs empty SkRegion and returns false.
-
- @param left edge of bounds on x-axis
- @param top edge of bounds on y-axis
- @param right edge of bounds on x-axis
- @param bottom edge of bounds on y-axis
- @return rectangular SkRegion
- */
+#ifdef SK_SUPPORT_LEGACY_RECT_PARAMS
bool setRect(int32_t left, int32_t top, int32_t right, int32_t bottom) {
return this->setRect({ left, top, right, bottom });
}
+#endif
/** Constructs SkRegion as the union of SkIRect in rects array. If count is
zero, constructs empty SkRegion. Returns false if constructed SkRegion is empty.
@@ -277,22 +268,16 @@
@return true quickly if r points are equal or inside
*/
bool quickContains(const SkIRect& r) const {
- return this->quickContains(r.fLeft, r.fTop, r.fRight, r.fBottom);
+ SkASSERT(this->isEmpty() == fBounds.isEmpty()); // valid region
+
+ return r.fLeft < r.fRight && r.fTop < r.fBottom &&
+ fRunHead == kRectRunHeadPtr && // this->isRect()
+ /* fBounds.contains(left, top, right, bottom); */
+ fBounds.fLeft <= r.fLeft && fBounds.fTop <= r.fTop &&
+ fBounds.fRight >= r.fRight && fBounds.fBottom >= r.fBottom;
}
-
- /** Returns true if SkRegion is a single rectangle and contains SkIRect
- (left, top, right, bottom).
- Returns false if SkRegion is empty or SkIRect (left, top, right, bottom) is empty.
- May return false even though SkRegion contains (left, top, right, bottom).
-
- @param left edge of bounds on x-axis
- @param top edge of bounds on y-axis
- @param right edge of bounds on x-axis
- @param bottom edge of bounds on y-axis
- @return true quickly if SkIRect are equal or inside
- */
- bool quickContains(int32_t left, int32_t top, int32_t right,
- int32_t bottom) const {
+#ifdef SK_SUPPORT_LEGACY_RECT_PARAMS
+ bool quickContains(int32_t left, int32_t top, int32_t right, int32_t bottom) const {
SkASSERT(this->isEmpty() == fBounds.isEmpty()); // valid region
return left < right && top < bottom &&
@@ -301,6 +286,7 @@
fBounds.fLeft <= left && fBounds.fTop <= top &&
fBounds.fRight >= right && fBounds.fBottom >= bottom;
}
+#endif
/** Returns true if SkRegion does not intersect rect.
Returns true if rect is empty or SkRegion is empty.
@@ -377,23 +363,11 @@
return this->op(*this, rect, op);
}
- /** Replaces SkRegion with the result of SkRegion op SkIRect (left, top, right, bottom).
- Returns true if replaced SkRegion is not empty.
-
- @param left edge of bounds on x-axis
- @param top edge of bounds on y-axis
- @param right edge of bounds on x-axis
- @param bottom edge of bounds on y-axis
- @param op operator, one of:
- kDifference_Op, kIntersect_Op, kUnion_Op, kXOR_Op, kReverseDifference_Op,
- kReplace_Op
- @return false if result is empty
- */
+#ifdef SK_SUPPORT_LEGACY_RECT_PARAMS
bool op(int left, int top, int right, int bottom, Op op) {
- SkIRect rect;
- rect.set(left, top, right, bottom);
- return this->op(*this, rect, op);
+ return this->op(*this, {left, top, right, bottom}, op);
}
+#endif
/** Replaces SkRegion with the result of SkRegion op rgn.
Returns true if replaced SkRegion is not empty.
diff --git a/modules/particles/src/SkParticleDrawable.cpp b/modules/particles/src/SkParticleDrawable.cpp
index f806c87..3a6fbac 100644
--- a/modules/particles/src/SkParticleDrawable.cpp
+++ b/modules/particles/src/SkParticleDrawable.cpp
@@ -83,7 +83,7 @@
SkPoint center = { SkIntToScalar(fRadius), SkIntToScalar(fRadius) };
DrawAtlasArrays arrays(particles, count, center);
for (int i = 0; i < count; ++i) {
- arrays.fRects[i].set(0.0f, 0.0f, fImage->width(), fImage->height());
+ arrays.fRects[i].setIWH(fImage->width(), fImage->height());
}
canvas->drawAtlas(fImage, arrays.fXforms.get(), arrays.fRects.get(), arrays.fColors.get(),
count, SkBlendMode::kModulate, nullptr, paint);
diff --git a/samplecode/Sample.cpp b/samplecode/Sample.cpp
index 5a87c9e..e79313d 100644
--- a/samplecode/Sample.cpp
+++ b/samplecode/Sample.cpp
@@ -32,7 +32,7 @@
void Sample::draw(SkCanvas* canvas) {
if (fWidth && fHeight) {
SkRect r;
- r.set(0, 0, fWidth, fHeight);
+ r.setLTRB(0, 0, fWidth, fHeight);
if (canvas->quickReject(r)) {
return;
}
diff --git a/samplecode/SampleAAClip.cpp b/samplecode/SampleAAClip.cpp
index 8733be5..46e4fe2 100644
--- a/samplecode/SampleAAClip.cpp
+++ b/samplecode/SampleAAClip.cpp
@@ -65,7 +65,7 @@
SkPath path;
SkRect bounds;
- bounds.set(0, 0, 20, 20);
+ bounds.setLTRB(0, 0, 20, 20);
bounds.inset(SK_ScalarHalf, SK_ScalarHalf);
// path.addRect(bounds);
diff --git a/samplecode/SampleAARects.cpp b/samplecode/SampleAARects.cpp
index 028c30d..834a1e5 100644
--- a/samplecode/SampleAARects.cpp
+++ b/samplecode/SampleAARects.cpp
@@ -17,7 +17,7 @@
SkCanvas canvas(bitmap);
SkRect r;
- r.set(0, 0, SkIntToScalar(n), SkIntToScalar(n));
+ r.setWH(SkIntToScalar(n), SkIntToScalar(n));
SkPaint paint;
paint.setAntiAlias(true);
diff --git a/samplecode/SampleArc.cpp b/samplecode/SampleArc.cpp
index 2d5892d..043bc57 100644
--- a/samplecode/SampleArc.cpp
+++ b/samplecode/SampleArc.cpp
@@ -26,7 +26,7 @@
#include "include/utils/SkParsePath.h"
static void testparse() {
SkRect r;
- r.set(0, 0, 10, 10.5f);
+ r.setLTRB(0, 0, 10, 10.5f);
SkPath p, p2;
SkString str, str2;
@@ -109,7 +109,7 @@
SkScalar w = 75;
SkScalar h = 50;
- r.set(0, 0, w, h);
+ r.setWH(w, h);
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
diff --git a/samplecode/SampleColorFilter.cpp b/samplecode/SampleColorFilter.cpp
index d30f760..7f57a32 100644
--- a/samplecode/SampleColorFilter.cpp
+++ b/samplecode/SampleColorFilter.cpp
@@ -89,7 +89,7 @@
SkCanvas canvas(bitmap);
SkRect r;
- r.set(0, 0, SkIntToScalar(n), SkIntToScalar(n));
+ r.setWH(SkIntToScalar(n), SkIntToScalar(n));
r.inset(SK_Scalar1, SK_Scalar1);
SkPaint paint;
@@ -136,7 +136,7 @@
p.setAntiAlias(true);
SkRect r = { 20.4f, 10, 20.6f, 20 };
canvas->drawRect(r, p);
- r.set(30.9f, 10, 31.1f, 20);
+ r.setLTRB(30.9f, 10, 31.1f, 20);
canvas->drawRect(r, p);
return;
}
diff --git a/samplecode/SampleFatBits.cpp b/samplecode/SampleFatBits.cpp
index 796fdd5..385c9e1 100644
--- a/samplecode/SampleFatBits.cpp
+++ b/samplecode/SampleFatBits.cpp
@@ -59,7 +59,7 @@
fUseTriangle = false;
fStrokeCap = SkPaint::kButt_Cap;
- fClipRect.set(2, 2, 11, 8 );
+ fClipRect.setLTRB(2, 2, 11, 8 );
}
int getZoom() const { return fZoom; }
@@ -102,7 +102,7 @@
fW = width;
fH = height;
fZoom = zoom;
- fBounds.set(0, 0, SkIntToScalar(width * zoom), SkIntToScalar(height * zoom));
+ fBounds.setIWH(width * zoom, height * zoom);
fMatrix.setScale(SkIntToScalar(zoom), SkIntToScalar(zoom));
fInverse.setScale(SK_Scalar1 / zoom, SK_Scalar1 / zoom);
fShader0 = ToolUtils::create_checkerboard_shader(0xFFDDDDDD, 0xFFFFFFFF, zoom);
@@ -297,7 +297,7 @@
}
SkRect r;
- r.set(pts, 2);
+ r.setBounds(pts, 2);
erase(fMinSurface.get());
this->setupPaint(&paint);
@@ -311,7 +311,7 @@
SkCanvas* max = fMaxSurface->getCanvas();
fMatrix.mapPoints(pts, 2);
- r.set(pts, 2);
+ r.setBounds(pts, 2);
this->drawRectSkeleton(max, r);
fMaxSurface->draw(canvas, 0, 0, nullptr);
diff --git a/samplecode/SampleGradients.cpp b/samplecode/SampleGradients.cpp
index d52c1fe..9eb4e71 100644
--- a/samplecode/SampleGradients.cpp
+++ b/samplecode/SampleGradients.cpp
@@ -16,8 +16,7 @@
static void test_alphagradients(SkCanvas* canvas) {
SkRect r;
- r.set(SkIntToScalar(10), SkIntToScalar(10),
- SkIntToScalar(410), SkIntToScalar(30));
+ r.setLTRB(10, 10, 410, 30);
SkPaint p, p2;
p2.setStyle(SkPaint::kStroke_Style);
diff --git a/samplecode/SampleLayerMask.cpp b/samplecode/SampleLayerMask.cpp
index ab6b0e0..9785e88 100644
--- a/samplecode/SampleLayerMask.cpp
+++ b/samplecode/SampleLayerMask.cpp
@@ -50,7 +50,7 @@
virtual void onDrawContent(SkCanvas* canvas) {
SkRect r;
- r.set(SkIntToScalar(20), SkIntToScalar(20), SkIntToScalar(120), SkIntToScalar(120));
+ r.setLTRB(20, 20, 120, 120);
canvas->saveLayer(&r, nullptr);
canvas->drawColor(SK_ColorRED);
drawMask(canvas, r);
diff --git a/samplecode/SampleLayers.cpp b/samplecode/SampleLayers.cpp
index 422d360..94913ae 100644
--- a/samplecode/SampleLayers.cpp
+++ b/samplecode/SampleLayers.cpp
@@ -44,7 +44,7 @@
// create the layers
- r.set(0, 0, SkIntToScalar(100), SkIntToScalar(100));
+ r.setWH(100, 100);
canvas->clipRect(r);
r.fBottom = SkIntToScalar(20);
@@ -57,7 +57,7 @@
// now draw the "content"
if (true) {
- r.set(0, 0, SkIntToScalar(100), SkIntToScalar(100));
+ r.setWH(100, 100);
canvas->saveLayerAlpha(&r, 0x80);
@@ -68,7 +68,7 @@
canvas->restore();
} else {
- r.set(0, 0, SkIntToScalar(100), SkIntToScalar(100));
+ r.setWH(100, 100);
SkPaint p;
p.setColor(SK_ColorRED);
@@ -85,7 +85,7 @@
SkPaint paint;
make_paint(&paint, m);
- r.set(0, 0, SkIntToScalar(100), SkIntToScalar(20));
+ r.setWH(100, 20);
// SkDebugf("--------- draw top grad\n");
canvas->drawRect(r, paint);
@@ -111,8 +111,7 @@
if (true) {
SkRect r;
- r.set(SkIntToScalar(0), SkIntToScalar(0),
- SkIntToScalar(220), SkIntToScalar(120));
+ r.setWH(220, 120);
SkPaint p;
canvas->saveLayer(&r, &p);
canvas->drawColor(0xFFFF0000);
@@ -125,8 +124,7 @@
if (false) {
SkRect r;
- r.set(SkIntToScalar(0), SkIntToScalar(0),
- SkIntToScalar(220), SkIntToScalar(120));
+ r.setWH(220, 120);
SkPaint p;
p.setAlpha(0x88);
p.setAntiAlias(true);
@@ -151,13 +149,11 @@
canvas->translate(SkIntToScalar(300), 0);
SkRect r;
- r.set(SkIntToScalar(0), SkIntToScalar(0),
- SkIntToScalar(220), SkIntToScalar(60));
+ r.setWH(220, 60);
canvas->saveLayer(&r, &p);
- r.set(SkIntToScalar(0), SkIntToScalar(0),
- SkIntToScalar(220), SkIntToScalar(120));
+ r.setWH(220, 120);
p.setColor(SK_ColorBLUE);
canvas->drawOval(r, p);
canvas->restore();
diff --git a/samplecode/SampleMegaStroke.cpp b/samplecode/SampleMegaStroke.cpp
index 0d13b49..33fa431 100644
--- a/samplecode/SampleMegaStroke.cpp
+++ b/samplecode/SampleMegaStroke.cpp
@@ -13,7 +13,7 @@
class MegaStrokeView : public Sample {
public:
MegaStrokeView() {
- fClip.set(0, 0, 950, 600);
+ fClip.setLTRB(0, 0, 950, 600);
fAngle = 0;
fPlusMinus = 0;
SkRandom rand;
@@ -29,7 +29,7 @@
SkString name() override { return SkString("MegaStroke"); }
bool onChar(SkUnichar uni) override {
- fClip.set(0, 0, 950, 600);
+ fClip.setLTRB(0, 0, 950, 600);
return true;
}
@@ -66,7 +66,7 @@
}
void onSizeChange() override {
- fClip.set(0, 0, 950, 600);
+ fClip.setWH(950, 600);
}
bool onAnimate(double /*nanos*/) override { return true; }
diff --git a/samplecode/SamplePathEffects.cpp b/samplecode/SamplePathEffects.cpp
index 4522d93..ccdc541 100644
--- a/samplecode/SamplePathEffects.cpp
+++ b/samplecode/SamplePathEffects.cpp
@@ -97,8 +97,7 @@
{
SkRect oval;
- oval.set(SkIntToScalar(20), SkIntToScalar(30),
- SkIntToScalar(100), SkIntToScalar(60));
+ oval.setLTRB(20, 30, 100, 60);
oval.offset(x, 0);
fPath.addRoundRect(oval, SkIntToScalar(8), SkIntToScalar(8));
}
diff --git a/samplecode/SampleQuadStroker.cpp b/samplecode/SampleQuadStroker.cpp
index 20f5ff7..7a68541 100644
--- a/samplecode/SampleQuadStroker.cpp
+++ b/samplecode/SampleQuadStroker.cpp
@@ -276,7 +276,7 @@
void setWHZ(int width, int height, int zoom) {
fZoom = zoom;
- fBounds.set(0, 0, SkIntToScalar(width * zoom), SkIntToScalar(height * zoom));
+ fBounds.setIWH(width * zoom, height * zoom);
fMatrix.setScale(SkIntToScalar(zoom), SkIntToScalar(zoom));
fInverse.setScale(SK_Scalar1 / zoom, SK_Scalar1 / zoom);
fShader = ToolUtils::create_checkerboard_shader(0xFFCCCCCC, 0xFFFFFFFF, zoom);
@@ -635,7 +635,7 @@
if (fRRectButton.fEnabled) {
SkScalar rad = 32;
SkRect r;
- r.set(&fPts[13], 2);
+ r.setBounds(&fPts[13], 2);
path.reset();
SkRRect rr;
rr.setRectXY(r, rad, rad);
@@ -658,15 +658,15 @@
if (fCircleButton.fEnabled) {
path.reset();
SkRect r;
- r.set(&fPts[15], 2);
+ r.setBounds(&fPts[15], 2);
path.addOval(r);
setForGeometry();
if (fCircleButton.fFill) {
if (fArcButton.fEnabled) {
SkPoint center;
if (arcCenter(¢er)) {
- r.set(center.fX - fRadius, center.fY - fRadius, center.fX + fRadius,
- center.fY + fRadius);
+ r.setLTRB(center.fX - fRadius, center.fY - fRadius,
+ center.fX + fRadius, center.fY + fRadius);
}
}
draw_fill(canvas, r, width);
diff --git a/samplecode/SampleRegion.cpp b/samplecode/SampleRegion.cpp
index 21b2da7..688d57d 100644
--- a/samplecode/SampleRegion.cpp
+++ b/samplecode/SampleRegion.cpp
@@ -61,7 +61,8 @@
SkFontMetrics fm;
font.getMetrics(&fm);
- bounds.set(x, y + fm.fTop, x + font.measureText(text, len, SkTextEncoding::kUTF8), y + fm.fBottom);
+ bounds.setLTRB(x, y + fm.fTop,
+ x + font.measureText(text, len, SkTextEncoding::kUTF8), y + fm.fBottom);
// may need to outset bounds a little, to account for hinting and/or
// antialiasing
@@ -155,7 +156,7 @@
class RegionView : public Sample {
public:
RegionView() {
- fBase.set(100, 100, 150, 150);
+ fBase.setLTRB(100, 100, 150, 150);
fRect = fBase;
fRect.inset(5, 5);
fRect.offset(25, 25);
diff --git a/samplecode/SampleXfermodesBlur.cpp b/samplecode/SampleXfermodesBlur.cpp
index 1d31524..9ec35dc 100644
--- a/samplecode/SampleXfermodesBlur.cpp
+++ b/samplecode/SampleXfermodesBlur.cpp
@@ -50,7 +50,7 @@
// left three quarters of the canvas
p.setColor(0xFFCC44FF);
SkRect r;
- r.set(0, 0, ww*3/4, hh*3/4);
+ r.setLTRB(0, 0, ww*3/4, hh*3/4);
r.offset(x, y);
canvas->drawOval(r, p);
@@ -59,7 +59,7 @@
// draw a square overlapping the circle
// in the lower right of the canvas
p.setColor(0x00AA6633 | alpha << 24);
- r.set(ww/3, hh/3, ww*19/20, hh*19/20);
+ r.setLTRB(ww/3, hh/3, ww*19/20, hh*19/20);
r.offset(x, y);
canvas->drawRect(r, p);
}
@@ -111,7 +111,7 @@
SkScalar x = x0, y = 0;
for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); i++) {
SkRect r;
- r.set(x, y, x+w, y+h);
+ r.setLTRB(x, y, x+w, y+h);
SkPaint p;
p.setStyle(SkPaint::kFill_Style);
diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp
index 8489644..2f39a24 100644
--- a/src/core/SkAAClip.cpp
+++ b/src/core/SkAAClip.cpp
@@ -827,7 +827,7 @@
if (this->isEmpty()) {
return false;
}
- if (!fBounds.contains(left, top, right, bottom)) {
+ if (!fBounds.contains(SkIRect{left, top, right, bottom})) {
return false;
}
#if 0
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 375397b..3cf72d0 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -440,7 +440,7 @@
}
SkIRect srcRect, r;
- srcRect.set(0, 0, this->width(), this->height());
+ srcRect.setWH(this->width(), this->height());
if (!r.intersect(srcRect, subset)) {
return false; // r is empty (i.e. no intersection)
}
@@ -532,7 +532,7 @@
if (this->width() == 0 || this->height() == 0) {
return false;
}
- srcM.fBounds.set(0, 0, this->width(), this->height());
+ srcM.fBounds.setWH(this->width(), this->height());
srcM.fRowBytes = SkAlign4(this->width());
srcM.fFormat = SkMask::kA8_Format;
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index d8aeb5d..fd2d1aa 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -427,7 +427,7 @@
SkRect bitmapBounds, tmpSrc, tmpDst;
SkBitmap tmpBitmap;
- bitmapBounds.isetWH(bitmap.width(), bitmap.height());
+ bitmapBounds.setIWH(bitmap.width(), bitmap.height());
// Compute matrix from the two rectangles
if (src) {
@@ -494,7 +494,7 @@
SkIntToScalar(bitmapPtr->height()));
#else
SkRect extractedBitmapBounds;
- extractedBitmapBounds.isetWH(bitmapPtr->width(), bitmapPtr->height());
+ extractedBitmapBounds.setIWH(bitmapPtr->width(), bitmapPtr->height());
#endif
if (extractedBitmapBounds == tmpSrc) {
// no fractional part in src, we can just call drawBitmap
diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp
index c197619..b79e00b 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -424,7 +424,7 @@
void SkRectClipBlitter::blitRect(int left, int y, int width, int height) {
SkIRect r;
- r.set(left, y, left + width, y + height);
+ r.setLTRB(left, y, left + width, y + height);
if (r.intersect(fClipRect)) {
fBlitter->blitRect(r.fLeft, r.fTop, r.width(), r.height());
}
@@ -435,7 +435,7 @@
SkIRect r;
// The *true* width of the rectangle blitted is width+2:
- r.set(left, y, left + width + 2, y + height);
+ r.setLTRB(left, y, left + width + 2, y + height);
if (r.intersect(fClipRect)) {
if (r.fLeft != left) {
SkASSERT(r.fLeft > left);
@@ -528,7 +528,7 @@
void SkRgnClipBlitter::blitV(int x, int y, int height, SkAlpha alpha) {
SkIRect bounds;
- bounds.set(x, y, x + 1, y + height);
+ bounds.setXYWH(x, y, 1, height);
SkRegion::Cliperator iter(*fRgn, bounds);
@@ -543,7 +543,7 @@
void SkRgnClipBlitter::blitRect(int x, int y, int width, int height) {
SkIRect bounds;
- bounds.set(x, y, x + width, y + height);
+ bounds.setXYWH(x, y, width, height);
SkRegion::Cliperator iter(*fRgn, bounds);
@@ -560,7 +560,7 @@
SkAlpha leftAlpha, SkAlpha rightAlpha) {
// The *true* width of the rectangle to blit is width + 2
SkIRect bounds;
- bounds.set(x, y, x + width + 2, y + height);
+ bounds.setXYWH(x, y, width + 2, height);
SkRegion::Cliperator iter(*fRgn, bounds);
diff --git a/src/core/SkBlurMF.cpp b/src/core/SkBlurMF.cpp
index 92749da..8a6abe7 100644
--- a/src/core/SkBlurMF.cpp
+++ b/src/core/SkBlurMF.cpp
@@ -645,13 +645,14 @@
return kUnimplemented_FilterReturn;
}
- smallR[0].set(rects[0].left(), rects[0].top(), rects[0].right() - dx, rects[0].bottom() - dy);
+ smallR[0].setLTRB(rects[0].left(), rects[0].top(),
+ rects[0].right() - dx, rects[0].bottom() - dy);
if (smallR[0].width() < 2 || smallR[0].height() < 2) {
return kUnimplemented_FilterReturn;
}
if (2 == count) {
- smallR[1].set(rects[1].left(), rects[1].top(),
- rects[1].right() - dx, rects[1].bottom() - dy);
+ smallR[1].setLTRB(rects[1].left(), rects[1].top(),
+ rects[1].right() - dx, rects[1].bottom() - dy);
SkASSERT(!smallR[1].isEmpty());
}
@@ -688,8 +689,8 @@
SkRect* dst) const {
SkScalar pad = 3.0f * fSigma;
- dst->set(src.fLeft - pad, src.fTop - pad,
- src.fRight + pad, src.fBottom + pad);
+ dst->setLTRB(src.fLeft - pad, src.fTop - pad,
+ src.fRight + pad, src.fBottom + pad);
}
sk_sp<SkFlattenable> SkBlurMaskFilterImpl::CreateProc(SkReadBuffer& buffer) {
diff --git a/src/core/SkBlurMask.cpp b/src/core/SkBlurMask.cpp
index 0b7fbf3..9963fff 100644
--- a/src/core/SkBlurMask.cpp
+++ b/src/core/SkBlurMask.cpp
@@ -404,10 +404,10 @@
margin->set( pad, pad );
}
- dst->fBounds.set(SkScalarRoundToInt(src.fLeft - pad),
- SkScalarRoundToInt(src.fTop - pad),
- SkScalarRoundToInt(src.fRight + pad),
- SkScalarRoundToInt(src.fBottom + pad));
+ dst->fBounds.setLTRB(SkScalarRoundToInt(src.fLeft - pad),
+ SkScalarRoundToInt(src.fTop - pad),
+ SkScalarRoundToInt(src.fRight + pad),
+ SkScalarRoundToInt(src.fBottom + pad));
dst->fRowBytes = dst->fBounds.width();
dst->fFormat = SkMask::kA8_Format;
@@ -418,10 +418,7 @@
if (createMode == SkMask::kJustComputeBounds_CreateMode) {
if (style == kInner_SkBlurStyle) {
- dst->fBounds.set(SkScalarRoundToInt(src.fLeft),
- SkScalarRoundToInt(src.fTop),
- SkScalarRoundToInt(src.fRight),
- SkScalarRoundToInt(src.fBottom)); // restore trimmed bounds
+ dst->fBounds = src.round(); // restore trimmed bounds
dst->fRowBytes = sw;
}
return true;
@@ -472,10 +469,7 @@
}
SkMask::FreeImage(dp);
- dst->fBounds.set(SkScalarRoundToInt(src.fLeft),
- SkScalarRoundToInt(src.fTop),
- SkScalarRoundToInt(src.fRight),
- SkScalarRoundToInt(src.fBottom)); // restore trimmed bounds
+ dst->fBounds = src.round(); // restore trimmed bounds
dst->fRowBytes = sw;
} else if (style == kOuter_SkBlurStyle) {
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 1ab3867..824ade1 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -672,7 +672,7 @@
// This check gives us an early out and prevents generation ID churn on the surface.
// This is purely optional: it is a subset of the checks performed by SkWritePixelsRec.
SkIRect srcRect = SkIRect::MakeXYWH(x, y, srcInfo.width(), srcInfo.height());
- if (!srcRect.intersect(0, 0, device->width(), device->height())) {
+ if (!srcRect.intersect({0, 0, device->width(), device->height()})) {
return false;
}
@@ -2031,7 +2031,7 @@
if (2 == count) {
r.set(pts[0], pts[1]);
} else {
- r.set(pts, SkToInt(count));
+ r.setBounds(pts, SkToInt(count));
}
if (!r.isFinite()) {
return;
@@ -2606,7 +2606,7 @@
// Since a patch is always within the convex hull of the control points, we discard it when its
// bounding rectangle is completely outside the current clip.
SkRect bounds;
- bounds.set(cubics, SkPatchUtils::kNumCtrlPts);
+ bounds.setBounds(cubics, SkPatchUtils::kNumCtrlPts);
if (this->quickReject(bounds)) {
return;
}
@@ -2743,7 +2743,7 @@
}
SkRect r;
- r.set(cx - radius, cy - radius, cx + radius, cy + radius);
+ r.setLTRB(cx - radius, cy - radius, cx + radius, cy + radius);
this->drawOval(r, paint);
}
@@ -2948,7 +2948,7 @@
SkIRect clip = fMCRec->fRasterClip.getBounds();
clip.offset(-origin.x(), -origin.y());
- if (!clip.intersect(0, 0, dev->width(), dev->height())) {
+ if (!clip.intersect({0, 0, dev->width(), dev->height()})) {
clip.setEmpty();
}
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 3d86ea9..e094da6 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -77,7 +77,7 @@
}
SkIRect devRect;
- devRect.set(0, 0, fDst.width(), fDst.height());
+ devRect.setWH(fDst.width(), fDst.height());
SkAutoBlitterChoose blitter(*this, nullptr, paint);
SkScan::FillIRect(devRect, *fRC, blitter.get());
@@ -497,10 +497,10 @@
SkRect r;
for (int i = 0; i < pointData.fNumPoints; ++i) {
- r.set(pointData.fPoints[i].fX - pointData.fSize.fX,
- pointData.fPoints[i].fY - pointData.fSize.fY,
- pointData.fPoints[i].fX + pointData.fSize.fX,
- pointData.fPoints[i].fY + pointData.fSize.fY);
+ r.setLTRB(pointData.fPoints[i].fX - pointData.fSize.fX,
+ pointData.fPoints[i].fY - pointData.fSize.fY,
+ pointData.fPoints[i].fX + pointData.fSize.fX,
+ pointData.fPoints[i].fY + pointData.fSize.fY);
if (device) {
device->drawRect(r, newP);
} else {
@@ -979,7 +979,7 @@
return;
}
SkMask mask;
- mask.fBounds.set(ix, iy, ix + pmap.width(), iy + pmap.height());
+ mask.fBounds.setXYWH(ix, iy, pmap.width(), pmap.height());
mask.fFormat = SkMask::kA8_Format;
mask.fRowBytes = SkToU32(pmap.rowBytes());
// fImage is typed as writable, but in this case it is used read-only
@@ -990,8 +990,7 @@
SkRect r;
SkMask mask;
- r.set(0, 0,
- SkIntToScalar(bitmap.width()), SkIntToScalar(bitmap.height()));
+ r.setIWH(bitmap.width(), bitmap.height());
fMatrix->mapRect(&r);
r.round(&mask.fBounds);
@@ -1040,8 +1039,7 @@
tmpPaint.setFilterQuality(paint.getFilterQuality());
SkPaint paintWithShader = make_paint_with_image(tmpPaint, bitmap);
SkRect rr;
- rr.set(0, 0, SkIntToScalar(bitmap.width()),
- SkIntToScalar(bitmap.height()));
+ rr.setIWH(bitmap.width(), bitmap.height());
c.drawRect(rr, paintWithShader);
}
this->drawDevMask(mask, paint);
@@ -1058,7 +1056,7 @@
static bool clipped_out(const SkMatrix& matrix, const SkRasterClip& clip,
int width, int height) {
SkRect r;
- r.set(0, 0, SkIntToScalar(width), SkIntToScalar(height));
+ r.setIWH(width, height);
return clipped_out(matrix, clip, r);
}
@@ -1193,7 +1191,7 @@
const SkIRect& cr = fRC->getBounds();
SkIRect br;
- br.set(0, 0, fDst.width(), fDst.height());
+ br.setWH(fDst.width(), fDst.height());
SkASSERT(cr.isEmpty() || br.contains(cr));
}
diff --git a/src/core/SkDraw_vertices.cpp b/src/core/SkDraw_vertices.cpp
index ec3904e..bed4c2a 100644
--- a/src/core/SkDraw_vertices.cpp
+++ b/src/core/SkDraw_vertices.cpp
@@ -254,7 +254,7 @@
{
SkRect bounds;
// this also sets bounds to empty if we see a non-finite value
- bounds.set(devVerts, vertexCount);
+ bounds.setBounds(devVerts, vertexCount);
if (bounds.isEmpty()) {
return;
}
diff --git a/src/core/SkEdgeClipper.cpp b/src/core/SkEdgeClipper.cpp
index 8635795..fcadd3e 100644
--- a/src/core/SkEdgeClipper.cpp
+++ b/src/core/SkEdgeClipper.cpp
@@ -221,7 +221,7 @@
fCurrVerb = fVerbs;
SkRect bounds;
- bounds.set(srcPts, 3);
+ bounds.setBounds(srcPts, 3);
if (!quick_reject(bounds, clip)) {
SkPoint monoY[5];
@@ -397,7 +397,7 @@
static SkRect compute_cubic_bounds(const SkPoint pts[4]) {
SkRect r;
- r.set(pts, 4);
+ r.setBounds(pts, 4);
return r;
}
diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp
index af2a7a4..f437ab0 100644
--- a/src/core/SkGeometry.cpp
+++ b/src/core/SkGeometry.cpp
@@ -1366,11 +1366,11 @@
if (this->findYExtrema(&t)) {
this->evalAt(t, &pts[count++]);
}
- bounds->set(pts, count);
+ bounds->setBounds(pts, count);
}
void SkConic::computeFastBounds(SkRect* bounds) const {
- bounds->set(fPts, 3);
+ bounds->setBounds(fPts, 3);
}
#if 0 // unimplemented
diff --git a/src/core/SkGlyph.cpp b/src/core/SkGlyph.cpp
index 32bd67c..35218f4 100644
--- a/src/core/SkGlyph.cpp
+++ b/src/core/SkGlyph.cpp
@@ -19,7 +19,7 @@
SkMask mask;
mask.fImage = (uint8_t*)fImage;
- mask.fBounds.set(fLeft, fTop, fLeft + fWidth, fTop + fHeight);
+ mask.fBounds.setXYWH(fLeft, fTop, fWidth, fHeight);
mask.fRowBytes = this->rowBytes();
mask.fFormat = static_cast<SkMask::Format>(fMaskFormat);
return mask;
diff --git a/src/core/SkImageInfo.cpp b/src/core/SkImageInfo.cpp
index e490d2a..d9afbc9 100644
--- a/src/core/SkImageInfo.cpp
+++ b/src/core/SkImageInfo.cpp
@@ -112,7 +112,7 @@
int x = fX;
int y = fY;
SkIRect srcR = SkIRect::MakeXYWH(x, y, fInfo.width(), fInfo.height());
- if (!srcR.intersect(0, 0, srcWidth, srcHeight)) {
+ if (!srcR.intersect({0, 0, srcWidth, srcHeight})) {
return false;
}
@@ -149,7 +149,7 @@
int x = fX;
int y = fY;
SkIRect dstR = SkIRect::MakeXYWH(x, y, fInfo.width(), fInfo.height());
- if (!dstR.intersect(0, 0, dstWidth, dstHeight)) {
+ if (!dstR.intersect({0, 0, dstWidth, dstHeight})) {
return false;
}
diff --git a/src/core/SkLatticeIter.cpp b/src/core/SkLatticeIter.cpp
index 0908190..0195031 100644
--- a/src/core/SkLatticeIter.cpp
+++ b/src/core/SkLatticeIter.cpp
@@ -274,8 +274,8 @@
return this->next(src, dst, isFixedColor, fixedColor);
}
- src->set(fSrcX[x], fSrcY[y], fSrcX[x + 1], fSrcY[y + 1]);
- dst->set(fDstX[x], fDstY[y], fDstX[x + 1], fDstY[y + 1]);
+ src->setLTRB(fSrcX[x], fSrcY[y], fSrcX[x + 1], fSrcY[y + 1]);
+ dst->setLTRB(fDstX[x], fDstY[y], fDstX[x + 1], fDstY[y + 1]);
if (isFixedColor && fixedColor) {
*isFixedColor = fRectTypes.count() > 0
&& SkToBool(SkCanvas::Lattice::kFixedColor == fRectTypes[currRect]);
diff --git a/src/core/SkMask.cpp b/src/core/SkMask.cpp
index 4952a8f..76f093f 100644
--- a/src/core/SkMask.cpp
+++ b/src/core/SkMask.cpp
@@ -66,7 +66,7 @@
dst.fBounds.setEmpty();
dst.fRowBytes = 0;
} else {
- dst.fBounds.set(0, 0, SkTo<int>(dstW), SkTo<int>(dstH));
+ dst.fBounds.setWH(SkTo<int>(dstW), SkTo<int>(dstH));
dst.fBounds.offset(src.fBounds.x(), src.fBounds.y());
dst.fBounds.offset(-radiusX, -radiusY);
dst.fRowBytes = SkTo<uint32_t>(dstW);
diff --git a/src/core/SkMaskFilter.cpp b/src/core/SkMaskFilter.cpp
index 70d5600..bce1c9d 100644
--- a/src/core/SkMaskFilter.cpp
+++ b/src/core/SkMaskFilter.cpp
@@ -125,10 +125,10 @@
}
SkIRect innerR;
- innerR.set(outerR.left() + cx - mask.fBounds.left(),
- outerR.top() + cy - mask.fBounds.top(),
- outerR.right() + (cx + 1 - mask.fBounds.right()),
- outerR.bottom() + (cy + 1 - mask.fBounds.bottom()));
+ innerR.setLTRB(outerR.left() + cx - mask.fBounds.left(),
+ outerR.top() + cy - mask.fBounds.top(),
+ outerR.right() + (cx + 1 - mask.fBounds.right()),
+ outerR.bottom() + (cy + 1 - mask.fBounds.bottom()));
if (fillCenter) {
blitClippedRect(blitter, innerR, clipR);
}
@@ -141,7 +141,7 @@
SkIRect r;
// top
- r.set(innerR.left(), outerR.top(), innerR.right(), innerR.top());
+ r.setLTRB(innerR.left(), outerR.top(), innerR.right(), innerR.top());
if (r.intersect(clipR)) {
int startY = SkMax32(0, r.top() - outerR.top());
int stopY = startY + r.height();
@@ -154,7 +154,7 @@
}
}
// bottom
- r.set(innerR.left(), innerR.bottom(), innerR.right(), outerR.bottom());
+ r.setLTRB(innerR.left(), innerR.bottom(), innerR.right(), outerR.bottom());
if (r.intersect(clipR)) {
int startY = outerR.bottom() - r.bottom();
int stopY = startY + r.height();
@@ -167,7 +167,7 @@
}
}
// left
- r.set(outerR.left(), innerR.top(), innerR.left(), innerR.bottom());
+ r.setLTRB(outerR.left(), innerR.top(), innerR.left(), innerR.bottom());
if (r.intersect(clipR)) {
SkMask m;
m.fImage = mask.getAddr8(mask.fBounds.left() + r.left() - outerR.left(),
@@ -178,7 +178,7 @@
blitter->blitMask(m, r);
}
// right
- r.set(innerR.right(), innerR.top(), outerR.right(), innerR.bottom());
+ r.setLTRB(innerR.right(), innerR.top(), outerR.right(), innerR.bottom());
if (r.intersect(clipR)) {
SkMask m;
m.fImage = mask.getAddr8(mask.fBounds.right() - outerR.right() + r.left(),
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 44fc760..4d84464 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -100,7 +100,7 @@
SkAutoPathBoundsUpdate(SkPath* path, SkScalar left, SkScalar top,
SkScalar right, SkScalar bottom) {
- fRect.set(left, top, right, bottom);
+ fRect.setLTRB(left, top, right, bottom);
this->init(path);
}
@@ -3644,22 +3644,22 @@
((rectPts[0].fY < rectPts[2].fY) ? 0b00 : 0b10);
switch (sortFlags) {
case 0b00:
- rect->set(rectPts[0].fX, rectPts[0].fY, rectPts[2].fX, rectPts[2].fY);
+ rect->setLTRB(rectPts[0].fX, rectPts[0].fY, rectPts[2].fX, rectPts[2].fY);
*direction = vec03IsVertical ? SkPath::kCW_Direction : SkPath::kCCW_Direction;
*start = 0;
break;
case 0b01:
- rect->set(rectPts[2].fX, rectPts[0].fY, rectPts[0].fX, rectPts[2].fY);
+ rect->setLTRB(rectPts[2].fX, rectPts[0].fY, rectPts[0].fX, rectPts[2].fY);
*direction = vec03IsVertical ? SkPath::kCCW_Direction : SkPath::kCW_Direction;
*start = 1;
break;
case 0b10:
- rect->set(rectPts[0].fX, rectPts[2].fY, rectPts[2].fX, rectPts[0].fY);
+ rect->setLTRB(rectPts[0].fX, rectPts[2].fY, rectPts[2].fX, rectPts[0].fY);
*direction = vec03IsVertical ? SkPath::kCCW_Direction : SkPath::kCW_Direction;
*start = 3;
break;
case 0b11:
- rect->set(rectPts[2].fX, rectPts[2].fY, rectPts[0].fX, rectPts[0].fY);
+ rect->setLTRB(rectPts[2].fX, rectPts[2].fY, rectPts[0].fX, rectPts[0].fY);
*direction = vec03IsVertical ? SkPath::kCW_Direction : SkPath::kCCW_Direction;
*start = 2;
break;
diff --git a/src/core/SkPixmap.cpp b/src/core/SkPixmap.cpp
index 6dc4ab7..82188d1 100644
--- a/src/core/SkPixmap.cpp
+++ b/src/core/SkPixmap.cpp
@@ -61,7 +61,7 @@
bool SkPixmap::extractSubset(SkPixmap* result, const SkIRect& subset) const {
SkIRect srcRect, r;
- srcRect.set(0, 0, this->width(), this->height());
+ srcRect.setWH(this->width(), this->height());
if (!r.intersect(srcRect, subset)) {
return false; // r is empty (i.e. no intersection)
}
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index 501de4d..5aff634 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -400,7 +400,7 @@
}
Bounds bounds(const DrawPoints& op) const {
SkRect dst;
- dst.set(op.pts, op.count);
+ dst.setBounds(op.pts, op.count);
// Pad the bounding box a little to make sure hairline points' bounds aren't empty.
SkScalar stroke = SkMaxScalar(op.paint.getStrokeWidth(), 0.01f);
@@ -410,7 +410,7 @@
}
Bounds bounds(const DrawPatch& op) const {
SkRect dst;
- dst.set(op.cubics, SkPatchUtils::kNumCtrlPts);
+ dst.setBounds(op.cubics, SkPatchUtils::kNumCtrlPts);
return this->adjustAndMap(dst, &op.paint);
}
Bounds bounds(const DrawVertices& op) const {
diff --git a/src/core/SkRect.cpp b/src/core/SkRect.cpp
index 4253a26..cb374a9 100644
--- a/src/core/SkRect.cpp
+++ b/src/core/SkRect.cpp
@@ -9,20 +9,34 @@
#include "include/private/SkMalloc.h"
-void SkIRect::join(int32_t left, int32_t top, int32_t right, int32_t bottom) {
+bool SkIRect::intersect(const SkIRect& r) {
+ SkIRect tmp = {
+ SkMax32(fLeft, r.fLeft),
+ SkMax32(fTop, r.fTop),
+ SkMin32(fRight, r.fRight),
+ SkMin32(fBottom, r.fBottom)
+ };
+ if (tmp.isEmpty()) {
+ return false;
+ }
+ *this = tmp;
+ return true;
+}
+
+void SkIRect::join(const SkIRect& r) {
// do nothing if the params are empty
- if (left >= right || top >= bottom) {
+ if (r.fLeft >= r.fRight || r.fTop >= r.fBottom) {
return;
}
// if we are empty, just assign
if (fLeft >= fRight || fTop >= fBottom) {
- this->set(left, top, right, bottom);
+ *this = r;
} else {
- if (left < fLeft) fLeft = left;
- if (top < fTop) fTop = top;
- if (right > fRight) fRight = right;
- if (bottom > fBottom) fBottom = bottom;
+ if (r.fLeft < fLeft) fLeft = r.fLeft;
+ if (r.fTop < fTop) fTop = r.fTop;
+ if (r.fRight > fRight) fRight = r.fRight;
+ if (r.fBottom > fBottom) fBottom = r.fBottom;
}
}
@@ -71,8 +85,8 @@
bool all_finite = (accum * 0 == 0).allTrue();
if (all_finite) {
- this->set(SkTMin(min[0], min[2]), SkTMin(min[1], min[3]),
- SkTMax(max[0], max[2]), SkTMax(max[1], max[3]));
+ this->setLTRB(SkTMin(min[0], min[2]), SkTMin(min[1], min[3]),
+ SkTMax(max[0], max[2]), SkTMax(max[1], max[3]));
} else {
this->setEmpty();
}
@@ -81,7 +95,7 @@
void SkRect::setBoundsNoCheck(const SkPoint pts[], int count) {
if (!this->setBoundsCheck(pts, count)) {
- this->set(SK_ScalarNaN, SK_ScalarNaN, SK_ScalarNaN, SK_ScalarNaN);
+ this->setLTRB(SK_ScalarNaN, SK_ScalarNaN, SK_ScalarNaN, SK_ScalarNaN);
}
}
diff --git a/src/core/SkRegion.cpp b/src/core/SkRegion.cpp
index f66c6f7..eafe624 100644
--- a/src/core/SkRegion.cpp
+++ b/src/core/SkRegion.cpp
@@ -105,7 +105,7 @@
SkASSERT(runs[0] < runs[1]); // valid height
SkASSERT(runs[3] < runs[4]); // valid width
- bounds->set(runs[3], runs[0], runs[4], runs[1]);
+ bounds->setLTRB(runs[3], runs[0], runs[4], runs[1]);
return true;
}
return false;
@@ -114,7 +114,7 @@
//////////////////////////////////////////////////////////////////////////
SkRegion::SkRegion() {
- fBounds.set(0, 0, 0, 0);
+ fBounds.setEmpty();
fRunHead = SkRegion_gEmptyRunHeadPtr;
}
@@ -177,7 +177,7 @@
bool SkRegion::setEmpty() {
this->freeRuns();
- fBounds.set(0, 0, 0, 0);
+ fBounds.setEmpty();
fRunHead = SkRegion_gEmptyRunHeadPtr;
return false;
}
@@ -1373,7 +1373,7 @@
fRuns = nullptr;
} else {
fRuns = rgn.fRunHead->readonly_runs();
- fRect.set(fRuns[3], fRuns[0], fRuns[4], fRuns[1]);
+ fRect.setLTRB(fRuns[3], fRuns[0], fRuns[4], fRuns[1]);
fRuns += 5;
// Now fRuns points to the 2nd interval (or x-sentinel)
}
diff --git a/src/core/SkRegion_path.cpp b/src/core/SkRegion_path.cpp
index 022a84c..ff07c46 100644
--- a/src/core/SkRegion_path.cpp
+++ b/src/core/SkRegion_path.cpp
@@ -217,7 +217,7 @@
const Scanline* line = (const Scanline*)fStorage;
SkASSERT(line->fXCount == 2);
- r->set(line->firstX()[0], fTop, line->firstX()[1], line->fLastY + 1);
+ r->setLTRB(line->firstX()[0], fTop, line->firstX()[1], line->fLastY + 1);
}
void SkRgnBuilder::copyToRgn(SkRegion::RunType runs[]) const {
diff --git a/src/core/SkScan_Antihair.cpp b/src/core/SkScan_Antihair.cpp
index b215fa8..feb96f2 100644
--- a/src/core/SkScan_Antihair.cpp
+++ b/src/core/SkScan_Antihair.cpp
@@ -579,10 +579,10 @@
SkFDot6 bottom = SkMax32(y0, y1);
SkIRect ir;
- ir.set( SkFDot6Floor(left) - 1,
- SkFDot6Floor(top) - 1,
- SkFDot6Ceil(right) + 1,
- SkFDot6Ceil(bottom) + 1);
+ ir.setLTRB(SkFDot6Floor(left) - 1,
+ SkFDot6Floor(top) - 1,
+ SkFDot6Ceil(right) + 1,
+ SkFDot6Ceil(bottom) + 1);
if (clip->quickReject(ir)) {
continue;
@@ -933,7 +933,7 @@
SkIRect outer;
// set outer to the outer rect of the outer section
- outer.set(FDot8Floor(outerL), FDot8Floor(outerT), FDot8Ceil(outerR), FDot8Ceil(outerB));
+ outer.setLTRB(FDot8Floor(outerL), FDot8Floor(outerT), FDot8Ceil(outerR), FDot8Ceil(outerB));
SkBlitterClipper clipper;
if (clip) {
@@ -971,7 +971,7 @@
antifilldot8(outerL, outerT, outerR, outerB, blitter, false);
// set outer to the outer rect of the middle section
- outer.set(FDot8Ceil(outerL), FDot8Ceil(outerT), FDot8Floor(outerR), FDot8Floor(outerB));
+ outer.setLTRB(FDot8Ceil(outerL), FDot8Ceil(outerT), FDot8Floor(outerR), FDot8Floor(outerB));
if (innerL >= innerR || innerT >= innerB) {
fillcheckrect(outer.fLeft, outer.fTop, outer.fRight, outer.fBottom,
@@ -979,7 +979,7 @@
} else {
SkIRect inner;
// set inner to the inner rect of the middle section
- inner.set(FDot8Floor(innerL), FDot8Floor(innerT), FDot8Ceil(innerR), FDot8Ceil(innerB));
+ inner.setLTRB(FDot8Floor(innerL), FDot8Floor(innerT), FDot8Ceil(innerR), FDot8Ceil(innerB));
// draw the frame in 4 pieces
fillcheckrect(outer.fLeft, outer.fTop, outer.fRight, inner.fTop,
diff --git a/src/core/SkScan_Hairline.cpp b/src/core/SkScan_Hairline.cpp
index 6e85fc4..f9365ce 100644
--- a/src/core/SkScan_Hairline.cpp
+++ b/src/core/SkScan_Hairline.cpp
@@ -88,9 +88,9 @@
// lineclipper, we know they will fit in 32bits (26.6)
const SkIRect& bounds = clip->getBounds();
- clipR.set(SkIntToFDot6(bounds.fLeft), SkIntToFDot6(bounds.fTop),
- SkIntToFDot6(bounds.fRight), SkIntToFDot6(bounds.fBottom));
- ptsR.set(x0, y0, x1, y1);
+ clipR.setLTRB(SkIntToFDot6(bounds.fLeft), SkIntToFDot6(bounds.fTop),
+ SkIntToFDot6(bounds.fRight), SkIntToFDot6(bounds.fBottom));
+ ptsR.setLTRB(x0, y0, x1, y1);
ptsR.sort();
// outset the right and bottom, to account for how hairlines are
@@ -670,21 +670,20 @@
SkScalar ry = SkScalarHalf(dy);
SkRect outer, tmp;
- outer.set(r.fLeft - rx, r.fTop - ry,
- r.fRight + rx, r.fBottom + ry);
+ outer.setLTRB(r.fLeft - rx, r.fTop - ry, r.fRight + rx, r.fBottom + ry);
if (r.width() <= dx || r.height() <= dy) {
SkScan::FillRect(outer, clip, blitter);
return;
}
- tmp.set(outer.fLeft, outer.fTop, outer.fRight, outer.fTop + dy);
+ tmp.setLTRB(outer.fLeft, outer.fTop, outer.fRight, outer.fTop + dy);
SkScan::FillRect(tmp, clip, blitter);
tmp.fTop = outer.fBottom - dy;
tmp.fBottom = outer.fBottom;
SkScan::FillRect(tmp, clip, blitter);
- tmp.set(outer.fLeft, outer.fTop + dy, outer.fLeft + dx, outer.fBottom - dy);
+ tmp.setLTRB(outer.fLeft, outer.fTop + dy, outer.fLeft + dx, outer.fBottom - dy);
SkScan::FillRect(tmp, clip, blitter);
tmp.fLeft = outer.fRight - dx;
tmp.fRight = outer.fRight;
@@ -699,7 +698,7 @@
const SkRegion* clipRgn = nullptr;
SkRect r;
- r.set(pts, count);
+ r.setBounds(pts, count);
r.outset(SK_ScalarHalf, SK_ScalarHalf);
SkAAClipBlitterWrapper wrap;
@@ -720,7 +719,7 @@
const SkRegion* clipRgn = nullptr;
SkRect r;
- r.set(pts, count);
+ r.setBounds(pts, count);
SkAAClipBlitterWrapper wrap;
if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) {
diff --git a/src/core/SkScan_Path.cpp b/src/core/SkScan_Path.cpp
index 419bf9b..4271f4e 100644
--- a/src/core/SkScan_Path.cpp
+++ b/src/core/SkScan_Path.cpp
@@ -556,7 +556,7 @@
const int32_t limit = 32767 >> 1;
SkIRect limitR;
- limitR.set(-limit, -limit, limit, limit);
+ limitR.setLTRB(-limit, -limit, limit, limit);
if (limitR.contains(orig.getBounds())) {
return false;
}
@@ -745,7 +745,7 @@
}
SkRect r;
- r.set(pts, 3);
+ r.setBounds(pts, 3);
// If r is too large (larger than can easily fit in SkFixed) then we need perform geometric
// clipping. This is a bit of work, so we just call the general FillPath() to handle it.
// Use FixedMax/2 as the limit so we can subtract two edges and still store that in Fixed.
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index 05d031b..17159be 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -409,8 +409,8 @@
SkFontMetrics fm;
ctx->getFontMetrics(&fm);
- bounds->set(fm.fXMin * invTextSize, fm.fTop * invTextSize,
- fm.fXMax * invTextSize, fm.fBottom * invTextSize);
+ bounds->setLTRB(fm.fXMin * invTextSize, fm.fTop * invTextSize,
+ fm.fXMax * invTextSize, fm.fBottom * invTextSize);
return true;
}
diff --git a/src/core/SkVertices.cpp b/src/core/SkVertices.cpp
index 38bf972..dc20703 100644
--- a/src/core/SkVertices.cpp
+++ b/src/core/SkVertices.cpp
@@ -138,7 +138,7 @@
sk_sp<SkVertices> SkVertices::Builder::detach() {
if (fVertices) {
- fVertices->fBounds.set(fVertices->fPositions, fVertices->fVertexCnt);
+ fVertices->fBounds.setBounds(fVertices->fPositions, fVertices->fVertexCnt);
if (fVertices->fMode == kTriangleFan_VertexMode) {
if (fIntermediateFanIndices.get()) {
SkASSERT(fVertices->fIndexCnt);
@@ -266,7 +266,7 @@
}
// Recalculate the bounds.
- copy->fBounds.set(copy->fPositions, copy->fVertexCnt);
+ copy->fBounds.setBounds(copy->fPositions, copy->fVertexCnt);
return copy;
}
diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp
index e11d857..f9e4450 100644
--- a/src/gpu/GrDrawOpAtlas.cpp
+++ b/src/gpu/GrDrawOpAtlas.cpp
@@ -129,7 +129,7 @@
}
}
- fDirtyRect.join(loc->fX, loc->fY, loc->fX + width, loc->fY + height);
+ fDirtyRect.join({loc->fX, loc->fY, loc->fX + width, loc->fY + height});
loc->fX += fOffset.fX;
loc->fY += fOffset.fY;
diff --git a/src/gpu/GrRenderTarget.cpp b/src/gpu/GrRenderTarget.cpp
index 9f915e5..1b5796c 100644
--- a/src/gpu/GrRenderTarget.cpp
+++ b/src/gpu/GrRenderTarget.cpp
@@ -34,7 +34,7 @@
if (kCanResolve_ResolveType == getResolveType()) {
if (rect) {
fResolveRect.join(*rect);
- if (!fResolveRect.intersect(0, 0, this->width(), this->height())) {
+ if (!fResolveRect.intersect({0, 0, this->width(), this->height()})) {
fResolveRect.setEmpty();
}
} else {
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index c562436..2bfa17a 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -117,26 +117,26 @@
SkRect rect;
if (devClipBounds.fTop < devPathBounds.fTop) {
- rect.iset(devClipBounds.fLeft, devClipBounds.fTop,
- devClipBounds.fRight, devPathBounds.fTop);
+ rect.setLTRB(SkIntToScalar(devClipBounds.fLeft), SkIntToScalar(devClipBounds.fTop),
+ SkIntToScalar(devClipBounds.fRight), SkIntToScalar(devPathBounds.fTop));
DrawNonAARect(renderTargetContext, GrPaint::Clone(paint), userStencilSettings, clip,
SkMatrix::I(), rect, invert);
}
if (devClipBounds.fLeft < devPathBounds.fLeft) {
- rect.iset(devClipBounds.fLeft, devPathBounds.fTop,
- devPathBounds.fLeft, devPathBounds.fBottom);
+ rect.setLTRB(SkIntToScalar(devClipBounds.fLeft), SkIntToScalar(devPathBounds.fTop),
+ SkIntToScalar(devPathBounds.fLeft), SkIntToScalar(devPathBounds.fBottom));
DrawNonAARect(renderTargetContext, GrPaint::Clone(paint), userStencilSettings, clip,
SkMatrix::I(), rect, invert);
}
if (devClipBounds.fRight > devPathBounds.fRight) {
- rect.iset(devPathBounds.fRight, devPathBounds.fTop,
- devClipBounds.fRight, devPathBounds.fBottom);
+ rect.setLTRB(SkIntToScalar(devPathBounds.fRight), SkIntToScalar(devPathBounds.fTop),
+ SkIntToScalar(devClipBounds.fRight), SkIntToScalar(devPathBounds.fBottom));
DrawNonAARect(renderTargetContext, GrPaint::Clone(paint), userStencilSettings, clip,
SkMatrix::I(), rect, invert);
}
if (devClipBounds.fBottom > devPathBounds.fBottom) {
- rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
- devClipBounds.fRight, devClipBounds.fBottom);
+ rect.setLTRB(SkIntToScalar(devClipBounds.fLeft), SkIntToScalar(devPathBounds.fBottom),
+ SkIntToScalar(devClipBounds.fRight), SkIntToScalar(devClipBounds.fBottom));
DrawNonAARect(renderTargetContext, std::move(paint), userStencilSettings, clip,
SkMatrix::I(), rect, invert);
}
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index e3377c9..817fe5d 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -846,10 +846,8 @@
for (int x = 0; x <= nx; x++) {
for (int y = 0; y <= ny; y++) {
SkRect tileR;
- tileR.set(SkIntToScalar(x * tileSize),
- SkIntToScalar(y * tileSize),
- SkIntToScalar((x + 1) * tileSize),
- SkIntToScalar((y + 1) * tileSize));
+ tileR.setLTRB(SkIntToScalar(x * tileSize), SkIntToScalar(y * tileSize),
+ SkIntToScalar((x + 1) * tileSize), SkIntToScalar((y + 1) * tileSize));
if (!SkRect::Intersects(tileR, clippedSrcRect)) {
continue;
diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
index 748946b..5ddeaf2 100644
--- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
@@ -759,7 +759,7 @@
}
viewMatrix.mapPoints(&pos, 1);
if (first) {
- actualBounds.set(pos.fX, pos.fY, pos.fX, pos.fY);
+ actualBounds.setLTRB(pos.fX, pos.fY, pos.fX, pos.fY);
first = false;
} else {
SkRectPriv::GrowToInclude(&actualBounds, pos);
diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp
index 89a7db6..620b94d 100644
--- a/src/gpu/ops/GrDashOp.cpp
+++ b/src/gpu/ops/GrDashOp.cpp
@@ -172,8 +172,8 @@
SkScalar halfOffLen = SkScalarHalf(endInterval);
SkScalar halfStroke = SkScalarHalf(strokeWidth);
SkRect rectParam;
- rectParam.set(halfOffLen + 0.5f, -halfStroke + 0.5f,
- halfOffLen + startInterval - 0.5f, halfStroke - 0.5f);
+ rectParam.setLTRB(halfOffLen + 0.5f, -halfStroke + 0.5f,
+ halfOffLen + startInterval - 0.5f, halfStroke - 0.5f);
vertices.writeQuad(GrQuad::MakeFromRect(rect, matrix),
GrVertexWriter::TriStripFromRect(dashRect),
@@ -404,7 +404,7 @@
startPts[1].fY = startPts[0].fY;
startPts[1].fX = SkMinScalar(startPts[0].fX + draw.fIntervals[0] - draw.fPhase,
draw.fPtsRot[1].fX);
- startRect.set(startPts, 2);
+ startRect.setBounds(startPts, 2);
startRect.outset(strokeAdj, halfSrcStroke);
hasStartRect = true;
@@ -440,7 +440,7 @@
endPts[0].fY = endPts[1].fY;
endPts[0].fX = endPts[1].fX - endingInterval;
- endRect.set(endPts, 2);
+ endRect.setBounds(endPts, 2);
endRect.outset(strokeAdj, halfSrcStroke);
hasEndRect = true;
@@ -510,7 +510,7 @@
// one giant dash
draw.fPtsRot[0].fX -= hasStartRect ? startAdj : 0;
draw.fPtsRot[1].fX += hasEndRect ? endAdj : 0;
- startRect.set(draw.fPtsRot, 2);
+ startRect.setBounds(draw.fPtsRot, 2);
startRect.outset(strokeAdj, halfSrcStroke);
hasStartRect = true;
hasEndRect = false;
@@ -543,8 +543,8 @@
draw.fLineLength += 2.f * halfDevStroke;
}
- bounds.set(draw.fPtsRot[0].fX, draw.fPtsRot[0].fY,
- draw.fPtsRot[1].fX, draw.fPtsRot[1].fY);
+ bounds.setLTRB(draw.fPtsRot[0].fX, draw.fPtsRot[0].fY,
+ draw.fPtsRot[1].fX, draw.fPtsRot[1].fY);
bounds.outset(bloatX + strokeAdj, bloatY + halfSrcStroke);
}
diff --git a/src/gpu/ops/GrStrokeRectOp.cpp b/src/gpu/ops/GrStrokeRectOp.cpp
index a435832..1e07966 100644
--- a/src/gpu/ops/GrStrokeRectOp.cpp
+++ b/src/gpu/ops/GrStrokeRectOp.cpp
@@ -150,10 +150,10 @@
// We want to be consistent with how we snap non-aa lines. To match what we do in
// GrGLSLVertexShaderBuilder, we first floor all the vertex values and then add half a
// pixel to force us to pixel centers.
- bounds.set(SkScalarFloorToScalar(bounds.fLeft),
- SkScalarFloorToScalar(bounds.fTop),
- SkScalarFloorToScalar(bounds.fRight),
- SkScalarFloorToScalar(bounds.fBottom));
+ bounds.setLTRB(SkScalarFloorToScalar(bounds.fLeft),
+ SkScalarFloorToScalar(bounds.fTop),
+ SkScalarFloorToScalar(bounds.fRight),
+ SkScalarFloorToScalar(bounds.fBottom));
bounds.offset(0.5f, 0.5f);
this->setBounds(bounds, HasAABloat::kNo, IsZeroArea::kNo);
} else {
diff --git a/src/gpu/text/GrSDFMaskFilter.cpp b/src/gpu/text/GrSDFMaskFilter.cpp
index 23660f5..7bcaed3 100644
--- a/src/gpu/text/GrSDFMaskFilter.cpp
+++ b/src/gpu/text/GrSDFMaskFilter.cpp
@@ -83,8 +83,8 @@
void GrSDFMaskFilterImpl::computeFastBounds(const SkRect& src,
SkRect* dst) const {
- dst->set(src.fLeft - SK_DistanceFieldPad, src.fTop - SK_DistanceFieldPad,
- src.fRight + SK_DistanceFieldPad, src.fBottom + SK_DistanceFieldPad);
+ dst->setLTRB(src.fLeft - SK_DistanceFieldPad, src.fTop - SK_DistanceFieldPad,
+ src.fRight + SK_DistanceFieldPad, src.fBottom + SK_DistanceFieldPad);
}
sk_sp<SkFlattenable> GrSDFMaskFilterImpl::CreateProc(SkReadBuffer& buffer) {
diff --git a/src/pathops/SkOpContour.h b/src/pathops/SkOpContour.h
index 628ff19..e5a55fe 100644
--- a/src/pathops/SkOpContour.h
+++ b/src/pathops/SkOpContour.h
@@ -281,7 +281,7 @@
fNext = nullptr;
fCount = 0;
fDone = false;
- SkDEBUGCODE(fBounds.set(SK_ScalarMax, SK_ScalarMax, SK_ScalarMin, SK_ScalarMin));
+ SkDEBUGCODE(fBounds.setLTRB(SK_ScalarMax, SK_ScalarMax, SK_ScalarMin, SK_ScalarMin));
SkDEBUGCODE(fFirstSorted = -1);
SkDEBUGCODE(fDebugIndent = 0);
}
diff --git a/src/pathops/SkOpSegment.h b/src/pathops/SkOpSegment.h
index e75554b..032f822 100644
--- a/src/pathops/SkOpSegment.h
+++ b/src/pathops/SkOpSegment.h
@@ -71,7 +71,7 @@
SkOpSegment* addLine(SkPoint pts[2], SkOpContour* parent) {
SkASSERT(pts[0] != pts[1]);
init(pts, 1, parent, SkPath::kLine_Verb);
- fBounds.set(pts, 2);
+ fBounds.setBounds(pts, 2);
return this;
}
diff --git a/src/pathops/SkPathOpsAsWinding.cpp b/src/pathops/SkPathOpsAsWinding.cpp
index 5726550..80e52be 100644
--- a/src/pathops/SkPathOpsAsWinding.cpp
+++ b/src/pathops/SkPathOpsAsWinding.cpp
@@ -45,7 +45,7 @@
static int contains_edge(SkPoint pts[4], SkPath::Verb verb, SkScalar weight, const SkPoint& edge) {
SkRect bounds;
- bounds.set(pts, kPtCount[verb] + 1);
+ bounds.setBounds(pts, kPtCount[verb] + 1);
if (bounds.fTop > edge.fY) {
return 0;
}
diff --git a/src/pathops/SkPathOpsCurve.cpp b/src/pathops/SkPathOpsCurve.cpp
index 58137b6..734d599 100644
--- a/src/pathops/SkPathOpsCurve.cpp
+++ b/src/pathops/SkPathOpsCurve.cpp
@@ -65,8 +65,8 @@
dCurve.set(curve, curveWeight);
SkDRect dRect;
dRect.setBounds(dCurve, fConic, tStart, tEnd);
- bounds->set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop),
- SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom));
+ bounds->setLTRB(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop),
+ SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom));
}
void SkDCurve::setCubicBounds(const SkPoint curve[4], SkScalar ,
@@ -75,8 +75,8 @@
dCurve.set(curve);
SkDRect dRect;
dRect.setBounds(dCurve, fCubic, tStart, tEnd);
- bounds->set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop),
- SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom));
+ bounds->setLTRB(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop),
+ SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom));
}
void SkDCurve::setQuadBounds(const SkPoint curve[3], SkScalar ,
@@ -85,8 +85,8 @@
dCurve.set(curve);
SkDRect dRect;
dRect.setBounds(dCurve, fQuad, tStart, tEnd);
- bounds->set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop),
- SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom));
+ bounds->setLTRB(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop),
+ SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom));
}
void SkDCurveSweep::setCurveHullSweep(SkPath::Verb verb) {
diff --git a/src/ports/SkFontHost_FreeType_common.cpp b/src/ports/SkFontHost_FreeType_common.cpp
index 7954d8b..531ca88 100644
--- a/src/ports/SkFontHost_FreeType_common.cpp
+++ b/src/ports/SkFontHost_FreeType_common.cpp
@@ -595,7 +595,7 @@
SkMask unscaledBitmapAlias;
unscaledBitmapAlias.fImage = reinterpret_cast<uint8_t*>(unscaledBitmap.getPixels());
- unscaledBitmapAlias.fBounds.set(0, 0, unscaledBitmap.width(), unscaledBitmap.height());
+ unscaledBitmapAlias.fBounds.setWH(unscaledBitmap.width(), unscaledBitmap.height());
unscaledBitmapAlias.fRowBytes = unscaledBitmap.rowBytes();
unscaledBitmapAlias.fFormat = SkMaskFormat_for_SkColorType(unscaledBitmap.colorType());
copyFTBitmap(face->glyph->bitmap, unscaledBitmapAlias);
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index 02320ae..191a085 100644
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -1789,10 +1789,10 @@
CGRect bbox = CTFontGetBoundingBox(ctFont.get());
SkRect r;
- r.set( CGToScalar(CGRectGetMinX_inline(bbox)), // Left
- CGToScalar(CGRectGetMaxY_inline(bbox)), // Top
- CGToScalar(CGRectGetMaxX_inline(bbox)), // Right
- CGToScalar(CGRectGetMinY_inline(bbox))); // Bottom
+ r.setLTRB(CGToScalar(CGRectGetMinX_inline(bbox)), // Left
+ CGToScalar(CGRectGetMaxY_inline(bbox)), // Top
+ CGToScalar(CGRectGetMaxX_inline(bbox)), // Right
+ CGToScalar(CGRectGetMinY_inline(bbox))); // Bottom
r.roundOut(&(info->fBBox));
diff --git a/src/utils/SkCanvasStateUtils.cpp b/src/utils/SkCanvasStateUtils.cpp
index 53d0244..73fb5ca 100644
--- a/src/utils/SkCanvasStateUtils.cpp
+++ b/src/utils/SkCanvasStateUtils.cpp
@@ -233,15 +233,15 @@
// of what they sent.
SkIRect bounds = SkIRect::MakeEmpty();
if (state.clipRectCount > 0) {
- bounds.set(state.clipRects[0].left,
- state.clipRects[0].top,
- state.clipRects[0].right,
- state.clipRects[0].bottom);
+ bounds.setLTRB(state.clipRects[0].left,
+ state.clipRects[0].top,
+ state.clipRects[0].right,
+ state.clipRects[0].bottom);
for (int i = 1; i < state.clipRectCount; ++i) {
- bounds.join(state.clipRects[i].left,
- state.clipRects[i].top,
- state.clipRects[i].right,
- state.clipRects[i].bottom);
+ bounds.join({state.clipRects[i].left,
+ state.clipRects[i].top,
+ state.clipRects[i].right,
+ state.clipRects[i].bottom});
}
}
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp
index b217563..455b0f6 100644
--- a/src/utils/SkLua.cpp
+++ b/src/utils/SkLua.cpp
@@ -412,10 +412,10 @@
}
static SkRect* lua2rect(lua_State* L, int index, SkRect* rect) {
- rect->set(getfield_scalar_default(L, index, "left", 0),
- getfield_scalar_default(L, index, "top", 0),
- getfield_scalar(L, index, "right"),
- getfield_scalar(L, index, "bottom"));
+ rect->setLTRB(getfield_scalar_default(L, index, "left", 0),
+ getfield_scalar_default(L, index, "top", 0),
+ getfield_scalar(L, index, "right"),
+ getfield_scalar(L, index, "bottom"));
return rect;
}
diff --git a/src/utils/SkPolyUtils.cpp b/src/utils/SkPolyUtils.cpp
index c3b2e31..f8f1954 100644
--- a/src/utils/SkPolyUtils.cpp
+++ b/src/utils/SkPolyUtils.cpp
@@ -1442,8 +1442,8 @@
Sk4s xy(p1.fX, p1.fY, p2.fX, p2.fY);
min = Sk4s::Min(min, xy);
max = Sk4s::Max(max, xy);
- bounds->set(SkTMin(min[0], min[2]), SkTMin(min[1], min[3]),
- SkTMax(max[0], max[2]), SkTMax(max[1], max[3]));
+ bounds->setLTRB(SkTMin(min[0], min[2]), SkTMin(min[1], min[3]),
+ SkTMax(max[0], max[2]), SkTMax(max[1], max[3]));
}
// test to see if point p is in triangle p0p1p2.
diff --git a/tests/AAClipTest.cpp b/tests/AAClipTest.cpp
index 4162def..e492ca9 100644
--- a/tests/AAClipTest.cpp
+++ b/tests/AAClipTest.cpp
@@ -307,7 +307,7 @@
0xFF, 0xFF, 0xFF, 0xFF,
};
SkMask expected;
- expected.fBounds.set(0, 0, 4, 6);
+ expected.fBounds.setWH(4, 6);
expected.fRowBytes = 4;
expected.fFormat = SkMask::kA8_Format;
expected.fImage = (uint8_t*)gExpectedImage;
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index 0e3cef2..cb693aa 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -90,7 +90,7 @@
SkIRect r;
// Extract a subset which has the same width as the original. This
// catches a bug where we cloned the genID incorrectly.
- r.set(0, 1, W, 3);
+ r.setLTRB(0, 1, W, 3);
bitmap.setIsVolatile(true);
// Relies on old behavior of extractSubset failing if colortype is unknown
if (kUnknown_SkColorType != bitmap.colorType() && bitmap.extractSubset(&subset, r)) {
diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp
index cc8d912..1c85e31 100644
--- a/tests/BlurTest.cpp
+++ b/tests/BlurTest.cpp
@@ -182,7 +182,7 @@
int* result, int resultCount) {
SkMask src, dst;
- src.fBounds.set(0, 0, width, height);
+ src.fBounds.setWH(width, height);
src.fFormat = SkMask::kA8_Format;
src.fRowBytes = src.fBounds.width();
src.fImage = SkMask::AllocImage(src.computeTotalImageSize());
diff --git a/tests/ClipCubicTest.cpp b/tests/ClipCubicTest.cpp
index f98aca0..5b8bb1f 100644
--- a/tests/ClipCubicTest.cpp
+++ b/tests/ClipCubicTest.cpp
@@ -91,7 +91,7 @@
const float tol = 1e-4f;
// Test no clip, with plenty of room.
- clipRect.set(-2, -2, 6, 14);
+ clipRect.setLTRB(-2, -2, 6, 14);
clipper.setClip(clipRect);
success = clipper.clipCubic(crv, clipped);
REPORTER_ASSERT(reporter, success == true);
@@ -99,7 +99,7 @@
0, 0, 2, 3, 1, 10, 4, 12, shouldbe), tol));
// Test no clip, touching first point.
- clipRect.set(-2, 0, 6, 14);
+ clipRect.setLTRB(-2, 0, 6, 14);
clipper.setClip(clipRect);
success = clipper.clipCubic(crv, clipped);
REPORTER_ASSERT(reporter, success == true);
@@ -107,7 +107,7 @@
0, 0, 2, 3, 1, 10, 4, 12, shouldbe), tol));
// Test no clip, touching last point.
- clipRect.set(-2, -2, 6, 12);
+ clipRect.setLTRB(-2, -2, 6, 12);
clipper.setClip(clipRect);
success = clipper.clipCubic(crv, clipped);
REPORTER_ASSERT(reporter, success == true);
@@ -115,13 +115,13 @@
0, 0, 2, 3, 1, 10, 4, 12, shouldbe), tol));
// Test all clip.
- clipRect.set(-2, 14, 6, 20);
+ clipRect.setLTRB(-2, 14, 6, 20);
clipper.setClip(clipRect);
success = clipper.clipCubic(crv, clipped);
REPORTER_ASSERT(reporter, success == false);
// Test clip at 1.
- clipRect.set(-2, 1, 6, 14);
+ clipRect.setLTRB(-2, 1, 6, 14);
clipper.setClip(clipRect);
success = clipper.clipCubic(crv, clipped);
REPORTER_ASSERT(reporter, success == true);
@@ -133,7 +133,7 @@
shouldbe), tol));
// Test clip at 2.
- clipRect.set(-2, 2, 6, 14);
+ clipRect.setLTRB(-2, 2, 6, 14);
clipper.setClip(clipRect);
success = clipper.clipCubic(crv, clipped);
REPORTER_ASSERT(reporter, success == true);
@@ -145,7 +145,7 @@
shouldbe), tol));
// Test clip at 11.
- clipRect.set(-2, -2, 6, 11);
+ clipRect.setLTRB(-2, -2, 6, 11);
clipper.setClip(clipRect);
success = clipper.clipCubic(crv, clipped);
REPORTER_ASSERT(reporter, success == true);
@@ -157,7 +157,7 @@
shouldbe), tol));
// Test clip at 10.
- clipRect.set(-2, -2, 6, 10);
+ clipRect.setLTRB(-2, -2, 6, 10);
clipper.setClip(clipRect);
success = clipper.clipCubic(crv, clipped);
REPORTER_ASSERT(reporter, success == true);
diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp
index 3ebd44d..435c86e 100644
--- a/tests/ClipStackTest.cpp
+++ b/tests/ClipStackTest.cpp
@@ -263,8 +263,8 @@
SkRect rectA, rectB;
- rectA.iset(10, 10, 50, 50);
- rectB.iset(40, 40, 80, 80);
+ rectA.setLTRB(10, 10, 50, 50);
+ rectB.setLTRB(40, 40, 80, 80);
SkRRect rrectA, rrectB;
rrectA.setOval(rectA);
@@ -344,8 +344,8 @@
SkRect rectA, rectB;
- rectA.iset(10, 10, 40, 40);
- rectB.iset(50, 50, 80, 80);
+ rectA.setLTRB(10, 10, 40, 40);
+ rectB.setLTRB(50, 50, 80, 80);
// Stack should initially be wide open
{
@@ -1482,7 +1482,7 @@
SkClipStack::B2TIter iter(stack);
const SkClipStack::Element* element = iter.next();
SkRect answer;
- answer.iset(25, 25, 75, 75);
+ answer.setLTRB(25, 25, 75, 75);
REPORTER_ASSERT(reporter, element);
REPORTER_ASSERT(reporter,
diff --git a/tests/FillPathTest.cpp b/tests/FillPathTest.cpp
index b5149e9..f6e1c5e 100644
--- a/tests/FillPathTest.cpp
+++ b/tests/FillPathTest.cpp
@@ -36,7 +36,7 @@
int height = 100;
int width = 200;
int expected_lines = 5;
- clip.set(0, height - expected_lines, width, height);
+ clip.setLTRB(0, height - expected_lines, width, height);
path.moveTo(0.0f, 0.0f)
.quadTo(SkIntToScalar(width/2), SkIntToScalar(height),
SkIntToScalar(width), 0.0f)
diff --git a/tests/GeometryTest.cpp b/tests/GeometryTest.cpp
index 2f09c24..e46bd18 100644
--- a/tests/GeometryTest.cpp
+++ b/tests/GeometryTest.cpp
@@ -186,9 +186,6 @@
for (int i = 0; i < N; i += 3) {
const SkPoint* pts = &triples[i];
- SkRect bounds;
- bounds.set(pts, 3);
-
SkScalar w = 1e30f;
do {
w *= 2;
diff --git a/tests/GrCCPRTest.cpp b/tests/GrCCPRTest.cpp
index ce28419..cc020e3 100644
--- a/tests/GrCCPRTest.cpp
+++ b/tests/GrCCPRTest.cpp
@@ -50,7 +50,7 @@
bool quickContains(const SkRect&) const final { return false; }
bool isRRect(const SkRect& rtBounds, SkRRect* rr, GrAA*) const final { return false; }
void getConservativeBounds(int width, int height, SkIRect* rect, bool* iior) const final {
- rect->set(0, 0, width, height);
+ rect->setWH(width, height);
if (iior) {
*iior = false;
}
diff --git a/tests/InfRectTest.cpp b/tests/InfRectTest.cpp
index 5a6ec22..afabca8 100644
--- a/tests/InfRectTest.cpp
+++ b/tests/InfRectTest.cpp
@@ -13,7 +13,7 @@
static void check_invalid(skiatest::Reporter* reporter,
SkScalar l, SkScalar t, SkScalar r, SkScalar b) {
SkRect rect;
- rect.set(l, t, r, b);
+ rect.setLTRB(l, t, r, b);
REPORTER_ASSERT(reporter, !rect.isFinite());
}
diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp
index ef5e727..371c701 100644
--- a/tests/LazyProxyTest.cpp
+++ b/tests/LazyProxyTest.cpp
@@ -182,7 +182,7 @@
bool quickContains(const SkRect&) const final { return false; }
bool isRRect(const SkRect& rtBounds, SkRRect* rr, GrAA*) const final { return false; }
void getConservativeBounds(int width, int height, SkIRect* rect, bool* iior) const final {
- rect->set(0, 0, width, height);
+ rect->setLTRB(0, 0, width, height);
if (iior) {
*iior = false;
}
diff --git a/tests/MatrixTest.cpp b/tests/MatrixTest.cpp
index a8521bc..ced094a 100644
--- a/tests/MatrixTest.cpp
+++ b/tests/MatrixTest.cpp
@@ -121,7 +121,7 @@
SkRect src, dst;
SkMatrix matrix;
- src.set(0, 0, 10, 10);
+ src.setLTRB(0, 0, 10, 10);
dst = src;
matrix.setRectToRect(src, dst, SkMatrix::kFill_ScaleToFit);
REPORTER_ASSERT(reporter, SkMatrix::kIdentity_Mask == matrix.getType());
diff --git a/tests/ParsePathTest.cpp b/tests/ParsePathTest.cpp
index bfdea3a..00f5c86 100644
--- a/tests/ParsePathTest.cpp
+++ b/tests/ParsePathTest.cpp
@@ -54,7 +54,7 @@
}
SkRect r;
- r.set(0, 0, 10, 10.5f);
+ r.setLTRB(0, 0, 10, 10.5f);
SkPath p;
p.addRect(r);
test_to_from(reporter, p);
diff --git a/tests/PathOpsBoundsTest.cpp b/tests/PathOpsBoundsTest.cpp
index 91856ca..aa64436 100644
--- a/tests/PathOpsBoundsTest.cpp
+++ b/tests/PathOpsBoundsTest.cpp
@@ -50,11 +50,11 @@
bounds.setEmpty();
bounds.add(1, 2, 3, 4);
SkPathOpsBounds expected;
- expected.set(0, 0, 3, 4);
+ expected.setLTRB(0, 0, 3, 4);
REPORTER_ASSERT(reporter, bounds == expected);
bounds.setEmpty();
SkPathOpsBounds ordinal;
- ordinal.set(1, 2, 3, 4);
+ ordinal.setLTRB(1, 2, 3, 4);
bounds.add(ordinal);
REPORTER_ASSERT(reporter, bounds == expected);
bounds.setEmpty();
@@ -65,10 +65,10 @@
SkDCurve curve;
curve.fQuad.set(curvePts);
curve.setQuadBounds(curvePts, 1, 0, 1, &bounds);
- expected.set(0, 0, 3, 4);
+ expected.setLTRB(0, 0, 3, 4);
REPORTER_ASSERT(reporter, bounds == expected);
curve.fCubic.set(curvePts);
curve.setCubicBounds(curvePts, 1, 0, 1, &bounds);
- expected.set(0, 0, 5, 6);
+ expected.setLTRB(0, 0, 5, 6);
REPORTER_ASSERT(reporter, bounds == expected);
}
diff --git a/tests/PathOpsBuilderConicTest.cpp b/tests/PathOpsBuilderConicTest.cpp
index 1addea7..f776b43 100644
--- a/tests/PathOpsBuilderConicTest.cpp
+++ b/tests/PathOpsBuilderConicTest.cpp
@@ -38,7 +38,7 @@
Op(*result, rotated, kUnion_SkPathOp, result);
} else {
SkRegion rgnB, openClip;
- openClip.setRect(-16000, -16000, 16000, 16000);
+ openClip.setRect({-16000, -16000, 16000, 16000});
rgnB.setPath(rotated, openClip);
region->op(rgnB, SkRegion::kUnion_Op);
}
diff --git a/tests/PathOpsBuilderTest.cpp b/tests/PathOpsBuilderTest.cpp
index 9069802..1d42010 100644
--- a/tests/PathOpsBuilderTest.cpp
+++ b/tests/PathOpsBuilderTest.cpp
@@ -61,7 +61,7 @@
REPORTER_ASSERT(reporter, result.isRect(nullptr, &closed, &dir));
REPORTER_ASSERT(reporter, closed);
SkRect expected;
- expected.set(0, 1, 5, 3);
+ expected.setLTRB(0, 1, 5, 3);
REPORTER_ASSERT(reporter, result.getBounds() == expected);
SkPath circle1, circle2, circle3;
diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp
index a80e334..45699d7 100644
--- a/tests/PathOpsExtendedTest.cpp
+++ b/tests/PathOpsExtendedTest.cpp
@@ -686,7 +686,7 @@
}
SkPath pathOut, scaledPathOut;
SkRegion rgnA, rgnB, openClip, rgnOut;
- openClip.setRect(-16000, -16000, 16000, 16000);
+ openClip.setRect({-16000, -16000, 16000, 16000});
rgnA.setPath(a, openClip);
rgnB.setPath(b, openClip);
rgnOut.op(rgnA, rgnB, (SkRegion::Op) shapeOp);
diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp
index 5c04a8f..0f652c7 100644
--- a/tests/PathOpsOpTest.cpp
+++ b/tests/PathOpsOpTest.cpp
@@ -1183,15 +1183,15 @@
SkScalar yF = 50.65f;
SkPath paths[5];
SkRect rects[5];
- rects[0].set(xB, yB, xE, yE);
+ rects[0].setLTRB(xB, yB, xE, yE);
paths[0].addRoundRect(rects[0], SkIntToScalar(5), SkIntToScalar(5)); // red
- rects[1].set(xA, yA, xD, yD);
+ rects[1].setLTRB(xA, yA, xD, yD);
paths[1].addRoundRect(rects[1], SkIntToScalar(5), SkIntToScalar(5)); // green
- rects[2].set(xC, yA, xF, yD);
+ rects[2].setLTRB(xC, yA, xF, yD);
paths[2].addRoundRect(rects[2], SkIntToScalar(5), SkIntToScalar(5)); // blue
- rects[3].set(xA, yC, xD, yF);
+ rects[3].setLTRB(xA, yC, xD, yF);
paths[3].addRoundRect(rects[3], SkIntToScalar(5), SkIntToScalar(5)); // yellow
- rects[4].set(xC, yC, xF, yF);
+ rects[4].setLTRB(xC, yC, xF, yF);
paths[4].addRoundRect(rects[4], SkIntToScalar(5), SkIntToScalar(5)); // cyan
SkPath path;
path.setFillType(SkPath::kInverseEvenOdd_FillType);
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 8cc3c71..3b92ec8 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -290,7 +290,7 @@
};
SkRegion clip;
- clip.setRect(0, 0, 1255, 1925);
+ clip.setRect({0, 0, 1255, 1925});
for (size_t i = 0; i < SK_ARRAY_COUNT(procs); ++i) {
SkPath path;
@@ -796,7 +796,7 @@
SkScalar ry = SkMinScalar(rect.height(), yIn);
SkRect arcRect;
- arcRect.set(-rx, -ry, rx, ry);
+ arcRect.setLTRB(-rx, -ry, rx, ry);
switch (startAngle) {
case 0:
arcRect.offset(rect.fRight - arcRect.fRight, rect.fBottom - arcRect.fBottom);
@@ -891,9 +891,9 @@
SkRect r;
r.setEmpty();
REPORTER_ASSERT(reporter, r.isFinite());
- r.set(0, 0, inf, negInf);
+ r.setLTRB(0, 0, inf, negInf);
REPORTER_ASSERT(reporter, !r.isFinite());
- r.set(0, 0, nan, 0);
+ r.setLTRB(0, 0, nan, 0);
REPORTER_ASSERT(reporter, !r.isFinite());
SkPoint pts[] = {
@@ -2160,7 +2160,7 @@
SkPath::Direction direction;
SkPathPriv::FirstDirection cheapDirection;
int pointCount = tests[testIndex].fPointCount - (d2 == tests[testIndex].fPoints);
- expected.set(tests[testIndex].fPoints, pointCount);
+ expected.setBounds(tests[testIndex].fPoints, pointCount);
REPORTER_ASSERT(reporter, SkPathPriv::CheapComputeFirstDirection(path, &cheapDirection));
REPORTER_ASSERT(reporter, path.isRect(&computed, &isClosed, &direction));
REPORTER_ASSERT(reporter, expected == computed);
@@ -2168,7 +2168,7 @@
REPORTER_ASSERT(reporter, SkPathPriv::AsFirstDirection(direction) == cheapDirection);
} else {
SkRect computed;
- computed.set(123, 456, 789, 1011);
+ computed.setLTRB(123, 456, 789, 1011);
for (auto c : {true, false})
for (auto d : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
bool isClosed = c;
@@ -2463,7 +2463,7 @@
SkPathPriv::FirstDirection expectedDirs[2];
SkPath::Direction computedDirs[2];
SkRect testBounds;
- testBounds.set(tests[testIndex].fPoints, tests[testIndex].fPointCount);
+ testBounds.setBounds(tests[testIndex].fPoints, tests[testIndex].fPointCount);
expected[0] = SkRect::MakeLTRB(-1, -1, 2, 2);
expected[1] = testBounds;
if (rectFirst) {
@@ -4800,7 +4800,7 @@
// this triggers a code path in SkPath::swap which is otherwise unexercised
p.swap(self);
- bounds.set(0, 0, SK_Scalar1, SK_Scalar1);
+ bounds.setLTRB(0, 0, SK_Scalar1, SK_Scalar1);
p.addRoundRect(bounds, SK_Scalar1, SK_Scalar1);
check_convex_bounds(reporter, p, bounds);
@@ -4843,7 +4843,7 @@
REPORTER_ASSERT(reporter, SkPath::kLine_Verb == verbs[3]);
REPORTER_ASSERT(reporter, SkPath::kClose_Verb == verbs[4]);
REPORTER_ASSERT(reporter, 0xff == verbs[5]);
- bounds2.set(pts, 4);
+ bounds2.setBounds(pts, 4);
REPORTER_ASSERT(reporter, bounds == bounds2);
bounds.offset(SK_Scalar1*3, SK_Scalar1*4);
@@ -4856,7 +4856,7 @@
REPORTER_ASSERT(reporter, bounds == bounds2);
// now force p to not be a rect
- bounds.set(0, 0, SK_Scalar1/2, SK_Scalar1/2);
+ bounds.setWH(SK_Scalar1/2, SK_Scalar1/2);
p.addRect(bounds);
REPORTER_ASSERT(reporter, !p.isRect(nullptr));
@@ -5207,7 +5207,7 @@
SkPath path = makePath(points, SK_ARRAY_COUNT(points), false);
REPORTER_ASSERT(reporter, path.isRect(&rect));
SkRect compare;
- compare.set(&points[1], SK_ARRAY_COUNT(points) - 1);
+ compare.setBounds(&points[1], SK_ARRAY_COUNT(points) - 1);
REPORTER_ASSERT(reporter, rect == compare);
// isolated from skbug.com/7792#c3
SkPoint points3[] = { {75, 50}, {100, 75}, {150, 75}, {150, 150}, {75, 150}, {75, 50} };
@@ -5217,7 +5217,7 @@
SkPoint points9[] = { {10, 10}, {75, 75}, {150, 75}, {150, 150}, {75, 150} };
path = makePath(points9, SK_ARRAY_COUNT(points9), true);
REPORTER_ASSERT(reporter, path.isRect(&rect));
- compare.set(&points9[1], SK_ARRAY_COUNT(points9) - 1);
+ compare.setBounds(&points9[1], SK_ARRAY_COUNT(points9) - 1);
REPORTER_ASSERT(reporter, rect == compare);
// isolated from skbug.com/7792#c11
SkPath::Verb verbs11[] = { SkPath::kMove_Verb, SkPath::kLine_Verb, SkPath::kLine_Verb,
@@ -5225,7 +5225,7 @@
SkPoint points11[] = { {75, 150}, {75, 75}, {150, 75}, {150, 150}, {75, 150}, {75, 150} };
path = makePath2(points11, verbs11, SK_ARRAY_COUNT(verbs11));
REPORTER_ASSERT(reporter, path.isRect(&rect));
- compare.set(&points11[0], SK_ARRAY_COUNT(points11));
+ compare.setBounds(&points11[0], SK_ARRAY_COUNT(points11));
REPORTER_ASSERT(reporter, rect == compare);
// isolated from skbug.com/7792#c14
SkPath::Verb verbs14[] = { SkPath::kMove_Verb, SkPath::kMove_Verb, SkPath::kMove_Verb,
@@ -5242,7 +5242,7 @@
SkPoint points15[] = { {75, 75}, {150, 75}, {150, 150}, {75, 150}, {250, 75} };
path = makePath2(points15, verbs15, SK_ARRAY_COUNT(verbs15));
REPORTER_ASSERT(reporter, path.isRect(&rect));
- compare.set(&points15[0], SK_ARRAY_COUNT(points15) - 1);
+ compare.setBounds(&points15[0], SK_ARRAY_COUNT(points15) - 1);
REPORTER_ASSERT(reporter, rect == compare);
// isolated from skbug.com/7792#c17
SkPoint points17[] = { {75, 10}, {75, 75}, {150, 75}, {150, 150}, {75, 150}, {75, 10} };
@@ -5265,7 +5265,7 @@
{75, 150} };
path = makePath2(points23, verbs23, SK_ARRAY_COUNT(verbs23));
REPORTER_ASSERT(reporter, path.isRect(&rect));
- compare.set(&points23[0], SK_ARRAY_COUNT(points23));
+ compare.setBounds(&points23[0], SK_ARRAY_COUNT(points23));
REPORTER_ASSERT(reporter, rect == compare);
// isolated from skbug.com/7792#c29
SkPath::Verb verbs29[] = { SkPath::kMove_Verb, SkPath::kLine_Verb, SkPath::kLine_Verb,
@@ -5281,7 +5281,7 @@
SkPoint points31[] = { {75, 75}, {150, 75}, {150, 150}, {75, 150}, {75, 10}, {75, 75} };
path = makePath2(points31, verbs31, SK_ARRAY_COUNT(verbs31));
REPORTER_ASSERT(reporter, path.isRect(&rect));
- compare.set(&points31[0], 4);
+ compare.setBounds(&points31[0], 4);
REPORTER_ASSERT(reporter, rect == compare);
// isolated from skbug.com/7792#c36
SkPath::Verb verbs36[] = { SkPath::kMove_Verb, SkPath::kLine_Verb, SkPath::kLine_Verb,
@@ -5303,7 +5303,7 @@
{32, 2} };
path = makePath2(pointsAA, verbsAA, SK_ARRAY_COUNT(verbsAA));
REPORTER_ASSERT(reporter, path.isRect(&rect));
- compare.set(&pointsAA[0], SK_ARRAY_COUNT(pointsAA));
+ compare.setBounds(&pointsAA[0], SK_ARRAY_COUNT(pointsAA));
REPORTER_ASSERT(reporter, rect == compare);
// isolated from skbug.com/7792#c41
SkPath::Verb verbs41[] = { SkPath::kMove_Verb, SkPath::kLine_Verb, SkPath::kLine_Verb,
@@ -5312,7 +5312,7 @@
SkPoint points41[] = { {75, 75}, {150, 75}, {150, 150}, {140, 150}, {140, 75}, {75, 75} };
path = makePath2(points41, verbs41, SK_ARRAY_COUNT(verbs41));
REPORTER_ASSERT(reporter, path.isRect(&rect));
- compare.set(&points41[1], 4);
+ compare.setBounds(&points41[1], 4);
REPORTER_ASSERT(reporter, rect == compare);
// isolated from skbug.com/7792#c53
SkPath::Verb verbs53[] = { SkPath::kMove_Verb, SkPath::kLine_Verb, SkPath::kLine_Verb,
@@ -5321,7 +5321,7 @@
SkPoint points53[] = { {75, 75}, {150, 75}, {150, 150}, {140, 150}, {140, 75}, {75, 75} };
path = makePath2(points53, verbs53, SK_ARRAY_COUNT(verbs53));
REPORTER_ASSERT(reporter, path.isRect(&rect));
- compare.set(&points53[1], 4);
+ compare.setBounds(&points53[1], 4);
REPORTER_ASSERT(reporter, rect == compare);
}
diff --git a/tests/RegionTest.cpp b/tests/RegionTest.cpp
index 707cd3f..239ffaa 100644
--- a/tests/RegionTest.cpp
+++ b/tests/RegionTest.cpp
@@ -98,7 +98,7 @@
emptyPath.moveTo(1, 5);
emptyPath.close();
SkRegion openClip;
- openClip.setRect(-16000, -16000, 16000, 16000);
+ openClip.setRect({-16000, -16000, 16000, 16000});
empty.setPath(emptyPath, openClip); // should not assert
}
@@ -205,8 +205,8 @@
static void rand_rect(SkIRect* rect, SkRandom& rand) {
int bits = 6;
int shift = 32 - bits;
- rect->set(rand.nextU() >> shift, rand.nextU() >> shift,
- rand.nextU() >> shift, rand.nextU() >> shift);
+ rect->setLTRB(rand.nextU() >> shift, rand.nextU() >> shift,
+ rand.nextU() >> shift, rand.nextU() >> shift);
rect->sort();
}
@@ -285,13 +285,13 @@
test_write(region, r);
// Test a rectangular region
- bool nonEmpty = region.setRect(0, 0, 50, 50);
+ bool nonEmpty = region.setRect({0, 0, 50, 50});
REPORTER_ASSERT(r, nonEmpty);
REPORTER_ASSERT(r, region.isRect());
test_write(region, r);
// Test a complex region
- nonEmpty = region.op(50, 50, 100, 100, SkRegion::kUnion_Op);
+ nonEmpty = region.op({50, 50, 100, 100}, SkRegion::kUnion_Op);
REPORTER_ASSERT(r, nonEmpty);
REPORTER_ASSERT(r, region.isComplex());
test_write(region, r);
diff --git a/tests/ScalarTest.cpp b/tests/ScalarTest.cpp
index 2209f0d..ceac1e3 100644
--- a/tests/ScalarTest.cpp
+++ b/tests/ScalarTest.cpp
@@ -68,7 +68,7 @@
for (size_t i = 0; i < SK_ARRAY_COUNT(gSets); ++i) {
SkRect r;
- r.set(gSets[i].fPts, gSets[i].fCount);
+ r.setBounds(gSets[i].fPts, gSets[i].fCount);
bool rectIsFinite = !r.isEmpty();
REPORTER_ASSERT(reporter, gSets[i].fIsFinite == rectIsFinite);
}
diff --git a/tools/fiddle/all_examples.cpp b/tools/fiddle/all_examples.cpp
index 07cc4c3..0886470 100644
--- a/tools/fiddle/all_examples.cpp
+++ b/tools/fiddle/all_examples.cpp
@@ -297,7 +297,6 @@
#include "../../docs/examples/IRect_contains.cpp"
#include "../../docs/examples/IRect_containsNoEmptyCheck.cpp"
#include "../../docs/examples/IRect_containsNoEmptyCheck_2.cpp"
-#include "../../docs/examples/IRect_contains_2.cpp"
#include "../../docs/examples/IRect_contains_3.cpp"
#include "../../docs/examples/IRect_contains_4.cpp"
#include "../../docs/examples/IRect_equal_operator.cpp"
@@ -307,10 +306,8 @@
#include "../../docs/examples/IRect_intersect.cpp"
#include "../../docs/examples/IRect_intersectNoEmptyCheck.cpp"
#include "../../docs/examples/IRect_intersect_2.cpp"
-#include "../../docs/examples/IRect_intersect_3.cpp"
#include "../../docs/examples/IRect_isEmpty.cpp"
#include "../../docs/examples/IRect_isEmpty64.cpp"
-#include "../../docs/examples/IRect_join.cpp"
#include "../../docs/examples/IRect_join_2.cpp"
#include "../../docs/examples/IRect_left.cpp"
#include "../../docs/examples/IRect_makeInset.cpp"
@@ -323,7 +320,6 @@
#include "../../docs/examples/IRect_offset_2.cpp"
#include "../../docs/examples/IRect_outset.cpp"
#include "../../docs/examples/IRect_right.cpp"
-#include "../../docs/examples/IRect_set.cpp"
#include "../../docs/examples/IRect_setEmpty.cpp"
#include "../../docs/examples/IRect_setLTRB.cpp"
#include "../../docs/examples/IRect_setXYWH.cpp"
@@ -929,8 +925,6 @@
#include "../../docs/examples/Rect_isEmpty.cpp"
#include "../../docs/examples/Rect_isFinite.cpp"
#include "../../docs/examples/Rect_isSorted.cpp"
-#include "../../docs/examples/Rect_iset.cpp"
-#include "../../docs/examples/Rect_isetWH.cpp"
#include "../../docs/examples/Rect_join.cpp"
#include "../../docs/examples/Rect_joinNonEmptyArg.cpp"
#include "../../docs/examples/Rect_joinPossiblyEmptyRect.cpp"
@@ -960,8 +954,6 @@
#include "../../docs/examples/Rect_setLTRB.cpp"
#include "../../docs/examples/Rect_setWH.cpp"
#include "../../docs/examples/Rect_setXYWH.cpp"
-#include "../../docs/examples/Rect_set_2.cpp"
-#include "../../docs/examples/Rect_set_3.cpp"
#include "../../docs/examples/Rect_set_4.cpp"
#include "../../docs/examples/Rect_sort.cpp"
#include "../../docs/examples/Rect_toQuad.cpp"
@@ -1009,7 +1001,6 @@
#include "../../docs/examples/Region_op_5.cpp"
#include "../../docs/examples/Region_op_6.cpp"
#include "../../docs/examples/Region_quickContains.cpp"
-#include "../../docs/examples/Region_quickContains_2.cpp"
#include "../../docs/examples/Region_quickReject.cpp"
#include "../../docs/examples/Region_quickReject_2.cpp"
#include "../../docs/examples/Region_readFromMemory.cpp"
@@ -1017,7 +1008,6 @@
#include "../../docs/examples/Region_setEmpty.cpp"
#include "../../docs/examples/Region_setPath.cpp"
#include "../../docs/examples/Region_setRect.cpp"
-#include "../../docs/examples/Region_setRect_2.cpp"
#include "../../docs/examples/Region_setRects.cpp"
#include "../../docs/examples/Region_setRegion.cpp"
#include "../../docs/examples/Region_swap.cpp"