2017-10-04 18:31:33 +00:00
|
|
|
#Topic Rect
|
2018-05-30 13:21:49 +00:00
|
|
|
#Alias Rects ##
|
|
|
|
#Alias Rect_Reference ##
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Struct SkRect
|
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#Code
|
|
|
|
#Populate
|
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
SkRect holds four SkScalar coordinates describing the upper and
|
2018-05-16 11:07:07 +00:00
|
|
|
lower bounds of a rectangle. SkRect may be created from outer bounds or
|
2017-10-09 18:07:42 +00:00
|
|
|
from position, width, and height. SkRect describes an area; if its right
|
|
|
|
is less than or equal to its left, or if its bottom is less than or equal to
|
|
|
|
its top, it is considered empty.
|
|
|
|
|
|
|
|
# move to topic about MakeIWH and friends
|
|
|
|
SkRect can be constructed from int values to avoid compiler warnings that
|
|
|
|
integer input cannot convert to SkScalar without loss of precision.
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Member SkScalar fLeft
|
2018-02-01 14:37:32 +00:00
|
|
|
#Line # smaller x-axis bounds ##
|
2017-10-09 18:07:42 +00:00
|
|
|
May contain any value, including infinities and NaN. The smaller of the
|
|
|
|
horizontal values when sorted. When equal to or greater than fRight, Rect is empty.
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
#Member SkScalar fTop
|
2018-02-01 14:37:32 +00:00
|
|
|
#Line # smaller y-axis bounds ##
|
2017-10-09 18:07:42 +00:00
|
|
|
May contain any value, including infinities and NaN. The smaller of the
|
|
|
|
vertical values when sorted. When equal to or greater than fBottom, Rect is empty.
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
#Member SkScalar fRight
|
2018-02-01 14:37:32 +00:00
|
|
|
#Line # larger x-axis bounds ##
|
2017-10-09 18:07:42 +00:00
|
|
|
May contain any value, including infinities and NaN. The larger of the
|
|
|
|
horizontal values when sorted. When equal to or less than fLeft, Rect is empty.
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
#Member SkScalar fBottom
|
2018-02-01 14:37:32 +00:00
|
|
|
#Line # larger y-axis bounds ##
|
2017-10-09 18:07:42 +00:00
|
|
|
May contain any value, including infinities and NaN. The larger of the
|
|
|
|
vertical values when sorted. When equal to or less than fTop, Rect is empty.
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#Method static constexpr SkRect MakeEmpty()
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#In Constructors
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # constructs from bounds of (0, 0, 0, 0) ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2018-01-08 20:05:02 +00:00
|
|
|
#SeeAlso isEmpty setEmpty SkIRect::MakeEmpty
|
2017-10-11 14:37:52 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#Method static constexpr SkRect MakeWH(SkScalar w, SkScalar h)
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#In Constructors
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # constructs from SkScalar input returning (0, 0, width, height) ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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 ?
|
2017-10-09 18:07:42 +00:00
|
|
|
"" : "not ");
|
|
|
|
#StdOut
|
|
|
|
all equal
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso MakeSize MakeXYWH MakeIWH setWH SkIRect::MakeWH
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#Method static SkRect MakeIWH(int w, int h)
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#In Constructors
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # constructs from int input returning (0, 0, width, height) ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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());
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
i_rect width: 25 f_rect width:25
|
2017-10-09 18:07:42 +00:00
|
|
|
i_rect width: 125000111 f_rect width:125000112
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso MakeXYWH MakeWH isetWH SkIRect::MakeWH
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#Method static constexpr SkRect MakeSize(const SkSize& size)
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#In Constructors
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # constructs from Size returning (0, 0, width, height) ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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());
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
rect width: 25.5 height: 35.5
|
2017-10-09 18:07:42 +00:00
|
|
|
floor width: 25 height: 35
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso MakeWH MakeXYWH MakeIWH setWH SkIRect::MakeWH
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#Method static constexpr SkRect MakeLTRB(SkScalar l, SkScalar t, SkScalar r,
|
2017-10-04 18:31:33 +00:00
|
|
|
SkScalar b)
|
2018-10-08 18:57:48 +00:00
|
|
|
#In Constructors
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # constructs from SkScalar left, top, right, bottom ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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");
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
rect: 5, 35, 15, 25 isEmpty: true
|
2017-10-09 18:07:42 +00:00
|
|
|
rect: 5, 25, 15, 35 isEmpty: false
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso MakeXYWH SkIRect::MakeLTRB
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#Method static constexpr SkRect MakeXYWH(SkScalar x, SkScalar y, SkScalar w, SkScalar h)
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#In Constructors
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # constructs from SkScalar input returning (x, y, width, height) ##
|
Condense embedded formulas.
Bookmaker delimits formulas and equations to allow
representing variables and symbols without tripping
up reference lookup, spell checking, and comment
generation.
Before, formulas were represented with:
some text
#Formula
(x + y, 0)
##
, and more text
This made it difficult to know when spacing should
be preserved before and after the formula. Now,
formulas are represented with:
some text #Formula # (x + y, 0) ##, and more text
The presence or absence of a space between ## and ,
is now significant (before it was not).
Also, formulas are bracketed by <code> in markdown
generation, so that variables stand out better.
See:
https://skia.org/user/api/SkBlendMode_Reference?cl=152781#Dst_Out
for an example.
Also fixed 100 column offenders and added a code
check to identify them. For the moment, 100 column
offenders are outed with SkDebugf but their presence
does not cause bookmaker to fail.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=152781
Bug: skia:6898
Change-Id: If92a65a234f5d616bf4485984a8d219a6f04821a
Reviewed-on: https://skia-review.googlesource.com/152781
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-09-13 16:04:30 +00:00
|
|
|
Returns constructed Rect set to #Formula # (x, y, x + w, y + h) ##.
|
|
|
|
Does not validate input; w or h may be negative.
|
2017-10-09 18:07:42 +00:00
|
|
|
|
|
|
|
#Param x stored in fLeft ##
|
|
|
|
#Param y stored in fTop ##
|
|
|
|
#Param w added to x and stored in fRight ##
|
|
|
|
#Param h added to y and stored in fBottom ##
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2017-10-11 14:37:52 +00:00
|
|
|
#Return bounds at (x, y) with width w and height h ##
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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");
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
rect: 5, 35, -10, 60 isEmpty: true
|
2017-10-09 18:07:42 +00:00
|
|
|
rect: -10, 35, 5, 60 isEmpty: false
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso MakeLTRB SkIRect::MakeXYWH
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method static SkRect Make(const SkISize& size)
|
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#In Constructors
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # constructs from ISize returning (0, 0, width, height) ##
|
2018-10-18 12:30:34 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
SkRect rect1 = SkRect::MakeSize({2, 35});
|
|
|
|
SkRect rect2 = SkRect::MakeIWH(2, 35);
|
|
|
|
SkDebugf("rect1 %c= rect2\n", rect1 == rect2 ? '=' : '!');
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
|
|
|
rect1 == rect2
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso MakeWH MakeXYWH SkRect::MakeIWH SkIRect::MakeSize
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#Method static SkRect Make(const SkIRect& irect)
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#In Constructors
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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? '=' : '!');
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso MakeLTRB
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#Subtopic Property
|
|
|
|
#Line # member values, center, validity ##
|
2018-01-26 17:56:22 +00:00
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method bool isEmpty() const
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns true if width or height are zero or negative ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso MakeEmpty sort SkIRect::isEmpty
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method bool isSorted() const
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns true if width or height are zero or positive ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso sort makeSorted isEmpty
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method bool isFinite() const
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns true if no member is infinite or NaN ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2018-01-08 20:05:02 +00:00
|
|
|
SkRect largest = { SK_ScalarMin, SK_ScalarMin, SK_ScalarMax, SK_ScalarMax };
|
2017-10-26 11:58:48 +00:00
|
|
|
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
|
2017-10-09 18:07:42 +00:00
|
|
|
widest is finite: false
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso SkScalarIsFinite SkScalarIsNaN
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method SkScalar x() const
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns bounds left ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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());
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
unsorted.fLeft: 15 unsorted.x(): 15
|
2017-10-09 18:07:42 +00:00
|
|
|
sorted.fLeft: 10 sorted.x(): 10
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso fLeft left() y() SkIRect::x()
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method SkScalar y() const
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns bounds top ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
SkRect unsorted = { 15, 25, 10, 5 };
|
|
|
|
SkDebugf("unsorted.fTop: %g unsorted.y(): %g\n", unsorted.fTop, unsorted.y());
|
|
|
|
SkRect sorted = unsorted.makeSorted();
|
2017-10-09 18:07:42 +00:00
|
|
|
SkDebugf("sorted.fTop: %g sorted.y(): %g\n", sorted.fTop, sorted.y());
|
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
unsorted.fTop: 25 unsorted.y(): 25
|
2017-10-09 18:07:42 +00:00
|
|
|
sorted.fTop: 5 sorted.y(): 5
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso fTop top() x() SkIRect::y()
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method SkScalar left() const
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns smaller bounds in x, if sorted ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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());
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
unsorted.fLeft: 15 unsorted.left(): 15
|
2017-10-09 18:07:42 +00:00
|
|
|
sorted.fLeft: 10 sorted.left(): 10
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso fLeft x() SkIRect::left()
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method SkScalar top() const
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns smaller bounds in y, if sorted ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
SkRect unsorted = { 15, 25, 10, 5 };
|
|
|
|
SkDebugf("unsorted.fTop: %g unsorted.top(): %g\n", unsorted.fTop, unsorted.top());
|
|
|
|
SkRect sorted = unsorted.makeSorted();
|
2017-10-09 18:07:42 +00:00
|
|
|
SkDebugf("sorted.fTop: %g sorted.top(): %g\n", sorted.fTop, sorted.top());
|
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
unsorted.fTop: 25 unsorted.top(): 25
|
2017-10-09 18:07:42 +00:00
|
|
|
sorted.fTop: 5 sorted.top(): 5
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso fTop y() SkIRect::top()
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method SkScalar right() const
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns larger bounds in x, if sorted ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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());
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
unsorted.fRight: 10 unsorted.right(): 10
|
2017-10-09 18:07:42 +00:00
|
|
|
sorted.fRight: 15 sorted.right(): 15
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso fRight SkIRect::right()
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method SkScalar bottom() const
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns larger bounds in y, if sorted ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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());
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
unsorted.fBottom: 5 unsorted.bottom(): 5
|
2017-10-09 18:07:42 +00:00
|
|
|
sorted.fBottom: 25 sorted.bottom(): 25
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso fBottom SkIRect::bottom()
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method SkScalar width() const
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns span in x ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-09 18:07:42 +00:00
|
|
|
#Description
|
|
|
|
Compare with SkIRect::width() example.
|
|
|
|
##
|
2017-10-26 11:58:48 +00:00
|
|
|
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());
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
unsorted width: -5
|
2017-10-09 18:07:42 +00:00
|
|
|
large width: 4294967296
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso height() SkIRect::width()
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method SkScalar height() const
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns span in y ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-09 18:07:42 +00:00
|
|
|
#Description
|
|
|
|
Compare with SkIRect::height() example.
|
|
|
|
##
|
2017-10-26 11:58:48 +00:00
|
|
|
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());
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
unsorted height: -5
|
2017-10-09 18:07:42 +00:00
|
|
|
large height: 4294967296
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso width() SkIRect::height()
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method SkScalar centerX() const
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns midpoint in x ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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());
|
|
|
|
}
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
left: 20 right: 41 centerX: 30.5
|
|
|
|
left: 20 right: 41 centerX: 30.5
|
|
|
|
left: -20 right: -41 centerX: -30.5
|
2017-10-09 18:07:42 +00:00
|
|
|
left: -41 right: -20 centerX: -30.5
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2018-04-11 20:54:35 +00:00
|
|
|
#SeeAlso centerY
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method SkScalar centerY() const
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns midpoint in y ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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);
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2018-06-20 16:45:16 +00:00
|
|
|
left: 2e+38 right: 3e+38 centerX: 2.5e+38 safe mid x: 2.5e+38
|
2017-10-09 18:07:42 +00:00
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2018-04-11 20:54:35 +00:00
|
|
|
#SeeAlso centerX
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#Subtopic Property ##
|
2018-01-26 17:56:22 +00:00
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#Subtopic Operators
|
2018-01-26 17:56:22 +00:00
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-11 14:37:52 +00:00
|
|
|
#Method bool operator==(const SkRect& a, const SkRect& b)
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#In Operators
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns true if members are equal ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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);
|
2017-10-09 18:07:42 +00:00
|
|
|
}
|
2017-10-26 11:58:48 +00:00
|
|
|
#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
|
2018-05-16 11:07:07 +00:00
|
|
|
{0, 0, 2, 2} == {-0, -0, 2, 2} and are numerically equal
|
2017-10-09 18:07:42 +00:00
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso operator!=(const SkRect& a, const SkRect& b)
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-11 14:37:52 +00:00
|
|
|
#Method bool operator!=(const SkRect& a, const SkRect& b)
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#In Operators
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns true if members are unequal ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
SkRect test = {0, 0, 2, SK_ScalarNaN};
|
|
|
|
SkDebugf("test with NaN is %s" "equal to itself\n", test == test ? "" : "not ");
|
|
|
|
#StdOut
|
2018-05-16 11:07:07 +00:00
|
|
|
test with NaN is not equal to itself
|
2017-10-09 18:07:42 +00:00
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso operator==(const SkRect& a, const SkRect& b)
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#Subtopic Operators ##
|
2018-01-26 17:56:22 +00:00
|
|
|
|
|
|
|
#Subtopic As_Points
|
2018-02-01 14:37:32 +00:00
|
|
|
#Line # conversion to and from Points ##
|
2018-01-26 17:56:22 +00:00
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method void toQuad(SkPoint quad[4]) const
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In As_Points
|
|
|
|
#Line # returns four corners as Point ##
|
2018-11-15 13:25:12 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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}
|
2018-05-16 11:07:07 +00:00
|
|
|
corners: {1, 2} {3, 2} {3, 4} {1, 4}
|
2017-10-09 18:07:42 +00:00
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso SkPath::addRect
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2018-01-26 17:56:22 +00:00
|
|
|
#Method void setBounds(const SkPoint pts[], int count)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In As_Points
|
|
|
|
#Line # sets to upper and lower limits of Point array ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2018-01-26 17:56:22 +00:00
|
|
|
|
|
|
|
#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
|
|
|
|
##
|
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso set setBoundsCheck SkPath::addPoly
|
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method bool setBoundsCheck(const SkPoint pts[], int count)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In As_Points
|
|
|
|
#Line # sets to upper and lower limits of Point array ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2018-01-26 17:56:22 +00:00
|
|
|
|
|
|
|
#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
|
|
|
|
##
|
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso set setBounds SkPath::addPoly
|
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
#Subtopic As_Points ##
|
|
|
|
|
|
|
|
#Subtopic Set
|
2018-02-01 14:37:32 +00:00
|
|
|
#Line # replaces all values ##
|
2018-01-26 17:56:22 +00:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2018-05-17 01:28:55 +00:00
|
|
|
#Method void setBoundsNoCheck(const SkPoint pts[], int count)
|
|
|
|
#In Set
|
|
|
|
#Line # sets to upper and lower limits of Point array ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2018-05-17 01:28:55 +00:00
|
|
|
|
|
|
|
#Example
|
2018-05-17 19:16:57 +00:00
|
|
|
SkPoint points[] = {{3, 4}, {1, 2}, {SK_ScalarInfinity, 6}, {SK_ScalarNaN, 8}};
|
2018-05-17 16:17:28 +00:00
|
|
|
for (int count = 0; count <= (int) SK_ARRAY_COUNT(points); ++count) {
|
|
|
|
SkRect rect;
|
|
|
|
rect.setBoundsNoCheck(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);
|
|
|
|
}
|
2018-05-17 01:28:55 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso setBoundsCheck
|
|
|
|
#Method ##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Method void setEmpty()
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Set
|
|
|
|
#Line # sets to (0, 0, 0, 0) ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso MakeEmpty SkIRect::setEmpty
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method void set(const SkIRect& src)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Set
|
|
|
|
#Line # sets to SkScalar input (left, top, right, bottom) and others ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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}
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso setLTRB SkIntToScalar
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method void set(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Set
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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}
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso setLTRB setXYWH SkIRect::set
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method void setLTRB(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Set
|
|
|
|
#Line # sets to SkScalar input (left, top, right, bottom) ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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}
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso set setXYWH SkIRect::set
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method void set(const SkPoint pts[], int count)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Set
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso setBounds setBoundsCheck SkPath::addPoly
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2018-01-26 17:56:22 +00:00
|
|
|
#Method void set(const SkPoint& p0, const SkPoint& p1)
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Set
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2018-01-26 17:56:22 +00:00
|
|
|
#Description
|
2018-05-16 11:07:07 +00:00
|
|
|
p0 and p1 may be swapped and have the same effect unless one contains NaN.
|
2017-10-09 18:07:42 +00:00
|
|
|
##
|
2017-10-26 11:58:48 +00:00
|
|
|
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);
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso setBounds setBoundsCheck
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method void setXYWH(SkScalar x, SkScalar y, SkScalar width, SkScalar height)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Set
|
|
|
|
#Line # sets to SkScalar input (x, y, width, height) ##
|
Condense embedded formulas.
Bookmaker delimits formulas and equations to allow
representing variables and symbols without tripping
up reference lookup, spell checking, and comment
generation.
Before, formulas were represented with:
some text
#Formula
(x + y, 0)
##
, and more text
This made it difficult to know when spacing should
be preserved before and after the formula. Now,
formulas are represented with:
some text #Formula # (x + y, 0) ##, and more text
The presence or absence of a space between ## and ,
is now significant (before it was not).
Also, formulas are bracketed by <code> in markdown
generation, so that variables stand out better.
See:
https://skia.org/user/api/SkBlendMode_Reference?cl=152781#Dst_Out
for an example.
Also fixed 100 column offenders and added a code
check to identify them. For the moment, 100 column
offenders are outed with SkDebugf but their presence
does not cause bookmaker to fail.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=152781
Bug: skia:6898
Change-Id: If92a65a234f5d616bf4485984a8d219a6f04821a
Reviewed-on: https://skia-review.googlesource.com/152781
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-09-13 16:04:30 +00:00
|
|
|
Sets Rect to #Formula # (x, y, x + width, y + height) ##.
|
|
|
|
Does not validate input; width or height may be negative.
|
2017-10-09 18:07:42 +00:00
|
|
|
|
|
|
|
#Param x stored in fLeft ##
|
|
|
|
#Param y stored in fTop ##
|
|
|
|
#Param width added to x and stored in fRight ##
|
|
|
|
#Param height added to y and stored in fBottom ##
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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");
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
rect: 5, 35, -10, 60 isEmpty: true
|
2017-10-09 18:07:42 +00:00
|
|
|
rect: -10, 35, 5, 60 isEmpty: false
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso MakeXYWH setLTRB set SkIRect::setXYWH
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method void setWH(SkScalar width, SkScalar height)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Set
|
|
|
|
#Line # sets to SkScalar input (0, 0, width, height) ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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");
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
rect: 0, 0, -15, 25 isEmpty: true
|
2017-10-09 18:07:42 +00:00
|
|
|
rect: -15, 0, 0, 25 isEmpty: false
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso MakeWH setXYWH isetWH
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2018-01-26 17:56:22 +00:00
|
|
|
#Subtopic Set ##
|
|
|
|
|
|
|
|
#Subtopic From_Integers
|
2018-05-16 11:07:07 +00:00
|
|
|
#Line # sets Scalar values from integer input ##
|
2018-01-26 17:56:22 +00:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method void iset(int left, int top, int right, int bottom)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In From_Integers
|
|
|
|
#Line # sets to int input (left, top, right, bottom) ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2018-01-26 17:56:22 +00:00
|
|
|
|
|
|
|
#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}
|
|
|
|
##
|
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso set setLTRB SkIRect::set SkIntToScalar
|
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method void isetWH(int width, int height)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In From_Integers
|
|
|
|
#Line # sets to int input (0, 0, width, height) ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2018-01-26 17:56:22 +00:00
|
|
|
|
|
|
|
#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);
|
|
|
|
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}
|
|
|
|
##
|
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso MakeWH MakeXYWH iset() SkIRect:MakeWH
|
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
#Subtopic From_Integers ##
|
|
|
|
|
|
|
|
#Subtopic Inset_Outset_Offset
|
2018-02-01 14:37:32 +00:00
|
|
|
#Line # moves sides ##
|
2018-01-26 17:56:22 +00:00
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method SkRect makeOffset(SkScalar dx, SkScalar dy) const
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Inset_Outset_Offset
|
|
|
|
#Line # constructs from translated sides ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso offset() makeInset makeOutset SkIRect::makeOffset
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method SkRect makeInset(SkScalar dx, SkScalar dy) const
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Inset_Outset_Offset
|
|
|
|
#Line # constructs from sides moved symmetrically about the center ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso inset() makeOffset makeOutset SkIRect::makeInset
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method SkRect makeOutset(SkScalar dx, SkScalar dy) const
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Inset_Outset_Offset
|
|
|
|
#Line # constructs from sides moved symmetrically about the center ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso outset() makeOffset makeInset SkIRect::makeOutset
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method void offset(SkScalar dx, SkScalar dy)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Inset_Outset_Offset
|
|
|
|
#Line # translates sides without changing width and height ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso offsetTo makeOffset SkIRect::offset
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method void offset(const SkPoint& delta)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Inset_Outset_Offset
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso offsetTo makeOffset SkIRect::offset
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method void offsetTo(SkScalar newX, SkScalar newY)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Inset_Outset_Offset
|
|
|
|
#Line # translates to (x, y) without changing width and height ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso offset makeOffset setXYWH SkIRect::offsetTo
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method void inset(SkScalar dx, SkScalar dy)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Inset_Outset_Offset
|
|
|
|
#Line # moves the sides symmetrically about the center ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso outset makeInset SkIRect::inset
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method void outset(SkScalar dx, SkScalar dy)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Inset_Outset_Offset
|
|
|
|
#Line # moves the sides symmetrically about the center ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso inset makeOutset SkIRect::outset
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2018-01-26 17:56:22 +00:00
|
|
|
#Subtopic Inset_Outset_Offset ##
|
|
|
|
|
|
|
|
#Subtopic Intersection
|
2018-05-16 11:07:07 +00:00
|
|
|
#Line # sets to shared bounds ##
|
2017-10-09 18:07:42 +00:00
|
|
|
|
2018-05-16 11:07:07 +00:00
|
|
|
Rects intersect when they enclose a common area. To intersect, each of the pair
|
2017-10-09 18:07:42 +00:00
|
|
|
must describe area; fLeft is less than fRight, and fTop is less than fBottom;
|
2018-11-07 19:59:03 +00:00
|
|
|
isEmpty() returns false. The intersection of Rect pair can be described by:
|
Condense embedded formulas.
Bookmaker delimits formulas and equations to allow
representing variables and symbols without tripping
up reference lookup, spell checking, and comment
generation.
Before, formulas were represented with:
some text
#Formula
(x + y, 0)
##
, and more text
This made it difficult to know when spacing should
be preserved before and after the formula. Now,
formulas are represented with:
some text #Formula # (x + y, 0) ##, and more text
The presence or absence of a space between ## and ,
is now significant (before it was not).
Also, formulas are bracketed by <code> in markdown
generation, so that variables stand out better.
See:
https://skia.org/user/api/SkBlendMode_Reference?cl=152781#Dst_Out
for an example.
Also fixed 100 column offenders and added a code
check to identify them. For the moment, 100 column
offenders are outed with SkDebugf but their presence
does not cause bookmaker to fail.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=152781
Bug: skia:6898
Change-Id: If92a65a234f5d616bf4485984a8d219a6f04821a
Reviewed-on: https://skia-review.googlesource.com/152781
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-09-13 16:04:30 +00:00
|
|
|
#Formula # (max(a.fLeft, b.fLeft), max(a.fTop, b.fTop),
|
|
|
|
min(a.fRight, b.fRight), min(a.fBottom, b.fBottom)) ##.
|
2017-10-26 11:58:48 +00:00
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
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.
|
|
|
|
|
2018-01-26 17:56:22 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2018-02-20 16:44:43 +00:00
|
|
|
#Method bool contains(SkScalar x, SkScalar y) const
|
|
|
|
|
|
|
|
#In Intersection
|
2018-02-20 19:33:13 +00:00
|
|
|
#Line # returns true if points are equal or inside ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2018-02-20 16:44:43 +00:00
|
|
|
|
|
|
|
#Example
|
|
|
|
SkRect rect = { 30, 50, 40, 60 };
|
|
|
|
SkPoint tests[] = { { 30, 50 }, { 39, 49 }, { 29, 59 } };
|
|
|
|
for (auto contained : tests) {
|
|
|
|
SkDebugf("rect: (%g, %g, %g, %g) %s (%g, %g)\n",
|
|
|
|
rect.left(), rect.top(), rect.right(), rect.bottom(),
|
|
|
|
rect.contains(contained.x(), contained.y()) ? "contains" : "does not contain",
|
|
|
|
contained.x(), contained.y());
|
|
|
|
}
|
|
|
|
#StdOut
|
|
|
|
rect: (30, 50, 40, 60) contains (30, 50)
|
|
|
|
rect: (30, 50, 40, 60) does not contain (39, 49)
|
|
|
|
rect: (30, 50, 40, 60) does not contain (29, 59)
|
|
|
|
##
|
|
|
|
##
|
|
|
|
|
2018-06-28 23:13:56 +00:00
|
|
|
#SeeAlso SkIRect::contains SkRRect::contains
|
2018-02-20 16:44:43 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2018-01-26 17:56:22 +00:00
|
|
|
#Method bool contains(const SkRect& r) const
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Intersection
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2018-01-26 17:56:22 +00:00
|
|
|
|
|
|
|
#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)
|
|
|
|
##
|
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso SkIRect::contains
|
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method bool contains(const SkIRect& r) const
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Intersection
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2018-01-26 17:56:22 +00:00
|
|
|
|
|
|
|
#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)
|
|
|
|
##
|
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso SkIRect::contains
|
|
|
|
|
|
|
|
##
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method bool intersect(const SkRect& r)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Intersection
|
|
|
|
#Line # sets to shared area; returns true if not empty ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-09 18:07:42 +00:00
|
|
|
#Description
|
|
|
|
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.
|
|
|
|
##
|
2017-10-26 11:58:48 +00:00
|
|
|
SkRect leftRect = { 10, 40, 50, 80 };
|
|
|
|
SkRect rightRect = { 30, 60, 70, 90 };
|
|
|
|
SkDebugf("%s intersection: ", leftRect.intersect(rightRect) ? "" : "no ");
|
2018-05-16 11:07:07 +00:00
|
|
|
SkDebugf("%g, %g, %g, %g\n", leftRect.left(), leftRect.top(),
|
2017-10-09 18:07:42 +00:00
|
|
|
leftRect.right(), leftRect.bottom());
|
|
|
|
#StdOut
|
|
|
|
intersection: 30, 60, 50, 80
|
2018-05-16 11:07:07 +00:00
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso intersects Intersects join SkIRect::intersect
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method bool intersect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Intersection
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-09 18:07:42 +00:00
|
|
|
#Description
|
|
|
|
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.
|
|
|
|
##
|
2017-10-26 11:58:48 +00:00
|
|
|
SkRect leftRect = { 10, 40, 50, 80 };
|
|
|
|
SkDebugf("%s intersection: ", leftRect.intersect(30, 60, 70, 90) ? "" : "no ");
|
2018-05-16 11:07:07 +00:00
|
|
|
SkDebugf("%g, %g, %g, %g\n", leftRect.left(), leftRect.top(),
|
2017-10-09 18:07:42 +00:00
|
|
|
leftRect.right(), leftRect.bottom());
|
|
|
|
#StdOut
|
|
|
|
intersection: 30, 60, 50, 80
|
2018-05-16 11:07:07 +00:00
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso intersects Intersects join SkIRect::intersect
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2018-10-08 18:57:48 +00:00
|
|
|
#Method bool intersect(const SkRect& a, const SkRect& b)
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Intersection
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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());
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
|
|
|
intersection: 30, 60, 50, 80
|
2018-05-16 11:07:07 +00:00
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso intersects Intersects join SkIRect::intersect
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Method bool intersects(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) const
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Intersection
|
|
|
|
#Line # returns true if areas overlap ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
SkRect rect = { 10, 40, 50, 80 };
|
|
|
|
SkDebugf("%s intersection", rect.intersects(30, 60, 70, 90) ? "" : "no ");
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
|
|
|
intersection
|
2018-05-16 11:07:07 +00:00
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso intersect Intersects SkIRect::Intersects
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Method bool intersects(const SkRect& r) const
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Intersection
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
SkRect rect = { 10, 40, 50, 80 };
|
|
|
|
SkDebugf("%s intersection", rect.intersects({30, 60, 70, 90}) ? "" : "no ");
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
|
|
|
intersection
|
2018-05-16 11:07:07 +00:00
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso intersect Intersects SkIRect::Intersects
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Method static bool Intersects(const SkRect& a, const SkRect& b)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Intersection
|
|
|
|
#Line # returns true if areas overlap ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
SkDebugf("%s intersection", SkRect::Intersects({10, 40, 50, 80}, {30, 60, 70, 90}) ? "" : "no ");
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
|
|
|
intersection
|
2018-05-16 11:07:07 +00:00
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso intersect intersects SkIRect::Intersects
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2018-01-26 17:56:22 +00:00
|
|
|
#Subtopic Intersection ##
|
|
|
|
|
|
|
|
#Subtopic Join
|
2018-05-16 11:07:07 +00:00
|
|
|
#Line # sets to union of bounds ##
|
2017-10-09 18:07:42 +00:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Method void join(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Join
|
|
|
|
#Line # sets to union of bounds ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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);
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
|
|
|
join: 10, 20, 55, 65
|
2018-05-16 11:07:07 +00:00
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso joinNonEmptyArg joinPossiblyEmptyRect SkIRect::join
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Method void join(const SkRect& r)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Join
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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);
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
|
|
|
join: 10, 20, 55, 65
|
2018-05-16 11:07:07 +00:00
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso joinNonEmptyArg joinPossiblyEmptyRect SkIRect::join
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Method void joinNonEmptyArg(const SkRect& r)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Join
|
|
|
|
#Line # sets to union of bounds, asserting that argument is not empty ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-09 18:07:42 +00:00
|
|
|
#Description
|
|
|
|
Since Rect is not sorted, first result is copy of toJoin.
|
|
|
|
##
|
2017-10-26 11:58:48 +00:00
|
|
|
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);
|
2017-10-09 18:07:42 +00:00
|
|
|
SkDebugf("sorted: %g, %g, %g, %g\n", sorted.fLeft, sorted.fTop, sorted.fRight, sorted.fBottom);
|
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
rect: 50, 60, 55, 65
|
2017-10-09 18:07:42 +00:00
|
|
|
sorted: 10, 0, 55, 100
|
2018-05-16 11:07:07 +00:00
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso join joinPossiblyEmptyRect SkIRect::join
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Method void joinPossiblyEmptyRect(const SkRect& r)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Join
|
2018-05-16 11:07:07 +00:00
|
|
|
#Line # sets to union of bounds; skips empty check for both ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-09 18:07:42 +00:00
|
|
|
#Description
|
|
|
|
Since Rect is not sorted, first result is not useful.
|
|
|
|
##
|
2017-10-26 11:58:48 +00:00
|
|
|
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);
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
rect: 10, 60, 55, 65
|
2017-10-09 18:07:42 +00:00
|
|
|
sorted: 10, 0, 55, 100
|
2018-05-16 11:07:07 +00:00
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso joinNonEmptyArg join SkIRect::join
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2018-01-26 17:56:22 +00:00
|
|
|
#Subtopic Join ##
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2018-01-26 17:56:22 +00:00
|
|
|
#Subtopic Rounding
|
2018-02-01 14:37:32 +00:00
|
|
|
#Line # adjust to integer bounds ##
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Method void round(SkIRect* dst) const
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Rounding
|
|
|
|
#Line # sets members to nearest integer value ##
|
2017-10-09 18:07:42 +00:00
|
|
|
Sets IRect by adding 0.5 and discarding the fractional portion of Rect
|
Condense embedded formulas.
Bookmaker delimits formulas and equations to allow
representing variables and symbols without tripping
up reference lookup, spell checking, and comment
generation.
Before, formulas were represented with:
some text
#Formula
(x + y, 0)
##
, and more text
This made it difficult to know when spacing should
be preserved before and after the formula. Now,
formulas are represented with:
some text #Formula # (x + y, 0) ##, and more text
The presence or absence of a space between ## and ,
is now significant (before it was not).
Also, formulas are bracketed by <code> in markdown
generation, so that variables stand out better.
See:
https://skia.org/user/api/SkBlendMode_Reference?cl=152781#Dst_Out
for an example.
Also fixed 100 column offenders and added a code
check to identify them. For the moment, 100 column
offenders are outed with SkDebugf but their presence
does not cause bookmaker to fail.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=152781
Bug: skia:6898
Change-Id: If92a65a234f5d616bf4485984a8d219a6f04821a
Reviewed-on: https://skia-review.googlesource.com/152781
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-09-13 16:04:30 +00:00
|
|
|
members, using #Formula # (SkScalarRoundToInt(fLeft), SkScalarRoundToInt(fTop),
|
|
|
|
SkScalarRoundToInt(fRight), SkScalarRoundToInt(fBottom)) ##.
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#Param dst storage for IRect ##
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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);
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
|
|
|
round: 31, 51, 41, 61
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso roundIn roundOut SkScalarRoundToInt
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Method void roundOut(SkIRect* dst) const
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Rounding
|
|
|
|
#Line # sets members to nearest integer value away from opposite ##
|
Condense embedded formulas.
Bookmaker delimits formulas and equations to allow
representing variables and symbols without tripping
up reference lookup, spell checking, and comment
generation.
Before, formulas were represented with:
some text
#Formula
(x + y, 0)
##
, and more text
This made it difficult to know when spacing should
be preserved before and after the formula. Now,
formulas are represented with:
some text #Formula # (x + y, 0) ##, and more text
The presence or absence of a space between ## and ,
is now significant (before it was not).
Also, formulas are bracketed by <code> in markdown
generation, so that variables stand out better.
See:
https://skia.org/user/api/SkBlendMode_Reference?cl=152781#Dst_Out
for an example.
Also fixed 100 column offenders and added a code
check to identify them. For the moment, 100 column
offenders are outed with SkDebugf but their presence
does not cause bookmaker to fail.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=152781
Bug: skia:6898
Change-Id: If92a65a234f5d616bf4485984a8d219a6f04821a
Reviewed-on: https://skia-review.googlesource.com/152781
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-09-13 16:04:30 +00:00
|
|
|
Sets IRect by discarding the fractional portion of fLeft and fTop; and rounding
|
|
|
|
up fRight and fBottom, using
|
|
|
|
#Formula # (SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop),
|
|
|
|
SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom)) ##.
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#Param dst storage for IRect ##
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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);
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
|
|
|
round: 30, 50, 41, 61
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso roundIn round SkScalarRoundToInt
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2018-05-16 11:07:07 +00:00
|
|
|
#Method void roundOut(SkRect* dst) const
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Rounding
|
Condense embedded formulas.
Bookmaker delimits formulas and equations to allow
representing variables and symbols without tripping
up reference lookup, spell checking, and comment
generation.
Before, formulas were represented with:
some text
#Formula
(x + y, 0)
##
, and more text
This made it difficult to know when spacing should
be preserved before and after the formula. Now,
formulas are represented with:
some text #Formula # (x + y, 0) ##, and more text
The presence or absence of a space between ## and ,
is now significant (before it was not).
Also, formulas are bracketed by <code> in markdown
generation, so that variables stand out better.
See:
https://skia.org/user/api/SkBlendMode_Reference?cl=152781#Dst_Out
for an example.
Also fixed 100 column offenders and added a code
check to identify them. For the moment, 100 column
offenders are outed with SkDebugf but their presence
does not cause bookmaker to fail.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=152781
Bug: skia:6898
Change-Id: If92a65a234f5d616bf4485984a8d219a6f04821a
Reviewed-on: https://skia-review.googlesource.com/152781
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-09-13 16:04:30 +00:00
|
|
|
Sets Rect by discarding the fractional portion of fLeft and fTop; and rounding
|
|
|
|
up fRight and fBottom, using
|
|
|
|
#Formula # (SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop),
|
|
|
|
SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom)) ##.
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#Param dst storage for Rect ##
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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);
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
|
|
|
round: 30, 50, 41, 61
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso roundIn round SkScalarRoundToInt
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Method void roundIn(SkIRect* dst) const
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Rounding
|
|
|
|
#Line # sets members to nearest integer value towards opposite ##
|
Condense embedded formulas.
Bookmaker delimits formulas and equations to allow
representing variables and symbols without tripping
up reference lookup, spell checking, and comment
generation.
Before, formulas were represented with:
some text
#Formula
(x + y, 0)
##
, and more text
This made it difficult to know when spacing should
be preserved before and after the formula. Now,
formulas are represented with:
some text #Formula # (x + y, 0) ##, and more text
The presence or absence of a space between ## and ,
is now significant (before it was not).
Also, formulas are bracketed by <code> in markdown
generation, so that variables stand out better.
See:
https://skia.org/user/api/SkBlendMode_Reference?cl=152781#Dst_Out
for an example.
Also fixed 100 column offenders and added a code
check to identify them. For the moment, 100 column
offenders are outed with SkDebugf but their presence
does not cause bookmaker to fail.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=152781
Bug: skia:6898
Change-Id: If92a65a234f5d616bf4485984a8d219a6f04821a
Reviewed-on: https://skia-review.googlesource.com/152781
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-09-13 16:04:30 +00:00
|
|
|
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)) ##.
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#Param dst storage for IRect ##
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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);
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
round: 31, 51, 40, 60
|
2017-10-09 18:07:42 +00:00
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso roundOut round SkScalarRoundToInt
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Method SkIRect round() const
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Rounding
|
2017-10-09 18:07:42 +00:00
|
|
|
Returns IRect by adding 0.5 and discarding the fractional portion of Rect
|
Condense embedded formulas.
Bookmaker delimits formulas and equations to allow
representing variables and symbols without tripping
up reference lookup, spell checking, and comment
generation.
Before, formulas were represented with:
some text
#Formula
(x + y, 0)
##
, and more text
This made it difficult to know when spacing should
be preserved before and after the formula. Now,
formulas are represented with:
some text #Formula # (x + y, 0) ##, and more text
The presence or absence of a space between ## and ,
is now significant (before it was not).
Also, formulas are bracketed by <code> in markdown
generation, so that variables stand out better.
See:
https://skia.org/user/api/SkBlendMode_Reference?cl=152781#Dst_Out
for an example.
Also fixed 100 column offenders and added a code
check to identify them. For the moment, 100 column
offenders are outed with SkDebugf but their presence
does not cause bookmaker to fail.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=152781
Bug: skia:6898
Change-Id: If92a65a234f5d616bf4485984a8d219a6f04821a
Reviewed-on: https://skia-review.googlesource.com/152781
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-09-13 16:04:30 +00:00
|
|
|
members, using #Formula # (SkScalarRoundToInt(fLeft), SkScalarRoundToInt(fTop),
|
|
|
|
SkScalarRoundToInt(fRight), SkScalarRoundToInt(fBottom)) ##.
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#Return rounded IRect ##
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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);
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
round: 31, 51, 41, 61
|
2017-10-09 18:07:42 +00:00
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso roundOut roundIn SkScalarRoundToInt
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Method SkIRect roundOut() const
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Rounding
|
Condense embedded formulas.
Bookmaker delimits formulas and equations to allow
representing variables and symbols without tripping
up reference lookup, spell checking, and comment
generation.
Before, formulas were represented with:
some text
#Formula
(x + y, 0)
##
, and more text
This made it difficult to know when spacing should
be preserved before and after the formula. Now,
formulas are represented with:
some text #Formula # (x + y, 0) ##, and more text
The presence or absence of a space between ## and ,
is now significant (before it was not).
Also, formulas are bracketed by <code> in markdown
generation, so that variables stand out better.
See:
https://skia.org/user/api/SkBlendMode_Reference?cl=152781#Dst_Out
for an example.
Also fixed 100 column offenders and added a code
check to identify them. For the moment, 100 column
offenders are outed with SkDebugf but their presence
does not cause bookmaker to fail.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=152781
Bug: skia:6898
Change-Id: If92a65a234f5d616bf4485984a8d219a6f04821a
Reviewed-on: https://skia-review.googlesource.com/152781
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-09-13 16:04:30 +00:00
|
|
|
Sets IRect by discarding the fractional portion of fLeft and fTop; and rounding
|
|
|
|
up fRight and fBottom, using
|
|
|
|
#Formula # (SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop),
|
|
|
|
SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom)) ##.
|
2017-10-04 18:31:33 +00:00
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#Return rounded IRect ##
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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);
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
round: 30, 50, 41, 61
|
2017-10-09 18:07:42 +00:00
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso round roundIn SkScalarRoundToInt
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2018-01-26 17:56:22 +00:00
|
|
|
#Subtopic Rounding ##
|
|
|
|
|
|
|
|
#Subtopic Sorting
|
2018-02-01 14:37:32 +00:00
|
|
|
#Line # orders sides ##
|
2018-01-26 17:56:22 +00:00
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Method void sort()
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Sorting
|
|
|
|
#Line # orders sides from smaller to larger ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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);
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
rect: 30.5, 50.5, 20.5, 10.5
|
2017-10-09 18:07:42 +00:00
|
|
|
sorted: 20.5, 10.5, 30.5, 50.5
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2018-01-26 17:56:22 +00:00
|
|
|
#SeeAlso makeSorted SkIRect::sort isSorted
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Method SkRect makeSorted() const
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#In Sorting
|
2018-10-08 18:57:48 +00:00
|
|
|
#In Constructors
|
2018-05-16 11:07:07 +00:00
|
|
|
#Line # constructs Rect, ordering sides from smaller to larger ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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);
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
rect: 30.5, 50.5, 20.5, 10.5
|
2017-10-09 18:07:42 +00:00
|
|
|
sorted: 20.5, 10.5, 30.5, 50.5
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2018-01-26 17:56:22 +00:00
|
|
|
#SeeAlso sort SkIRect::makeSorted isSorted
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2018-01-26 17:56:22 +00:00
|
|
|
#Subtopic Sorting ##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Method const SkScalar* asScalars() const
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns pointer to members as array ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
SkRect rect = {7, 11, 13, 17};
|
|
|
|
SkDebugf("rect.asScalars() %c= &rect.fLeft\n", rect.asScalars() == &rect.fLeft? '=' : '!');
|
|
|
|
#StdOut
|
|
|
|
rect.asScalars() == &rect.fLeft
|
|
|
|
##
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
#SeeAlso toQuad
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Method void dump(bool asHex) const
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # sends text representation to standard output using floats ##
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
#Example
|
2017-10-09 18:07:42 +00:00
|
|
|
SkRect rect = {20, 30, 40, 50};
|
|
|
|
for (bool dumpAsHex : { false, true } ) {
|
|
|
|
rect.dump(dumpAsHex);
|
|
|
|
SkDebugf("\n");
|
|
|
|
}
|
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
SkRect::MakeLTRB(20, 30, 40, 50);
|
|
|
|
|
|
|
|
SkRect::MakeLTRB(SkBits2Float(0x41a00000), /* 20.000000 */
|
|
|
|
SkBits2Float(0x41f00000), /* 30.000000 */
|
|
|
|
SkBits2Float(0x42200000), /* 40.000000 */
|
|
|
|
SkBits2Float(0x42480000) /* 50.000000 */);
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
2017-10-09 18:07:42 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso dumpHex
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Method void dump() const
|
2018-10-31 16:14:03 +00:00
|
|
|
#Populate
|
2017-10-09 18:07:42 +00:00
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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 ");
|
2017-10-09 18:07:42 +00:00
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
SkRect::MakeLTRB(0.857143f, 0.666667f, 2.6f, 7);
|
2017-10-09 18:07:42 +00:00
|
|
|
rect is not equal to copy
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
2017-10-09 18:07:42 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso dumpHex
|
2017-10-04 18:31:33 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
2017-10-09 18:07:42 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Method void dumpHex() const
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # sends text representation to standard output using hexadecimal ##
|
2017-10-09 18:07:42 +00:00
|
|
|
Writes text representation of Rect to standard output. The representation may be
|
|
|
|
directly compiled as C++ code. Floating point values are written
|
|
|
|
in hexadecimal to preserve their exact bit pattern. The output reconstructs the
|
|
|
|
original Rect.
|
|
|
|
|
2018-05-16 11:07:07 +00:00
|
|
|
Use instead of dump() when submitting
|
|
|
|
#A bug reports against Skia # https://bug.skia.org ##
|
2017-10-09 18:07:42 +00:00
|
|
|
.
|
|
|
|
|
2017-10-04 18:31:33 +00:00
|
|
|
#Example
|
2017-10-26 11:58:48 +00:00
|
|
|
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 */);
|
2017-10-09 18:07:42 +00:00
|
|
|
SkDebugf("rect is " "%s" "equal to copy\n", rect == copy ? "" : "not ");
|
|
|
|
#StdOut
|
2017-10-26 11:58:48 +00:00
|
|
|
SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */
|
|
|
|
SkBits2Float(0x3f2aaaab), /* 0.666667 */
|
|
|
|
SkBits2Float(0x40266666), /* 2.600000 */
|
|
|
|
SkBits2Float(0x40e00000) /* 7.000000 */);
|
2017-10-09 18:07:42 +00:00
|
|
|
rect is equal to copy
|
2017-10-04 18:31:33 +00:00
|
|
|
##
|
2017-10-09 18:07:42 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso dump
|
2018-10-11 19:28:31 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
#Struct SkRect ##
|
|
|
|
|
|
|
|
#Topic Rect ##
|