aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs/SkRect_Reference.bmh
diff options
context:
space:
mode:
Diffstat (limited to 'docs/SkRect_Reference.bmh')
-rw-r--r--docs/SkRect_Reference.bmh1155
1 files changed, 581 insertions, 574 deletions
diff --git a/docs/SkRect_Reference.bmh b/docs/SkRect_Reference.bmh
index 7dc1e3776a..1a28f1bd12 100644
--- a/docs/SkRect_Reference.bmh
+++ b/docs/SkRect_Reference.bmh
@@ -136,20 +136,20 @@ is a convenience, but does not designate a special empty rectangle.
#Return bounds (0, 0, 0, 0) ##
#Example
- SkRect rect = SkRect::MakeEmpty();
- SkDebugf("MakeEmpty isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
- rect.offset(10, 10);
- SkDebugf("offset rect isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
- rect.inset(10, 10);
- SkDebugf("inset rect isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
- rect.outset(20, 20);
- SkDebugf("outset rect isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
-#StdOut
-MakeEmpty isEmpty: true
-offset rect isEmpty: true
-inset rect isEmpty: true
-outset rect isEmpty: false
-##
+ SkRect rect = SkRect::MakeEmpty();
+ SkDebugf("MakeEmpty isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
+ rect.offset(10, 10);
+ SkDebugf("offset rect isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
+ rect.inset(10, 10);
+ SkDebugf("inset rect isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
+ rect.outset(20, 20);
+ SkDebugf("outset rect isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
+#StdOut
+MakeEmpty isEmpty: true
+offset rect isEmpty: true
+inset rect isEmpty: true
+outset rect isEmpty: false
+##
##
#SeeAlso isEmpty setEmpty setLargestInverted SkIRect::MakeEmpty
@@ -166,23 +166,23 @@ setting right and bottom to most positive finite value.
#Return bounds (SK_ScalarMin, SK_ScalarMin, SK_ScalarMax, SK_ScalarMax) ##
#Example
- SkRect rect = SkRect::MakeLargest();
- SkDebugf("MakeLargest isLargest: %s\n", rect.isLargest() ? "true" : "false");
- SkDebugf("MakeLargest isFinite: %s\n", rect.isFinite() ? "true" : "false");
- rect.outset(1e31, 1e31);
- SkDebugf("outset a little isLargest: %s\n", rect.isLargest() ? "true" : "false");
- SkDebugf("outset a little isFinite: %s\n", rect.isFinite() ? "true" : "false");
- rect.outset(1e32, 1e32);
- SkDebugf("outset a little more isLargest: %s\n", rect.isLargest() ? "true" : "false");
- SkDebugf("outset a little more isFinite: %s\n", rect.isFinite() ? "true" : "false");
-#StdOut
-MakeLargest isLargest: true
-MakeLargest isFinite: true
-outset a little isLargest: true
-outset a little isFinite: true
-outset a little more isLargest: false
-outset a little more isFinite: false
-##
+ SkRect rect = SkRect::MakeLargest();
+ SkDebugf("MakeLargest isLargest: %s\n", rect.isLargest() ? "true" : "false");
+ SkDebugf("MakeLargest isFinite: %s\n", rect.isFinite() ? "true" : "false");
+ rect.outset(1e31, 1e31);
+ SkDebugf("outset a little isLargest: %s\n", rect.isLargest() ? "true" : "false");
+ SkDebugf("outset a little isFinite: %s\n", rect.isFinite() ? "true" : "false");
+ rect.outset(1e32, 1e32);
+ SkDebugf("outset a little more isLargest: %s\n", rect.isLargest() ? "true" : "false");
+ SkDebugf("outset a little more isFinite: %s\n", rect.isFinite() ? "true" : "false");
+#StdOut
+MakeLargest isLargest: true
+MakeLargest isFinite: true
+outset a little isLargest: true
+outset a little isFinite: true
+outset a little more isLargest: false
+outset a little more isFinite: false
+##
##
#SeeAlso MakeLargestS32 isLargest setLargest SkIRect::MakeLargest
@@ -205,13 +205,13 @@ These are the largest values for which round() is well defined.
##
#Example
- SkRect f_rect = SkRect::MakeLargestS32();
- SkIRect i_rect = f_rect.round();
- SkRect r_rect = SkRect::Make(i_rect);
- SkDebugf("f_rect %c= r_rect\n", f_rect == r_rect ? '=' : '!');
-#StdOut
-f_rect == r_rect
-##
+ SkRect f_rect = SkRect::MakeLargestS32();
+ SkIRect i_rect = f_rect.round();
+ SkRect r_rect = SkRect::Make(i_rect);
+ SkDebugf("f_rect %c= r_rect\n", f_rect == r_rect ? '=' : '!');
+#StdOut
+f_rect == r_rect
+##
##
#SeeAlso MakeLargest isLargest setLargest SkIRect::MakeLargest
@@ -234,11 +234,11 @@ represent 32-bit integers exactly. Use SkIRect for an exact integer rectangle.
#Return bounds (0, 0, w, h) ##
#Example
- SkRect rect1 = SkRect::MakeWH(25, 35);
- SkRect rect2 = SkRect::MakeIWH(25, 35);
- SkRect rect3 = SkRect::MakeXYWH(0, 0, 25, 35);
- SkRect rect4 = SkRect::MakeLTRB(0, 0, 25, 35);
- SkDebugf("all %s" "equal\n", rect1 == rect2 && rect2 == rect3 && rect3 == rect4 ?
+ SkRect rect1 = SkRect::MakeWH(25, 35);
+ SkRect rect2 = SkRect::MakeIWH(25, 35);
+ SkRect rect3 = SkRect::MakeXYWH(0, 0, 25, 35);
+ SkRect rect4 = SkRect::MakeLTRB(0, 0, 25, 35);
+ SkDebugf("all %s" "equal\n", rect1 == rect2 && rect2 == rect3 && rect3 == rect4 ?
"" : "not ");
#StdOut
all equal
@@ -265,14 +265,14 @@ Use SkIRect for an exact integer rectangle.
#Return bounds (0, 0, w, h) ##
#Example
- SkIRect i_rect = SkIRect::MakeWH(25, 35);
- SkRect f_rect = SkRect::MakeIWH(25, 35);
- SkDebugf("i_rect width: %d f_rect width:%g\n", i_rect.width(), f_rect.width());
- i_rect = SkIRect::MakeWH(125000111, 0);
- f_rect = SkRect::MakeIWH(125000111, 0);
- SkDebugf("i_rect width: %d f_rect width:%.0f\n", i_rect.width(), f_rect.width());
+ SkIRect i_rect = SkIRect::MakeWH(25, 35);
+ SkRect f_rect = SkRect::MakeIWH(25, 35);
+ SkDebugf("i_rect width: %d f_rect width:%g\n", i_rect.width(), f_rect.width());
+ i_rect = SkIRect::MakeWH(125000111, 0);
+ f_rect = SkRect::MakeIWH(125000111, 0);
+ SkDebugf("i_rect width: %d f_rect width:%.0f\n", i_rect.width(), f_rect.width());
#StdOut
-i_rect width: 25 f_rect width:25
+i_rect width: 25 f_rect width:25
i_rect width: 125000111 f_rect width:125000112
##
##
@@ -293,14 +293,14 @@ validate input; size.width() or size.height() may be negative.
#Return bounds (0, 0, size.width(), size.height()) ##
#Example
- SkSize size = {25.5f, 35.5f};
- SkRect rect = SkRect::MakeSize(size);
- SkDebugf("rect width: %g height: %g\n", rect.width(), rect.height());
- SkISize floor = size.toFloor();
- rect = SkRect::MakeSize(SkSize::Make(floor));
- SkDebugf("floor width: %g height: %g\n", rect.width(), rect.height());
+ SkSize size = {25.5f, 35.5f};
+ SkRect rect = SkRect::MakeSize(size);
+ SkDebugf("rect width: %g height: %g\n", rect.width(), rect.height());
+ SkISize floor = size.toFloor();
+ rect = SkRect::MakeSize(SkSize::Make(floor));
+ SkDebugf("floor width: %g height: %g\n", rect.width(), rect.height());
#StdOut
-rect width: 25.5 height: 35.5
+rect width: 25.5 height: 35.5
floor width: 25 height: 35
##
##
@@ -325,14 +325,14 @@ result in fLeft greater than fRight, or fTop greater than fBottom.
#Return bounds (l, t, r, b) ##
#Example
- SkRect rect = SkRect::MakeLTRB(5, 35, 15, 25);
- SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
- rect.bottom(), rect.isEmpty() ? "true" : "false");
- rect.sort();
- SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
- rect.bottom(), rect.isEmpty() ? "true" : "false");
+ SkRect rect = SkRect::MakeLTRB(5, 35, 15, 25);
+ SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
+ rect.bottom(), rect.isEmpty() ? "true" : "false");
+ rect.sort();
+ SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
+ rect.bottom(), rect.isEmpty() ? "true" : "false");
#StdOut
-rect: 5, 35, 15, 25 isEmpty: true
+rect: 5, 35, 15, 25 isEmpty: true
rect: 5, 25, 15, 35 isEmpty: false
##
##
@@ -360,14 +360,14 @@ w or h may be negative.
#Return bounds at (x, y) with width w and height h ##
#Example
- SkRect rect = SkRect::MakeXYWH(5, 35, -15, 25);
- SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
- rect.bottom(), rect.isEmpty() ? "true" : "false");
- rect.sort();
- SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
- rect.bottom(), rect.isEmpty() ? "true" : "false");
+ SkRect rect = SkRect::MakeXYWH(5, 35, -15, 25);
+ SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
+ rect.bottom(), rect.isEmpty() ? "true" : "false");
+ rect.sort();
+ SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
+ rect.bottom(), rect.isEmpty() ? "true" : "false");
#StdOut
-rect: 5, 35, -10, 60 isEmpty: true
+rect: 5, 35, -10, 60 isEmpty: true
rect: -10, 35, 5, 60 isEmpty: false
##
##
@@ -408,9 +408,9 @@ Does not validate input; size.width() or size.height() may be negative.
#Return bounds (0, 0, size.width(), size.height()) ##
#Example
- SkRect rect1 = SkRect::MakeSize({2, 35});
- SkRect rect2 = SkRect::MakeIWH(2, 35);
- SkDebugf("rect1 %c= rect2\n", rect1 == rect2 ? '=' : '!');
+ SkRect rect1 = SkRect::MakeSize({2, 35});
+ SkRect rect2 = SkRect::MakeIWH(2, 35);
+ SkDebugf("rect1 %c= rect2\n", rect1 == rect2 ? '=' : '!');
#StdOut
rect1 == rect2
##
@@ -433,12 +433,12 @@ than fBottom.
#Return irect members converted to SkScalar ##
#Example
- SkIRect i_rect1 = {2, 35, 22, 53};
- SkRect f_rect = SkRect::Make(i_rect1);
- f_rect.offset(0.49f, 0.49f);
- SkIRect i_rect2;
- f_rect.round(&i_rect2);
- SkDebugf("i_rect1 %c= i_rect2\n", i_rect1 == i_rect2? '=' : '!');
+ SkIRect i_rect1 = {2, 35, 22, 53};
+ SkRect f_rect = SkRect::Make(i_rect1);
+ f_rect.offset(0.49f, 0.49f);
+ SkIRect i_rect2;
+ f_rect.round(&i_rect2);
+ SkDebugf("i_rect1 %c= i_rect2\n", i_rect1 == i_rect2? '=' : '!');
##
#SeeAlso MakeLTRB
@@ -456,20 +456,20 @@ width() or height().
#Return true if width() or height() are zero or negative ##
#Example
- SkRect tests[] = {{20, 40, 10, 50}, {20, 40, 20, 50}};
- for (auto rect : tests) {
- SkDebugf("rect: {%g, %g, %g, %g} is" "%s empty\n", rect.left(), rect.top(), rect.right(),
- rect.bottom(), rect.isEmpty() ? "" : " not");
- rect.sort();
- SkDebugf("sorted: {%g, %g, %g, %g} is" "%s empty\n", rect.left(), rect.top(), rect.right(),
- rect.bottom(), rect.isEmpty() ? "" : " not");
- }
-#StdOut
-rect: {20, 40, 10, 50} is empty
-sorted: {10, 40, 20, 50} is not empty
-rect: {20, 40, 20, 50} is empty
-sorted: {20, 40, 20, 50} is empty
-##
+ SkRect tests[] = {{20, 40, 10, 50}, {20, 40, 20, 50}};
+ for (auto rect : tests) {
+ SkDebugf("rect: {%g, %g, %g, %g} is" "%s empty\n", rect.left(), rect.top(), rect.right(),
+ rect.bottom(), rect.isEmpty() ? "" : " not");
+ rect.sort();
+ SkDebugf("sorted: {%g, %g, %g, %g} is" "%s empty\n", rect.left(), rect.top(), rect.right(),
+ rect.bottom(), rect.isEmpty() ? "" : " not");
+ }
+#StdOut
+rect: {20, 40, 10, 50} is empty
+sorted: {10, 40, 20, 50} is not empty
+rect: {20, 40, 20, 50} is empty
+sorted: {20, 40, 20, 50} is empty
+##
##
#SeeAlso MakeEmpty sort SkIRect::isEmpty
@@ -487,20 +487,20 @@ width() or height().
#Return true if width() or height() are zero or positive ##
#Example
- SkRect tests[] = {{20, 40, 10, 50}, {20, 40, 20, 50}};
- for (auto rect : tests) {
- SkDebugf("rect: {%g, %g, %g, %g} is" "%s sorted\n", rect.left(), rect.top(), rect.right(),
- rect.bottom(), rect.isSorted() ? "" : " not");
- rect.sort();
- SkDebugf("sorted: {%g, %g, %g, %g} is" "%s sorted\n", rect.left(), rect.top(), rect.right(),
- rect.bottom(), rect.isSorted() ? "" : " not");
- }
-#StdOut
-rect: {20, 40, 10, 50} is not sorted
-sorted: {10, 40, 20, 50} is sorted
-rect: {20, 40, 20, 50} is sorted
-sorted: {20, 40, 20, 50} is sorted
-##
+ SkRect tests[] = {{20, 40, 10, 50}, {20, 40, 20, 50}};
+ for (auto rect : tests) {
+ SkDebugf("rect: {%g, %g, %g, %g} is" "%s sorted\n", rect.left(), rect.top(), rect.right(),
+ rect.bottom(), rect.isSorted() ? "" : " not");
+ rect.sort();
+ SkDebugf("sorted: {%g, %g, %g, %g} is" "%s sorted\n", rect.left(), rect.top(), rect.right(),
+ rect.bottom(), rect.isSorted() ? "" : " not");
+ }
+#StdOut
+rect: {20, 40, 10, 50} is not sorted
+sorted: {10, 40, 20, 50} is sorted
+rect: {20, 40, 20, 50} is sorted
+sorted: {20, 40, 20, 50} is sorted
+##
##
#SeeAlso sort makeSorted isEmpty
@@ -519,16 +519,16 @@ Returns true if Rect encloses largest possible area.
#Description
Note that the width cannot be represented as a 32-bit finite value.
##
- SkRect large = SkRect::MakeLargest();
- SkDebugf("large is largest: %s\n" ,large.isLargest() ? "true" : "false");
- SkDebugf("large width %g\n", large.width());
- SkDebugf("large is empty: %s\n", large.isEmpty() ? "true" : "false");
+ SkRect large = SkRect::MakeLargest();
+ SkDebugf("large is largest: %s\n" ,large.isLargest() ? "true" : "false");
+ SkDebugf("large width %g\n", large.width());
+ SkDebugf("large is empty: %s\n", large.isEmpty() ? "true" : "false");
SkDebugf("large is sorted: %s\n", large.isSorted() ? "true" : "false");
- SkDebugf("large is finite: %s\n", large.isFinite() ? "true" : "false");
-#StdOut
-large is largest: true
-large width inf
-large is empty: false
+ SkDebugf("large is finite: %s\n", large.isFinite() ? "true" : "false");
+#StdOut
+large is largest: true
+large width inf
+large is empty: false
large is sorted: true
large is finite: true
##
@@ -548,14 +548,14 @@ and SK_ScalarMax or smaller.
#Return true if no member is infinite or NaN ##
#Example
- SkRect largest = SkRect::MakeLargest();
- SkDebugf("largest is finite: %s\n", largest.isFinite() ? "true" : "false");
- SkDebugf("large width %g\n", largest.width());
- SkRect widest = SkRect::MakeWH(largest.width(), largest.height());
- SkDebugf("widest is finite: %s\n", widest.isFinite() ? "true" : "false");
-#StdOut
-largest is finite: true
-large width inf
+ SkRect largest = SkRect::MakeLargest();
+ SkDebugf("largest is finite: %s\n", largest.isFinite() ? "true" : "false");
+ SkDebugf("large width %g\n", largest.width());
+ SkRect widest = SkRect::MakeWH(largest.width(), largest.height());
+ SkDebugf("widest is finite: %s\n", widest.isFinite() ? "true" : "false");
+#StdOut
+largest is finite: true
+large width inf
widest is finite: false
##
##
@@ -574,12 +574,12 @@ Call sort() to reverse fLeft and fRight if needed.
#Return fLeft ##
#Example
- SkRect unsorted = { 15, 5, 10, 25 };
- SkDebugf("unsorted.fLeft: %g unsorted.x(): %g\n", unsorted.fLeft, unsorted.x());
- SkRect sorted = unsorted.makeSorted();
- SkDebugf("sorted.fLeft: %g sorted.x(): %g\n", sorted.fLeft, sorted.x());
+ SkRect unsorted = { 15, 5, 10, 25 };
+ SkDebugf("unsorted.fLeft: %g unsorted.x(): %g\n", unsorted.fLeft, unsorted.x());
+ SkRect sorted = unsorted.makeSorted();
+ SkDebugf("sorted.fLeft: %g sorted.x(): %g\n", sorted.fLeft, sorted.x());
#StdOut
-unsorted.fLeft: 15 unsorted.x(): 15
+unsorted.fLeft: 15 unsorted.x(): 15
sorted.fLeft: 10 sorted.x(): 10
##
##
@@ -598,12 +598,12 @@ and sort() to reverse fTop and fBottom if needed.
#Return fTop ##
#Example
- SkRect unsorted = { 15, 25, 10, 5 };
- SkDebugf("unsorted.fTop: %g unsorted.y(): %g\n", unsorted.fTop, unsorted.y());
- SkRect sorted = unsorted.makeSorted();
+ SkRect unsorted = { 15, 25, 10, 5 };
+ SkDebugf("unsorted.fTop: %g unsorted.y(): %g\n", unsorted.fTop, unsorted.y());
+ SkRect sorted = unsorted.makeSorted();
SkDebugf("sorted.fTop: %g sorted.y(): %g\n", sorted.fTop, sorted.y());
#StdOut
-unsorted.fTop: 25 unsorted.y(): 25
+unsorted.fTop: 25 unsorted.y(): 25
sorted.fTop: 5 sorted.y(): 5
##
##
@@ -622,12 +622,12 @@ Call sort() to reverse fLeft and fRight if needed.
#Return fLeft ##
#Example
- SkRect unsorted = { 15, 5, 10, 25 };
- SkDebugf("unsorted.fLeft: %g unsorted.left(): %g\n", unsorted.fLeft, unsorted.left());
- SkRect sorted = unsorted.makeSorted();
- SkDebugf("sorted.fLeft: %g sorted.left(): %g\n", sorted.fLeft, sorted.left());
+ SkRect unsorted = { 15, 5, 10, 25 };
+ SkDebugf("unsorted.fLeft: %g unsorted.left(): %g\n", unsorted.fLeft, unsorted.left());
+ SkRect sorted = unsorted.makeSorted();
+ SkDebugf("sorted.fLeft: %g sorted.left(): %g\n", sorted.fLeft, sorted.left());
#StdOut
-unsorted.fLeft: 15 unsorted.left(): 15
+unsorted.fLeft: 15 unsorted.left(): 15
sorted.fLeft: 10 sorted.left(): 10
##
##
@@ -646,12 +646,12 @@ and sort() to reverse fTop and fBottom if needed.
#Return fTop ##
#Example
- SkRect unsorted = { 15, 25, 10, 5 };
- SkDebugf("unsorted.fTop: %g unsorted.top(): %g\n", unsorted.fTop, unsorted.top());
- SkRect sorted = unsorted.makeSorted();
+ SkRect unsorted = { 15, 25, 10, 5 };
+ SkDebugf("unsorted.fTop: %g unsorted.top(): %g\n", unsorted.fTop, unsorted.top());
+ SkRect sorted = unsorted.makeSorted();
SkDebugf("sorted.fTop: %g sorted.top(): %g\n", sorted.fTop, sorted.top());
#StdOut
-unsorted.fTop: 25 unsorted.top(): 25
+unsorted.fTop: 25 unsorted.top(): 25
sorted.fTop: 5 sorted.top(): 5
##
##
@@ -670,12 +670,12 @@ Call sort() to reverse fLeft and fRight if needed.
#Return fRight ##
#Example
- SkRect unsorted = { 15, 25, 10, 5 };
- SkDebugf("unsorted.fRight: %g unsorted.right(): %g\n", unsorted.fRight, unsorted.right());
- SkRect sorted = unsorted.makeSorted();
- SkDebugf("sorted.fRight: %g sorted.right(): %g\n", sorted.fRight, sorted.right());
+ SkRect unsorted = { 15, 25, 10, 5 };
+ SkDebugf("unsorted.fRight: %g unsorted.right(): %g\n", unsorted.fRight, unsorted.right());
+ SkRect sorted = unsorted.makeSorted();
+ SkDebugf("sorted.fRight: %g sorted.right(): %g\n", sorted.fRight, sorted.right());
#StdOut
-unsorted.fRight: 10 unsorted.right(): 10
+unsorted.fRight: 10 unsorted.right(): 10
sorted.fRight: 15 sorted.right(): 15
##
##
@@ -694,12 +694,12 @@ and sort() to reverse fTop and fBottom if needed.
#Return fBottom ##
#Example
- SkRect unsorted = { 15, 25, 10, 5 };
- SkDebugf("unsorted.fBottom: %g unsorted.bottom(): %g\n", unsorted.fBottom, unsorted.bottom());
- SkRect sorted = unsorted.makeSorted();
- SkDebugf("sorted.fBottom: %g sorted.bottom(): %g\n", sorted.fBottom, sorted.bottom());
+ SkRect unsorted = { 15, 25, 10, 5 };
+ SkDebugf("unsorted.fBottom: %g unsorted.bottom(): %g\n", unsorted.fBottom, unsorted.bottom());
+ SkRect sorted = unsorted.makeSorted();
+ SkDebugf("sorted.fBottom: %g sorted.bottom(): %g\n", sorted.fBottom, sorted.bottom());
#StdOut
-unsorted.fBottom: 5 unsorted.bottom(): 5
+unsorted.fBottom: 5 unsorted.bottom(): 5
sorted.fBottom: 25 sorted.bottom(): 25
##
##
@@ -721,12 +721,12 @@ result fits in 32-bit float; result may be negative or infinity.
#Description
Compare with SkIRect::width() example.
##
- SkRect unsorted = { 15, 25, 10, 5 };
- SkDebugf("unsorted width: %g\n", unsorted.width());
- SkRect large = { -2147483647.f, 1, 2147483644.f, 2 };
- SkDebugf("large width: %.0f\n", large.width());
+ SkRect unsorted = { 15, 25, 10, 5 };
+ SkDebugf("unsorted width: %g\n", unsorted.width());
+ SkRect large = { -2147483647.f, 1, 2147483644.f, 2 };
+ SkDebugf("large width: %.0f\n", large.width());
#StdOut
-unsorted width: -5
+unsorted width: -5
large width: 4294967296
##
##
@@ -748,12 +748,12 @@ result fits in 32-bit float; result may be negative or infinity.
#Description
Compare with SkIRect::height() example.
##
- SkRect unsorted = { 15, 25, 10, 20 };
- SkDebugf("unsorted height: %g\n", unsorted.height());
- SkRect large = { 1, -2147483647.f, 2, 2147483644.f };
- SkDebugf("large height: %.0f\n", large.height());
+ SkRect unsorted = { 15, 25, 10, 20 };
+ SkDebugf("unsorted height: %g\n", unsorted.height());
+ SkRect large = { 1, -2147483647.f, 2, 2147483644.f };
+ SkDebugf("large height: %.0f\n", large.height());
#StdOut
-unsorted height: -5
+unsorted height: -5
large height: 4294967296
##
##
@@ -772,16 +772,16 @@ is sorted. Result may overflow to infinity if Rect is far from the origin.
#Return midpoint in x ##
#Example
- SkRect tests[] = {{20, 30, 41, 51}, {-20, -30, -41, -51}};
- for (auto rect : tests) {
- SkDebugf("left: %3g right: %3g centerX: %3g\n", rect.left(), rect.right(), rect.centerX());
- rect.sort();
- SkDebugf("left: %3g right: %3g centerX: %3g\n", rect.left(), rect.right(), rect.centerX());
- }
+ SkRect tests[] = {{20, 30, 41, 51}, {-20, -30, -41, -51}};
+ for (auto rect : tests) {
+ SkDebugf("left: %3g right: %3g centerX: %3g\n", rect.left(), rect.right(), rect.centerX());
+ rect.sort();
+ SkDebugf("left: %3g right: %3g centerX: %3g\n", rect.left(), rect.right(), rect.centerX());
+ }
#StdOut
-left: 20 right: 41 centerX: 30.5
-left: 20 right: 41 centerX: 30.5
-left: -20 right: -41 centerX: -30.5
+left: 20 right: 41 centerX: 30.5
+left: 20 right: 41 centerX: 30.5
+left: -20 right: -41 centerX: -30.5
left: -41 right: -20 centerX: -30.5
##
##
@@ -800,9 +800,9 @@ is sorted. Result may overflow to infinity if Rect is far from the origin.
#Return midpoint in y ##
#Example
- SkRect rect = { 2e+38, 2e+38, 3e+38, 3e+38 };
- SkDebugf("left: %g right: %g centerX: %g ", rect.left(), rect.right(), rect.centerX());
- SkDebugf("safe mid x: %g\n", rect.left() / 2 + rect.right() / 2);
+ SkRect rect = { 2e+38, 2e+38, 3e+38, 3e+38 };
+ SkDebugf("left: %g right: %g centerX: %g ", rect.left(), rect.right(), rect.centerX());
+ SkDebugf("safe mid x: %g\n", rect.left() / 2 + rect.right() / 2);
#StdOut
left: 2e+38 right: 3e+38 centerX: inf safe mid x: 2.5e+38
##
@@ -828,25 +828,25 @@ contain zeroes width different signs.
#Return true if members are equal ##
#Example
- auto debugster = [](const SkRect& test) -> void {
- SkRect negZero = {-0.0f, -0.0f, 2, 2};
- SkDebugf("{%g, %g, %g, %g} %c= {%g, %g, %g, %g} %s numerically equal\n",
- test.fLeft, test.fTop, test.fRight, test.fBottom,
- negZero.fLeft, negZero.fTop, negZero.fRight, negZero.fBottom,
- test == negZero ? '=' : '!',
- test.fLeft == negZero.fLeft && test.fTop == negZero.fTop &&
- test.fRight == negZero.fRight && test.fBottom == negZero.fBottom ?
- "and are" : "yet are not");
- };
- SkRect tests[] = {{0, 0, 2, 2}, {-0, -0, 2, 2}, {0.0f, 0.0f, 2, 2}};
- SkDebugf("tests are %s" "equal\n", tests[0] == tests[1] && tests[1] == tests[2] ? "" : "not ");
- for (auto rect : tests) {
- debugster(rect);
+ auto debugster = [](const SkRect& test) -> void {
+ SkRect negZero = {-0.0f, -0.0f, 2, 2};
+ SkDebugf("{%g, %g, %g, %g} %c= {%g, %g, %g, %g} %s numerically equal\n",
+ test.fLeft, test.fTop, test.fRight, test.fBottom,
+ negZero.fLeft, negZero.fTop, negZero.fRight, negZero.fBottom,
+ test == negZero ? '=' : '!',
+ test.fLeft == negZero.fLeft && test.fTop == negZero.fTop &&
+ test.fRight == negZero.fRight && test.fBottom == negZero.fBottom ?
+ "and are" : "yet are not");
+ };
+ SkRect tests[] = {{0, 0, 2, 2}, {-0, -0, 2, 2}, {0.0f, 0.0f, 2, 2}};
+ SkDebugf("tests are %s" "equal\n", tests[0] == tests[1] && tests[1] == tests[2] ? "" : "not ");
+ for (auto rect : tests) {
+ debugster(rect);
}
-#StdOut
-tests are equal
-{0, 0, 2, 2} == {-0, -0, 2, 2} and are numerically equal
-{0, 0, 2, 2} == {-0, -0, 2, 2} and are numerically equal
+#StdOut
+tests are equal
+{0, 0, 2, 2} == {-0, -0, 2, 2} and are numerically equal
+{0, 0, 2, 2} == {-0, -0, 2, 2} and are numerically equal
{0, 0, 2, 2} == {-0, -0, 2, 2} and are numerically equal
##
##
@@ -871,9 +871,9 @@ contain zeroes width different signs.
#Return true if members are not equal ##
#Example
- SkRect test = {0, 0, 2, SK_ScalarNaN};
- SkDebugf("test with NaN is %s" "equal to itself\n", test == test ? "" : "not ");
-#StdOut
+ SkRect test = {0, 0, 2, SK_ScalarNaN};
+ SkDebugf("test with NaN is %s" "equal to itself\n", test == test ? "" : "not ");
+#StdOut
test with NaN is not equal to itself
##
##
@@ -896,17 +896,17 @@ Consider adding param to control whether quad is CW or CCW.
#Param quad storage for corners of Rect ##
#Example
- SkRect rect = {1, 2, 3, 4};
- SkPoint corners[4];
- rect.toQuad(corners);
- SkDebugf("rect: {%g, %g, %g, %g}\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
- SkDebugf("corners:");
- for (auto corner : corners) {
- SkDebugf(" {%g, %g}", corner.fX, corner.fY);
- }
- SkDebugf("\n");
-#StdOut
-rect: {1, 2, 3, 4}
+ SkRect rect = {1, 2, 3, 4};
+ SkPoint corners[4];
+ rect.toQuad(corners);
+ SkDebugf("rect: {%g, %g, %g, %g}\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
+ SkDebugf("corners:");
+ for (auto corner : corners) {
+ SkDebugf(" {%g, %g}", corner.fX, corner.fY);
+ }
+ SkDebugf("\n");
+#StdOut
+rect: {1, 2, 3, 4}
corners: {1, 2} {3, 2} {3, 4} {1, 4}
##
##
@@ -926,16 +926,16 @@ or if top is equal to or greater than bottom. Setting all members to zero
is a convenience, but does not designate a special empty rectangle.
#Example
- SkRect rect = {3, 4, 1, 2};
- for (int i = 0; i < 2; ++i) {
- SkDebugf("rect: {%g, %g, %g, %g} is %s" "empty\n", rect.fLeft, rect.fTop,
- rect.fRight, rect.fBottom, rect.isEmpty() ? "" : "not ");
- rect.setEmpty();
- }
-#StdOut
-rect: {3, 4, 1, 2} is empty
-rect: {0, 0, 0, 0} is empty
-##
+ SkRect rect = {3, 4, 1, 2};
+ for (int i = 0; i < 2; ++i) {
+ SkDebugf("rect: {%g, %g, %g, %g} is %s" "empty\n", rect.fLeft, rect.fTop,
+ rect.fRight, rect.fBottom, rect.isEmpty() ? "" : "not ");
+ rect.setEmpty();
+ }
+#StdOut
+rect: {3, 4, 1, 2} is empty
+rect: {0, 0, 0, 0} is empty
+##
##
#SeeAlso MakeEmpty SkIRect::setEmpty
@@ -952,15 +952,15 @@ Very large values in src may lose precision.
#Param src integer Rect ##
#Example
- SkIRect i_rect = {3, 4, 1, 2};
- SkDebugf("i_rect: {%d, %d, %d, %d}\n", i_rect.fLeft, i_rect.fTop, i_rect.fRight, i_rect.fBottom);
- SkRect f_rect;
- f_rect.set(i_rect);
- SkDebugf("f_rect: {%g, %g, %g, %g}\n", f_rect.fLeft, f_rect.fTop, f_rect.fRight, f_rect.fBottom);
-#StdOut
-i_rect: {3, 4, 1, 2}
-f_rect: {3, 4, 1, 2}
-##
+ SkIRect i_rect = {3, 4, 1, 2};
+ SkDebugf("i_rect: {%d, %d, %d, %d}\n", i_rect.fLeft, i_rect.fTop, i_rect.fRight, i_rect.fBottom);
+ SkRect f_rect;
+ f_rect.set(i_rect);
+ SkDebugf("f_rect: {%g, %g, %g, %g}\n", f_rect.fLeft, f_rect.fTop, f_rect.fRight, f_rect.fBottom);
+#StdOut
+i_rect: {3, 4, 1, 2}
+f_rect: {3, 4, 1, 2}
+##
##
#SeeAlso setLTRB SkIntToScalar
@@ -981,15 +981,15 @@ top and bottom are not sorted; top is not necessarily less than bottom.
#Param bottom stored in fBottom ##
#Example
- 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);
-#StdOut
-rect1: {3, 4, 1, 2}
-rect2: {3, 4, 1, 2}
-##
+ 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);
+#StdOut
+rect1: {3, 4, 1, 2}
+rect2: {3, 4, 1, 2}
+##
##
#SeeAlso setLTRB setXYWH SkIRect::set
@@ -1010,15 +1010,15 @@ top and bottom are not sorted; top is not necessarily less than bottom.
#Param bottom stored in fBottom ##
#Example
- SkRect rect1 = {3, 4, 1, 2};
- SkDebugf("rect1: {%g, %g, %g, %g}\n", rect1.fLeft, rect1.fTop, rect1.fRight, rect1.fBottom);
- SkRect rect2;
- rect2.setLTRB(3, 4, 1, 2);
- SkDebugf("rect2: {%g, %g, %g, %g}\n", rect2.fLeft, rect2.fTop, rect2.fRight, rect2.fBottom);
-#StdOut
-rect1: {3, 4, 1, 2}
-rect2: {3, 4, 1, 2}
-##
+ SkRect rect1 = {3, 4, 1, 2};
+ SkDebugf("rect1: {%g, %g, %g, %g}\n", rect1.fLeft, rect1.fTop, rect1.fRight, rect1.fBottom);
+ SkRect rect2;
+ rect2.setLTRB(3, 4, 1, 2);
+ SkDebugf("rect2: {%g, %g, %g, %g}\n", rect2.fLeft, rect2.fTop, rect2.fRight, rect2.fBottom);
+#StdOut
+rect1: {3, 4, 1, 2}
+rect2: {3, 4, 1, 2}
+##
##
#SeeAlso set setXYWH SkIRect::set
@@ -1040,15 +1040,15 @@ top and bottom are not sorted; top is not necessarily less than bottom.
#Param bottom promoted to SkScalar and stored in fBottom ##
#Example
- 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);
-#StdOut
-rect1: {3, 4, 1, 2}
-rect2: {3, 4, 1, 2}
-##
+ 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);
+#StdOut
+rect1: {3, 4, 1, 2}
+rect2: {3, 4, 1, 2}
+##
##
#SeeAlso set setLTRB SkIRect::set SkIntToScalar
@@ -1067,15 +1067,15 @@ integer to SkScalar, large values may lose precision.
#Param height promoted to SkScalar and stored in fBottom ##
#Example
- 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);
+ 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);
-#StdOut
-rect1: {0, 0, 1, 2}
-rect2: {0, 0, 1, 2}
-##
+#StdOut
+rect1: {0, 0, 1, 2}
+rect2: {0, 0, 1, 2}
+##
##
#SeeAlso MakeWH MakeXYWH iset() SkIRect:MakeWH
@@ -1096,25 +1096,25 @@ fTop is less than or equal to fBottom.
#Param count entries in array ##
#Example
- 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);
- }
-#StdOut
- count: 0 rect: 0, 0, 0, 0
-added: 3, 4 count: 1 rect: 3, 4, 3, 4
-added: 1, 2 count: 2 rect: 1, 2, 3, 4
-added: 5, 6 count: 3 rect: 1, 2, 5, 6
-added: nan, 8 count: 4 rect: 0, 0, 0, 0
-##
+ 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);
+ }
+#StdOut
+ count: 0 rect: 0, 0, 0, 0
+added: 3, 4 count: 1 rect: 3, 4, 3, 4
+added: 1, 2 count: 2 rect: 1, 2, 3, 4
+added: 5, 6 count: 3 rect: 1, 2, 5, 6
+added: nan, 8 count: 4 rect: 0, 0, 0, 0
+##
##
#SeeAlso setBounds setBoundsCheck SkPath::addPoly
@@ -1135,25 +1135,25 @@ fTop is less than or equal to fBottom.
#Param count entries in array ##
#Example
- 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.setBounds(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);
- }
-#StdOut
- count: 0 rect: 0, 0, 0, 0
-added: 3, 4 count: 1 rect: 3, 4, 3, 4
-added: 1, 2 count: 2 rect: 1, 2, 3, 4
-added: 5, 6 count: 3 rect: 1, 2, 5, 6
-added: nan, 8 count: 4 rect: 0, 0, 0, 0
-##
+ 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.setBounds(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);
+ }
+#StdOut
+ count: 0 rect: 0, 0, 0, 0
+added: 3, 4 count: 1 rect: 3, 4, 3, 4
+added: 1, 2 count: 2 rect: 1, 2, 3, 4
+added: 5, 6 count: 3 rect: 1, 2, 5, 6
+added: nan, 8 count: 4 rect: 0, 0, 0, 0
+##
##
#SeeAlso set setBoundsCheck SkPath::addPoly
@@ -1177,25 +1177,25 @@ fTop is less than or equal to fBottom.
#Return true if all Point values are finite ##
#Example
- SkPoint points[] = {{3, 4}, {1, 2}, {5, 6}, {SK_ScalarNaN, 8}};
- for (int count = 0; count <= (int) SK_ARRAY_COUNT(points); ++count) {
- SkRect rect;
- bool success = rect.setBoundsCheck(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 success: %s\n", count,
- rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, success ? "true" : "false");
- }
-#StdOut
- count: 0 rect: 0, 0, 0, 0 success: true
-added: 3, 4 count: 1 rect: 3, 4, 3, 4 success: true
-added: 1, 2 count: 2 rect: 1, 2, 3, 4 success: true
-added: 5, 6 count: 3 rect: 1, 2, 5, 6 success: true
-added: nan, 8 count: 4 rect: 0, 0, 0, 0 success: false
-##
+ SkPoint points[] = {{3, 4}, {1, 2}, {5, 6}, {SK_ScalarNaN, 8}};
+ for (int count = 0; count <= (int) SK_ARRAY_COUNT(points); ++count) {
+ SkRect rect;
+ bool success = rect.setBoundsCheck(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 success: %s\n", count,
+ rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, success ? "true" : "false");
+ }
+#StdOut
+ count: 0 rect: 0, 0, 0, 0 success: true
+added: 3, 4 count: 1 rect: 3, 4, 3, 4 success: true
+added: 1, 2 count: 2 rect: 1, 2, 3, 4 success: true
+added: 5, 6 count: 3 rect: 1, 2, 5, 6 success: true
+added: nan, 8 count: 4 rect: 0, 0, 0, 0 success: false
+##
##
#SeeAlso set setBounds SkPath::addPoly
@@ -1216,13 +1216,13 @@ sorted and may be empty. Does not check to see if values are finite.
#Description
p0 and p1 may be swapped and have the same effect unless one contains NaN.
##
- SkPoint point1 = {SK_ScalarNaN, 8};
- SkPoint point2 = {3, 4};
- SkRect rect;
- rect.set(point1, point2);
- SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
- rect.set(point2, point1);
- SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
+ SkPoint point1 = {SK_ScalarNaN, 8};
+ SkPoint point2 = {3, 4};
+ SkRect rect;
+ rect.set(point1, point2);
+ SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
+ rect.set(point2, point1);
+ SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
##
#SeeAlso setBounds setBoundsCheck
@@ -1246,15 +1246,15 @@ width or height may be negative.
#Param height added to y and stored in fBottom ##
#Example
- SkRect rect;
- rect.setXYWH(5, 35, -15, 25);
- SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
- rect.bottom(), rect.isEmpty() ? "true" : "false");
- rect.sort();
- SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
- rect.bottom(), rect.isEmpty() ? "true" : "false");
+ SkRect rect;
+ rect.setXYWH(5, 35, -15, 25);
+ SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
+ rect.bottom(), rect.isEmpty() ? "true" : "false");
+ rect.sort();
+ SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
+ rect.bottom(), rect.isEmpty() ? "true" : "false");
#StdOut
-rect: 5, 35, -10, 60 isEmpty: true
+rect: 5, 35, -10, 60 isEmpty: true
rect: -10, 35, 5, 60 isEmpty: false
##
##
@@ -1274,15 +1274,15 @@ width or height may be negative.
#Param height stored in fBottom ##
#Example
- SkRect rect;
- rect.setWH(-15, 25);
- SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
- rect.bottom(), rect.isEmpty() ? "true" : "false");
- rect.sort();
- SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
- rect.bottom(), rect.isEmpty() ? "true" : "false");
+ SkRect rect;
+ rect.setWH(-15, 25);
+ SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
+ rect.bottom(), rect.isEmpty() ? "true" : "false");
+ rect.sort();
+ SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
+ rect.bottom(), rect.isEmpty() ? "true" : "false");
#StdOut
-rect: 0, 0, -15, 25 isEmpty: true
+rect: 0, 0, -15, 25 isEmpty: true
rect: -15, 0, 0, 25 isEmpty: false
##
##
@@ -1299,24 +1299,24 @@ Sets rectangle left and top to most negative finite value, and sets
right and bottom to most positive finite value.
#Example
- SkRect rect;
- rect.setLargest();
- SkDebugf("MakeLargest isLargest: %s\n", rect.isLargest() ? "true" : "false");
- SkDebugf("MakeLargest isFinite: %s\n", rect.isFinite() ? "true" : "false");
- rect.outset(1e31, 1e31);
- SkDebugf("outset a little isLargest: %s\n", rect.isLargest() ? "true" : "false");
- SkDebugf("outset a little isFinite: %s\n", rect.isFinite() ? "true" : "false");
- rect.outset(1e32, 1e32);
- SkDebugf("outset a little more isLargest: %s\n", rect.isLargest() ? "true" : "false");
- SkDebugf("outset a little more isFinite: %s\n", rect.isFinite() ? "true" : "false");
-#StdOut
-MakeLargest isLargest: true
-MakeLargest isFinite: true
-outset a little isLargest: true
-outset a little isFinite: true
-outset a little more isLargest: false
-outset a little more isFinite: false
-##
+ SkRect rect;
+ rect.setLargest();
+ SkDebugf("MakeLargest isLargest: %s\n", rect.isLargest() ? "true" : "false");
+ SkDebugf("MakeLargest isFinite: %s\n", rect.isFinite() ? "true" : "false");
+ rect.outset(1e31, 1e31);
+ SkDebugf("outset a little isLargest: %s\n", rect.isLargest() ? "true" : "false");
+ SkDebugf("outset a little isFinite: %s\n", rect.isFinite() ? "true" : "false");
+ rect.outset(1e32, 1e32);
+ SkDebugf("outset a little more isLargest: %s\n", rect.isLargest() ? "true" : "false");
+ SkDebugf("outset a little more isFinite: %s\n", rect.isFinite() ? "true" : "false");
+#StdOut
+MakeLargest isLargest: true
+MakeLargest isFinite: true
+outset a little isLargest: true
+outset a little isFinite: true
+outset a little more isLargest: false
+outset a little more isFinite: false
+##
##
#SeeAlso MakeLargest isLargest setLargestInverted SK_ScalarMin SK_ScalarMax
@@ -1333,20 +1333,20 @@ right and bottom to most negative finite value.
Use to initial Rect before one or more calls to growToInclude.
#Example
- auto debugster = [](const char* prefix, const SkRect& rect) -> void {
- SkDebugf("%s ", prefix);
- SkDebugf("rect: %g, %g, %g, %g ", rect.left(), rect.top(), rect.right(), rect.bottom());
- SkDebugf("isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
- };
- SkRect ptBounds;
- ptBounds.setLargestInverted();
- debugster("original", ptBounds);
- ptBounds.growToInclude( { 42, 24 } );
+ auto debugster = [](const char* prefix, const SkRect& rect) -> void {
+ SkDebugf("%s ", prefix);
+ SkDebugf("rect: %g, %g, %g, %g ", rect.left(), rect.top(), rect.right(), rect.bottom());
+ SkDebugf("isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
+ };
+ SkRect ptBounds;
+ ptBounds.setLargestInverted();
+ debugster("original", ptBounds);
+ ptBounds.growToInclude( { 42, 24 } );
debugster("grown", ptBounds);
-#StdOut
-original rect: 3.40282e+38, 3.40282e+38, -3.40282e+38, -3.40282e+38 isEmpty: true
-grown rect: 42, 24, 42, 24 isEmpty: true
-##
+#StdOut
+original rect: 3.40282e+38, 3.40282e+38, -3.40282e+38, -3.40282e+38 isEmpty: true
+grown rect: 42, 24, 42, 24 isEmpty: true
+##
##
#SeeAlso growToInclude setEmpty setLargest
@@ -1370,16 +1370,16 @@ If dy is positive, Rect returned is moved downward.
#Return Rect offset in x or y, with original width and height ##
#Example
- SkRect rect = { 10, 50, 20, 60 };
- SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
- rect.bottom(), rect.isEmpty() ? "true" : "false");
- rect = rect.makeOffset(15, 32);
- SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
- rect.bottom(), rect.isEmpty() ? "true" : "false");
-#StdOut
-rect: 10, 50, 20, 60 isEmpty: false
-rect: 25, 82, 35, 92 isEmpty: false
-##
+ SkRect rect = { 10, 50, 20, 60 };
+ SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
+ rect.bottom(), rect.isEmpty() ? "true" : "false");
+ rect = rect.makeOffset(15, 32);
+ SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
+ rect.bottom(), rect.isEmpty() ? "true" : "false");
+#StdOut
+rect: 10, 50, 20, 60 isEmpty: false
+rect: 25, 82, 35, 92 isEmpty: false
+##
##
#SeeAlso offset() makeInset makeOutset SkIRect::makeOffset
@@ -1403,16 +1403,16 @@ If dy is positive, Rect returned is shorter.
#Return Rect inset symmetrically left and right, top and bottom ##
#Example
- SkRect rect = { 10, 50, 20, 60 };
- SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
- rect.bottom(), rect.isEmpty() ? "true" : "false");
- rect = rect.makeInset(15, 32);
- SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
- rect.bottom(), rect.isEmpty() ? "true" : "false");
-#StdOut
-rect: 10, 50, 20, 60 isEmpty: false
-rect: 25, 82, 5, 28 isEmpty: true
-##
+ SkRect rect = { 10, 50, 20, 60 };
+ SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
+ rect.bottom(), rect.isEmpty() ? "true" : "false");
+ rect = rect.makeInset(15, 32);
+ SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
+ rect.bottom(), rect.isEmpty() ? "true" : "false");
+#StdOut
+rect: 10, 50, 20, 60 isEmpty: false
+rect: 25, 82, 5, 28 isEmpty: true
+##
##
#SeeAlso inset() makeOffset makeOutset SkIRect::makeInset
@@ -1436,16 +1436,16 @@ If dy is positive, Rect returned is taller.
#Return Rect outset symmetrically left and right, top and bottom ##
#Example
- SkRect rect = { 10, 50, 20, 60 };
- SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
- rect.bottom(), rect.isEmpty() ? "true" : "false");
- rect = rect.makeOutset(15, 32);
- SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
- rect.bottom(), rect.isEmpty() ? "true" : "false");
-#StdOut
-rect: 10, 50, 20, 60 isEmpty: false
-rect: -5, 18, 35, 92 isEmpty: false
-##
+ SkRect rect = { 10, 50, 20, 60 };
+ SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
+ rect.bottom(), rect.isEmpty() ? "true" : "false");
+ rect = rect.makeOutset(15, 32);
+ SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
+ rect.bottom(), rect.isEmpty() ? "true" : "false");
+#StdOut
+rect: 10, 50, 20, 60 isEmpty: false
+rect: -5, 18, 35, 92 isEmpty: false
+##
##
#SeeAlso outset() makeOffset makeInset SkIRect::makeOutset
@@ -1467,12 +1467,12 @@ If dy is positive, moves Rect downward.
#Param dy offset added to fTop and fBottom ##
#Example
- SkRect rect = { 10, 14, 50, 73 };
- rect.offset(5, 13);
- SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
-#StdOut
-rect: 15, 27, 55, 86
-##
+ SkRect rect = { 10, 14, 50, 73 };
+ rect.offset(5, 13);
+ SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
+#StdOut
+rect: 15, 27, 55, 86
+##
##
#SeeAlso offsetTo makeOffset SkIRect::offset
@@ -1494,12 +1494,12 @@ If delta.fY is positive, moves Rect downward.
#Param delta added to Rect ##
#Example
- SkRect rect = { 10, 14, 50, 73 };
- rect.offset({5, 13});
- SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
-#StdOut
-rect: 15, 27, 55, 86
-##
+ SkRect rect = { 10, 14, 50, 73 };
+ rect.offset({5, 13});
+ SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
+#StdOut
+rect: 15, 27, 55, 86
+##
##
#SeeAlso offsetTo makeOffset SkIRect::offset
@@ -1517,12 +1517,12 @@ are unchanged.
#Param newY stored in fTop, preserving height() ##
#Example
- SkRect rect = { 10, 14, 50, 73 };
- rect.offsetTo(15, 27);
- SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
-#StdOut
-rect: 15, 27, 55, 86
-##
+ SkRect rect = { 10, 14, 50, 73 };
+ rect.offsetTo(15, 27);
+ SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
+#StdOut
+rect: 15, 27, 55, 86
+##
##
#SeeAlso offset makeOffset setXYWH SkIRect::offsetTo
@@ -1544,12 +1544,12 @@ If dy is negative, makes Rect taller.
#Param dy added to fTop and subtracted from fBottom ##
#Example
- SkRect rect = { 10, 14, 50, 73 };
- rect.inset(5, 13);
- SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
-#StdOut
-rect: 15, 27, 45, 60
-##
+ SkRect rect = { 10, 14, 50, 73 };
+ rect.inset(5, 13);
+ SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
+#StdOut
+rect: 15, 27, 45, 60
+##
##
#SeeAlso outset makeInset SkIRect::inset
@@ -1571,12 +1571,12 @@ If dy is negative, makes Rect shorter.
#Param dy subtracted to fTop and added from fBottom ##
#Example
- SkRect rect = { 10, 14, 50, 73 };
- rect.outset(5, 13);
- SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
-#StdOut
-rect: 5, 1, 55, 86
-##
+ SkRect rect = { 10, 14, 50, 73 };
+ rect.outset(5, 13);
+ SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
+#StdOut
+rect: 5, 1, 55, 86
+##
##
#SeeAlso inset makeOutset SkIRect::outset
@@ -1587,11 +1587,14 @@ rect: 5, 1, 55, 86
Rects intersect when they enclose a common area. To intersect, each of the pair
must describe area; fLeft is less than fRight, and fTop is less than fBottom;
-empty() returns false. The intersection of Rect a and Rect b can be described by:
+empty() returns false. The intersection of Rect pair can be described by:
+
#Formula
(max(a.fLeft, b.fLeft), max(a.fTop, b.fTop),
min(a.fRight, b.fRight), min(a.fBottom, b.fBottom))
##
+.
+
The intersection is only meaningful if the resulting Rect is not empty and
describes an area: fLeft is less than fRight, and fTop is less than fBottom.
@@ -1614,10 +1617,10 @@ Two SkDebugf calls are required. If the calls are combined, their arguments
may not be evaluated in left to right order: the printed intersection may
be before or after the call to intersect.
##
- SkRect leftRect = { 10, 40, 50, 80 };
- SkRect rightRect = { 30, 60, 70, 90 };
- SkDebugf("%s intersection: ", leftRect.intersect(rightRect) ? "" : "no ");
- SkDebugf("%g, %g, %g, %g\n", leftRect.left(), leftRect.top(),
+ SkRect leftRect = { 10, 40, 50, 80 };
+ SkRect rightRect = { 30, 60, 70, 90 };
+ SkDebugf("%s intersection: ", leftRect.intersect(rightRect) ? "" : "no ");
+ SkDebugf("%g, %g, %g, %g\n", leftRect.left(), leftRect.top(),
leftRect.right(), leftRect.bottom());
#StdOut
intersection: 30, 60, 50, 80
@@ -1653,9 +1656,9 @@ Two SkDebugf calls are required. If the calls are combined, their arguments
may not be evaluated in left to right order: the printed intersection may
be before or after the call to intersect.
##
- SkRect leftRect = { 10, 40, 50, 80 };
- SkDebugf("%s intersection: ", leftRect.intersect(30, 60, 70, 90) ? "" : "no ");
- SkDebugf("%g, %g, %g, %g\n", leftRect.left(), leftRect.top(),
+ SkRect leftRect = { 10, 40, 50, 80 };
+ SkDebugf("%s intersection: ", leftRect.intersect(30, 60, 70, 90) ? "" : "no ");
+ SkDebugf("%g, %g, %g, %g\n", leftRect.left(), leftRect.top(),
leftRect.right(), leftRect.bottom());
#StdOut
intersection: 30, 60, 50, 80
@@ -1681,10 +1684,10 @@ Returns false if either a or b is empty, leaving Rect unchanged.
#Return true if a and b have area in common ##
#Example
- SkRect result;
- bool intersected = result.intersect({ 10, 40, 50, 80 }, { 30, 60, 70, 90 });
- SkDebugf("%s intersection: %g, %g, %g, %g\n", intersected ? "" : "no ",
- result.left(), result.top(), result.right(), result.bottom());
+ SkRect result;
+ bool intersected = result.intersect({ 10, 40, 50, 80 }, { 30, 60, 70, 90 });
+ SkDebugf("%s intersection: %g, %g, %g, %g\n", intersected ? "" : "no ",
+ result.left(), result.top(), result.right(), result.bottom());
#StdOut
intersection: 30, 60, 50, 80
##
@@ -1712,8 +1715,8 @@ Returns false if either construction or Rect is empty, or do not intersect.
#Return true if construction and Rect have area in common ##
#Example
- SkRect rect = { 10, 40, 50, 80 };
- SkDebugf("%s intersection", rect.intersects(30, 60, 70, 90) ? "" : "no ");
+ SkRect rect = { 10, 40, 50, 80 };
+ SkDebugf("%s intersection", rect.intersects(30, 60, 70, 90) ? "" : "no ");
#StdOut
intersection
##
@@ -1735,8 +1738,8 @@ Returns false if either r or Rect is empty, or do not intersect.
#Return true if r and Rect have area in common ##
#Example
- SkRect rect = { 10, 40, 50, 80 };
- SkDebugf("%s intersection", rect.intersects({30, 60, 70, 90}) ? "" : "no ");
+ SkRect rect = { 10, 40, 50, 80 };
+ SkDebugf("%s intersection", rect.intersects({30, 60, 70, 90}) ? "" : "no ");
#StdOut
intersection
##
@@ -1759,7 +1762,7 @@ Returns false if either a or b is empty, or do not intersect.
#Return true if a and b have area in common ##
#Example
- SkDebugf("%s intersection", SkRect::Intersects({10, 40, 50, 80}, {30, 60, 70, 90}) ? "" : "no ");
+ SkDebugf("%s intersection", SkRect::Intersects({10, 40, 50, 80}, {30, 60, 70, 90}) ? "" : "no ");
#StdOut
intersection
##
@@ -1790,9 +1793,9 @@ Rect to construction.
#Param bottom y maximum of constructed Rect ##
#Example
- SkRect rect = { 10, 20, 15, 25};
- rect.join(50, 60, 55, 65);
- SkDebugf("join: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
+ SkRect rect = { 10, 20, 15, 25};
+ rect.join(50, 60, 55, 65);
+ SkDebugf("join: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
#StdOut
join: 10, 20, 55, 65
##
@@ -1814,9 +1817,9 @@ Rect to r.
#Param r expansion Rect ##
#Example
- SkRect rect = { 10, 20, 15, 25};
- rect.join({50, 60, 55, 65});
- SkDebugf("join: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
+ SkRect rect = { 10, 20, 15, 25};
+ rect.join({50, 60, 55, 65});
+ SkDebugf("join: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
#StdOut
join: 10, 20, 55, 65
##
@@ -1843,15 +1846,15 @@ May produce incorrect results if r is empty.
#Description
Since Rect is not sorted, first result is copy of toJoin.
##
- SkRect rect = { 10, 100, 15, 0};
- SkRect sorted = rect.makeSorted();
- SkRect toJoin = { 50, 60, 55, 65 };
- rect.joinNonEmptyArg(toJoin);
- SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
- sorted.joinNonEmptyArg(toJoin);
+ SkRect rect = { 10, 100, 15, 0};
+ SkRect sorted = rect.makeSorted();
+ SkRect toJoin = { 50, 60, 55, 65 };
+ rect.joinNonEmptyArg(toJoin);
+ SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
+ sorted.joinNonEmptyArg(toJoin);
SkDebugf("sorted: %g, %g, %g, %g\n", sorted.fLeft, sorted.fTop, sorted.fRight, sorted.fBottom);
#StdOut
-rect: 50, 60, 55, 65
+rect: 50, 60, 55, 65
sorted: 10, 0, 55, 100
##
##
@@ -1874,15 +1877,15 @@ May produce incorrect results if Rect or r is empty.
#Description
Since Rect is not sorted, first result is not useful.
##
- SkRect rect = { 10, 100, 15, 0};
- SkRect sorted = rect.makeSorted();
- SkRect toJoin = { 50, 60, 55, 65 };
- rect.joinPossiblyEmptyRect(toJoin);
- SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
- sorted.joinPossiblyEmptyRect(toJoin);
- SkDebugf("sorted: %g, %g, %g, %g\n", sorted.fLeft, sorted.fTop, sorted.fRight, sorted.fBottom);
+ SkRect rect = { 10, 100, 15, 0};
+ SkRect sorted = rect.makeSorted();
+ SkRect toJoin = { 50, 60, 55, 65 };
+ rect.joinPossiblyEmptyRect(toJoin);
+ SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
+ sorted.joinPossiblyEmptyRect(toJoin);
+ SkDebugf("sorted: %g, %g, %g, %g\n", sorted.fLeft, sorted.fTop, sorted.fRight, sorted.fBottom);
#StdOut
-rect: 10, 60, 55, 65
+rect: 10, 60, 55, 65
sorted: 10, 0, 55, 100
##
##
@@ -1896,6 +1899,7 @@ sorted: 10, 0, 55, 100
#Method void growToInclude(SkPoint pt)
Grows Rect to include (pt.fX, pt.fY), modifying it so that:
+
#Formula
fLeft <= pt.fX <= fRight && fTop <= pt.fY <= fBottom
##
@@ -1907,11 +1911,11 @@ Points after one or more calls. In this case, Rect is empty after first call.
#Param pt Point to include ##
#Example
- SkRect rect;
- rect.setLargestInverted();
- rect.growToInclude( { 42, 24 } );
- SkDebugf("rect: %g, %g, %g, %g ", rect.left(), rect.top(), rect.right(), rect.bottom());
- SkDebugf("isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
+ SkRect rect;
+ rect.setLargestInverted();
+ rect.growToInclude( { 42, 24 } );
+ SkDebugf("rect: %g, %g, %g, %g ", rect.left(), rect.top(), rect.right(), rect.bottom());
+ SkDebugf("isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
#StdOut
rect: 42, 24, 42, 24 isEmpty: true
##
@@ -1939,11 +1943,11 @@ Points after one or more calls. In this case, Rect is empty after first call.
#Param count number of points in array ##
#Example
- SkPoint pts[] = { { 30, 50 }, { 40, 50 }, { 30, 60 } };
- SkRect rect = { pts[0].fX, pts[0].fY, pts[0].fX, pts[0].fY };
- rect.growToInclude( pts[1] );
- rect.growToInclude( pts[2] );
- SkDebugf("rect: %g, %g, %g, %g ", rect.left(), rect.top(), rect.right(), rect.bottom());
+ SkPoint pts[] = { { 30, 50 }, { 40, 50 }, { 30, 60 } };
+ SkRect rect = { pts[0].fX, pts[0].fY, pts[0].fX, pts[0].fY };
+ rect.growToInclude( pts[1] );
+ rect.growToInclude( pts[2] );
+ SkDebugf("rect: %g, %g, %g, %g ", rect.left(), rect.top(), rect.right(), rect.bottom());
#StdOut
rect: 30, 50, 40, 60
##
@@ -1962,8 +1966,10 @@ it so that:
#Formula
fLeft <= pt.fX <= fRight && fTop <= pt.fY <= fBottom
##
-. Point may be followed with other data in each array element. stride is number
- of bytes in element; the interval to skip to advance from one Point to
+.
+
+Point may be followed with other data in each array element. stride is number
+of bytes in element; the interval to skip to advance from one Point to
the next.
If Rect is initialized with setLargestInverted, then Rect will contain bounds of
@@ -1975,11 +1981,11 @@ Points after one or more calls. In this case, Rect is empty after first call.
#Bug 7142 ##
#Example
- SkPoint3 pts[] = { { 30, 50, -1 }, { 40, 50, -1 }, { 30, 60, -1 } };
- SkRect rect;
- rect.setLargestInverted();
- rect.growToInclude((SkPoint* ) &pts[0].fX, sizeof(SkPoint3), SK_ARRAY_COUNT(pts));
- SkDebugf("rect: %g, %g, %g, %g ", rect.left(), rect.top(), rect.right(), rect.bottom());
+ SkPoint3 pts[] = { { 30, 50, -1 }, { 40, 50, -1 }, { 30, 60, -1 } };
+ SkRect rect;
+ rect.setLargestInverted();
+ rect.growToInclude((SkPoint* ) &pts[0].fX, sizeof(SkPoint3), SK_ARRAY_COUNT(pts));
+ SkDebugf("rect: %g, %g, %g, %g ", rect.left(), rect.top(), rect.right(), rect.bottom());
#StdOut
#Volatile
rect: 30, 50, 40, 60
@@ -2004,19 +2010,19 @@ Rect contains r when Rect area completely includes r area.
#Return true if all sides of Rect are outside r ##
#Example
- SkRect rect = { 30, 50, 40, 60 };
- SkRect tests[] = { { 30, 50, 31, 51}, { 39, 49, 40, 50}, { 29, 59, 30, 60} };
- for (auto contained : tests) {
- SkDebugf("rect: (%g, %g, %g, %g) %s (%g, %g, %g, %g)\n",
- rect.left(), rect.top(), rect.right(), rect.bottom(),
- rect.contains(contained) ? "contains" : "does not contain",
- contained.left(), contained.top(), contained.right(), contained.bottom());
- }
-#StdOut
-rect: (30, 50, 40, 60) contains (30, 50, 31, 51)
-rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50)
-rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60)
-##
+ SkRect rect = { 30, 50, 40, 60 };
+ SkRect tests[] = { { 30, 50, 31, 51}, { 39, 49, 40, 50}, { 29, 59, 30, 60} };
+ for (auto contained : tests) {
+ SkDebugf("rect: (%g, %g, %g, %g) %s (%g, %g, %g, %g)\n",
+ rect.left(), rect.top(), rect.right(), rect.bottom(),
+ rect.contains(contained) ? "contains" : "does not contain",
+ contained.left(), contained.top(), contained.right(), contained.bottom());
+ }
+#StdOut
+rect: (30, 50, 40, 60) contains (30, 50, 31, 51)
+rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50)
+rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60)
+##
##
#SeeAlso SkIRect::contains
@@ -2037,19 +2043,19 @@ Rect contains r when Rect area completely includes r area.
#Return true if all sides of Rect are outside r ##
#Example
- SkRect rect = { 30, 50, 40, 60 };
- SkIRect tests[] = { { 30, 50, 31, 51}, { 39, 49, 40, 50}, { 29, 59, 30, 60} };
- for (auto contained : tests) {
- SkDebugf("rect: (%g, %g, %g, %g) %s (%d, %d, %d, %d)\n",
- rect.left(), rect.top(), rect.right(), rect.bottom(),
- rect.contains(contained) ? "contains" : "does not contain",
- contained.left(), contained.top(), contained.right(), contained.bottom());
- }
-#StdOut
-rect: (30, 50, 40, 60) contains (30, 50, 31, 51)
-rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50)
-rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60)
-##
+ SkRect rect = { 30, 50, 40, 60 };
+ SkIRect tests[] = { { 30, 50, 31, 51}, { 39, 49, 40, 50}, { 29, 59, 30, 60} };
+ for (auto contained : tests) {
+ SkDebugf("rect: (%g, %g, %g, %g) %s (%d, %d, %d, %d)\n",
+ rect.left(), rect.top(), rect.right(), rect.bottom(),
+ rect.contains(contained) ? "contains" : "does not contain",
+ contained.left(), contained.top(), contained.right(), contained.bottom());
+ }
+#StdOut
+rect: (30, 50, 40, 60) contains (30, 50, 31, 51)
+rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50)
+rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60)
+##
##
#SeeAlso SkIRect::contains
@@ -2073,10 +2079,10 @@ members, using
#Param dst storage for IRect ##
#Example
- SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f };
- SkIRect round;
- rect.round(&round);
- SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom);
+ SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f };
+ SkIRect round;
+ rect.round(&round);
+ SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom);
#StdOut
round: 31, 51, 41, 61
##
@@ -2101,10 +2107,10 @@ rounding up fRight and FBottom, using
#Param dst storage for IRect ##
#Example
- SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f };
- SkIRect round;
- rect.roundOut(&round);
- SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom);
+ SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f };
+ SkIRect round;
+ rect.roundOut(&round);
+ SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom);
#StdOut
round: 30, 50, 41, 61
##
@@ -2129,10 +2135,10 @@ rounding up fRight and FBottom, using
#Param dst storage for Rect ##
#Example
- SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f };
- SkRect round;
- rect.roundOut(&round);
- SkDebugf("round: %g, %g, %g, %g\n", round.fLeft, round.fTop, round.fRight, round.fBottom);
+ SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f };
+ SkRect round;
+ rect.roundOut(&round);
+ SkDebugf("round: %g, %g, %g, %g\n", round.fLeft, round.fTop, round.fRight, round.fBottom);
#StdOut
round: 30, 50, 41, 61
##
@@ -2148,6 +2154,7 @@ round: 30, 50, 41, 61
Sets Rect by rounding up fLeft and fTop; and
discarding the fractional portion of fRight and FBottom, using
+
#Formula
(SkScalarCeilToInt(fLeft), SkScalarCeilToInt(fTop),
SkScalarFloorToInt(fRight), SkScalarFloorToInt(fBottom))
@@ -2157,12 +2164,12 @@ discarding the fractional portion of fRight and FBottom, using
#Param dst storage for IRect ##
#Example
- SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f };
- SkIRect round;
- rect.roundIn(&round);
- SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom);
+ SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f };
+ SkIRect round;
+ rect.roundIn(&round);
+ SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom);
#StdOut
-round: 31, 51, 40, 60
+round: 31, 51, 40, 60
##
##
@@ -2185,11 +2192,11 @@ members, using
#Return rounded IRect ##
#Example
- SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f };
- SkIRect round = rect.round();
- SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom);
+ SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f };
+ SkIRect round = rect.round();
+ SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom);
#StdOut
-round: 31, 51, 41, 61
+round: 31, 51, 41, 61
##
##
@@ -2212,11 +2219,11 @@ rounding up fRight and FBottom, using
#Return rounded IRect ##
#Example
- SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f };
- SkIRect round = rect.roundOut();
- SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom);
+ SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f };
+ SkIRect round = rect.roundOut();
+ SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom);
#StdOut
-round: 30, 50, 41, 61
+round: 30, 50, 41, 61
##
##
@@ -2235,12 +2242,12 @@ fTop and fBottom if fTop is greater than fBottom. Result may be empty;
and width() and height() will be zero or positive.
#Example
- SkRect rect = { 30.5f, 50.5f, 20.5f, 10.5f };
- SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
- rect.sort();
- SkDebugf("sorted: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
+ SkRect rect = { 30.5f, 50.5f, 20.5f, 10.5f };
+ SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
+ rect.sort();
+ SkDebugf("sorted: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
#StdOut
-rect: 30.5, 50.5, 20.5, 10.5
+rect: 30.5, 50.5, 20.5, 10.5
sorted: 20.5, 10.5, 30.5, 50.5
##
##
@@ -2260,12 +2267,12 @@ and width() and height() will be zero or positive.
#Return sorted Rect ##
#Example
- SkRect rect = { 30.5f, 50.5f, 20.5f, 10.5f };
- SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
- SkRect sort = rect.makeSorted();
- SkDebugf("sorted: %g, %g, %g, %g\n", sort.fLeft, sort.fTop, sort.fRight, sort.fBottom);
+ SkRect rect = { 30.5f, 50.5f, 20.5f, 10.5f };
+ SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
+ SkRect sort = rect.makeSorted();
+ SkDebugf("sorted: %g, %g, %g, %g\n", sort.fLeft, sort.fTop, sort.fRight, sort.fBottom);
#StdOut
-rect: 30.5, 50.5, 20.5, 10.5
+rect: 30.5, 50.5, 20.5, 10.5
sorted: 20.5, 10.5, 30.5, 50.5
##
##
@@ -2284,11 +2291,11 @@ entries.
#Return pointer to fLeft ##
#Example
- SkRect rect = {7, 11, 13, 17};
-SkDebugf("rect.asScalars() %c= &rect.fLeft\n", rect.asScalars() == &rect.fLeft? '=' : '!');
-#StdOut
-rect.asScalars() == &rect.fLeft
-##
+ SkRect rect = {7, 11, 13, 17};
+SkDebugf("rect.asScalars() %c= &rect.fLeft\n", rect.asScalars() == &rect.fLeft? '=' : '!');
+#StdOut
+rect.asScalars() == &rect.fLeft
+##
##
#SeeAlso toQuad
@@ -2311,12 +2318,12 @@ generate exact binary representations of floating point numbers.
SkDebugf("\n");
}
#StdOut
-SkRect::MakeLTRB(20, 30, 40, 50);
-
-SkRect::MakeLTRB(SkBits2Float(0x41a00000), /* 20.000000 */
- SkBits2Float(0x41f00000), /* 30.000000 */
- SkBits2Float(0x42200000), /* 40.000000 */
- SkBits2Float(0x42480000) /* 50.000000 */);
+SkRect::MakeLTRB(20, 30, 40, 50);
+
+SkRect::MakeLTRB(SkBits2Float(0x41a00000), /* 20.000000 */
+ SkBits2Float(0x41f00000), /* 30.000000 */
+ SkBits2Float(0x42200000), /* 40.000000 */
+ SkBits2Float(0x42480000) /* 50.000000 */);
##
##
@@ -2334,12 +2341,12 @@ with limited precision; it may not be possible to reconstruct original Rect
from output.
#Example
-SkRect rect = {6.f / 7, 2.f / 3, 26.f / 10, 42.f / 6};
-rect.dump();
-SkRect copy = SkRect::MakeLTRB(0.857143f, 0.666667f, 2.6f, 7);
-SkDebugf("rect is " "%s" "equal to copy\n", rect == copy ? "" : "not ");
+SkRect rect = {6.f / 7, 2.f / 3, 26.f / 10, 42.f / 6};
+rect.dump();
+SkRect copy = SkRect::MakeLTRB(0.857143f, 0.666667f, 2.6f, 7);
+SkDebugf("rect is " "%s" "equal to copy\n", rect == copy ? "" : "not ");
#StdOut
-SkRect::MakeLTRB(0.857143f, 0.666667f, 2.6f, 7);
+SkRect::MakeLTRB(0.857143f, 0.666667f, 2.6f, 7);
rect is not equal to copy
##
##
@@ -2362,18 +2369,18 @@ Use instead of dump() when submitting
.
#Example
- SkRect rect = {6.f / 7, 2.f / 3, 26.f / 10, 42.f / 6};
-rect.dumpHex();
-SkRect copy = SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */
- SkBits2Float(0x3f2aaaab), /* 0.666667 */
- SkBits2Float(0x40266666), /* 2.600000 */
- SkBits2Float(0x40e00000) /* 7.000000 */);
+ SkRect rect = {6.f / 7, 2.f / 3, 26.f / 10, 42.f / 6};
+rect.dumpHex();
+SkRect copy = SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */
+ SkBits2Float(0x3f2aaaab), /* 0.666667 */
+ SkBits2Float(0x40266666), /* 2.600000 */
+ SkBits2Float(0x40e00000) /* 7.000000 */);
SkDebugf("rect is " "%s" "equal to copy\n", rect == copy ? "" : "not ");
#StdOut
-SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */
- SkBits2Float(0x3f2aaaab), /* 0.666667 */
- SkBits2Float(0x40266666), /* 2.600000 */
- SkBits2Float(0x40e00000) /* 7.000000 */);
+SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */
+ SkBits2Float(0x3f2aaaab), /* 0.666667 */
+ SkBits2Float(0x40266666), /* 2.600000 */
+ SkBits2Float(0x40e00000) /* 7.000000 */);
rect is equal to copy
##
##