Lines Matching refs:SkIRect
21 /** \struct SkIRect
22 SkIRect holds four 32-bit integer coordinates describing the upper and
23 lower bounds of a rectangle. SkIRect may be created from outer bounds or
24 from position, width, and height. SkIRect describes an area; if its right
28 struct SK_API SkIRect {
34 /** Writes text representation of SkIRect to string.
40 /** Returns constructed SkIRect set to (0, 0, 0, 0).
47 static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeEmpty() {
48 return SkIRect{0, 0, 0, 0};
51 /** Returns constructed SkIRect set to (0, 0, w, h). Does not validate input; w or h
54 @param w width of constructed SkIRect
55 @param h height of constructed SkIRect
58 static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeWH(int32_t w, int32_t h) {
59 return SkIRect{0, 0, w, h};
62 /** Returns constructed SkIRect set to (0, 0, size.width(), size.height()).
65 @param size values for SkIRect width and height
68 static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeSize(const SkISize& size) {
69 return SkIRect{0, 0, size.fWidth, size.fHeight};
72 /** Returns constructed SkIRect set to (pt.x(), pt.y(), pt.x() + size.width(),
76 @param pt values for SkIRect fLeft and fTop
77 @param size values for SkIRect width and height
80 static constexpr SkIRect SK_WARN_UNUSED_RESULT MakePtSize(SkIPoint pt, SkISize size) {
84 /** Returns constructed SkIRect set to (l, t, r, b). Does not sort input; SkIRect may
93 static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeLTRB(int32_t l, int32_t t,
95 return SkIRect{l, t, r, b};
98 /** Returns constructed SkIRect set to: (x, y, x + w, y + h).
107 static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeXYWH(int32_t x, int32_t y,
112 /** Returns left edge of SkIRect, if sorted.
119 /** Returns top edge of SkIRect, if sorted. Call isEmpty() to see if SkIRect may be invalid,
126 /** Returns right edge of SkIRect, if sorted.
133 /** Returns bottom edge of SkIRect, if sorted. Call isEmpty() to see if SkIRect may be invalid,
140 /** Returns left edge of SkIRect, if sorted. Call isEmpty() to see if SkIRect may be invalid,
147 /** Returns top edge of SkIRect, if sorted. Call isEmpty() to see if SkIRect may be invalid,
157 /** Returns span on the x-axis. This does not check if SkIRect is sorted, or if
164 /** Returns span on the y-axis. This does not check if SkIRect is sorted, or if
171 /** Returns spans on the x-axis and y-axis. This does not check if SkIRect is sorted,
178 /** Returns span on the x-axis. This does not check if SkIRect is sorted, so the
186 /** Returns span on the y-axis. This does not check if SkIRect is sorted, so the
219 @param a SkIRect to compare
220 @param b SkIRect to compare
223 friend bool operator==(const SkIRect& a, const SkIRect& b) {
230 @param a SkIRect to compare
231 @param b SkIRect to compare
234 friend bool operator!=(const SkIRect& a, const SkIRect& b) {
238 /** Sets SkIRect to (0, 0, 0, 0).
246 /** Sets SkIRect to (left, top, right, bottom).
262 /** Sets SkIRect to: (x, y, x + width, y + height).
291 /** Returns SkIRect offset by (dx, dy).
293 If dx is negative, SkIRect returned is moved to the left.
294 If dx is positive, SkIRect returned is moved to the right.
295 If dy is negative, SkIRect returned is moved upward.
296 If dy is positive, SkIRect returned is moved downward.
300 @return SkIRect offset by dx and dy, with original width and height
302 constexpr SkIRect makeOffset(int32_t dx, int32_t dy) const {
309 /** Returns SkIRect offset by (offset.x(), offset.y()).
311 If offset.x() is negative, SkIRect returned is moved to the left.
312 If offset.x() is positive, SkIRect returned is moved to the right.
313 If offset.y() is negative, SkIRect returned is moved upward.
314 If offset.y() is positive, SkIRect returned is moved downward.
317 @return SkIRect translated by offset, with original width and height
319 constexpr SkIRect makeOffset(SkIVector offset) const {
323 /** Returns SkIRect, inset by (dx, dy).
325 If dx is negative, SkIRect returned is wider.
326 If dx is positive, SkIRect returned is narrower.
327 If dy is negative, SkIRect returned is taller.
328 If dy is positive, SkIRect returned is shorter.
332 @return SkIRect inset symmetrically left and right, top and bottom
334 SkIRect makeInset(int32_t dx, int32_t dy) const {
341 /** Returns SkIRect, outset by (dx, dy).
343 If dx is negative, SkIRect returned is narrower.
344 If dx is positive, SkIRect returned is wider.
345 If dy is negative, SkIRect returned is shorter.
346 If dy is positive, SkIRect returned is taller.
350 @return SkIRect outset symmetrically left and right, top and bottom
352 SkIRect makeOutset(int32_t dx, int32_t dy) const {
359 /** Offsets SkIRect by adding dx to fLeft, fRight; and by adding dy to fTop, fBottom.
361 If dx is negative, moves SkIRect returned to the left.
362 If dx is positive, moves SkIRect returned to the right.
363 If dy is negative, moves SkIRect returned upward.
364 If dy is positive, moves SkIRect returned downward.
376 /** Offsets SkIRect by adding delta.fX to fLeft, fRight; and by adding delta.fY to
379 If delta.fX is negative, moves SkIRect returned to the left.
380 If delta.fX is positive, moves SkIRect returned to the right.
381 If delta.fY is negative, moves SkIRect returned upward.
382 If delta.fY is positive, moves SkIRect returned downward.
384 @param delta offset added to SkIRect
390 /** Offsets SkIRect so that fLeft equals newX, and fTop equals newY. width and height
403 /** Insets SkIRect by (dx,dy).
405 If dx is positive, makes SkIRect narrower.
406 If dx is negative, makes SkIRect wider.
407 If dy is positive, makes SkIRect shorter.
408 If dy is negative, makes SkIRect taller.
420 /** Outsets SkIRect by (dx, dy).
422 If dx is positive, makes SkIRect wider.
423 If dx is negative, makes SkIRect narrower.
424 If dy is positive, makes SkIRect taller.
425 If dy is negative, makes SkIRect shorter.
432 /** Adjusts SkIRect by adding dL to fLeft, dT to fTop, dR to fRight, and dB to fBottom.
434 If dL is positive, narrows SkIRect on the left. If negative, widens it on the left.
435 If dT is positive, shrinks SkIRect on the top. If negative, lengthens it on the top.
436 If dR is positive, narrows SkIRect on the right. If negative, widens it on the right.
437 If dB is positive, shrinks SkIRect on the bottom. If negative, lengthens it on the bottom.
439 The resulting SkIRect is not checked for validity. Thus, if the resulting SkIRect left is
440 greater than right, the SkIRect will be considered empty. Call sort() after this call
456 Returns false if SkIRect is empty.
458 Considers input to describe constructed SkIRect: (x, y, x + 1, y + 1) and
459 returns true if constructed area is completely enclosed by SkIRect area.
463 @return true if (x, y) is inside SkIRect
469 /** Returns true if SkIRect contains r.
470 Returns false if SkIRect is empty or r is empty.
472 SkIRect contains r when SkIRect area completely includes r area.
474 @param r SkIRect contained
475 @return true if all sides of SkIRect are outside r
477 bool contains(const SkIRect& r) const {
483 /** Returns true if SkIRect contains r.
484 Returns false if SkIRect is empty or r is empty.
486 SkIRect contains r when SkIRect area completely includes r area.
489 @return true if all sides of SkIRect are outside r
493 /** Returns true if SkIRect contains construction.
494 Asserts if SkIRect is empty or construction is empty, and if SK_DEBUG is defined.
496 Return is undefined if SkIRect is empty or construction is empty.
498 @param r SkIRect contained
499 @return true if all sides of SkIRect are outside r
501 bool containsNoEmptyCheck(const SkIRect& r) const {
507 /** Returns true if SkIRect intersects r, and sets SkIRect to intersection.
508 Returns false if SkIRect does not intersect r, and leaves SkIRect unchanged.
510 Returns false if either r or SkIRect is empty, leaving SkIRect unchanged.
513 @return true if r and SkIRect have area in common
515 bool intersect(const SkIRect& r) {
519 /** Returns true if a intersects b, and sets SkIRect to intersection.
520 Returns false if a does not intersect b, and leaves SkIRect unchanged.
522 Returns false if either a or b is empty, leaving SkIRect unchanged.
524 @param a SkIRect to intersect
525 @param b SkIRect to intersect
528 bool SK_WARN_UNUSED_RESULT intersect(const SkIRect& a, const SkIRect& b);
533 @param a SkIRect to intersect
534 @param b SkIRect to intersect
537 static bool Intersects(const SkIRect& a, const SkIRect& b) {
538 return SkIRect{}.intersect(a, b);
541 /** Sets SkIRect to the union of itself and r.
543 Has no effect if r is empty. Otherwise, if SkIRect is empty, sets SkIRect to r.
545 @param r expansion SkIRect
549 void join(const SkIRect& r);
565 /** Returns SkIRect with fLeft and fRight swapped if fLeft is greater than fRight; and
569 @return sorted SkIRect
571 SkIRect makeSorted() const {
605 represent 32-bit integers exactly. Use SkIRect for an exact integer rectangle.
619 Use SkIRect for an exact integer rectangle.
667 /** Returns constructed SkIRect set to (0, 0, size.width(), size.height()).
677 /** Returns constructed SkIRect set to irect, promoting integers to scalar.
684 static SkRect SK_WARN_UNUSED_RESULT Make(const SkIRect& irect) {
859 void set(const SkIRect& src) {
1222 @param r SkIRect contained
1225 bool contains(const SkIRect& r) const {
1232 /** Sets SkIRect by adding 0.5 and discarding the fractional portion of SkRect
1236 @param dst storage for SkIRect
1238 void round(SkIRect* dst) const {
1244 /** Sets SkIRect by discarding the fractional portion of fLeft and fTop; and rounding
1249 @param dst storage for SkIRect
1251 void roundOut(SkIRect* dst) const {
1274 @param dst storage for SkIRect
1276 void roundIn(SkIRect* dst) const {
1282 /** Returns SkIRect by adding 0.5 and discarding the fractional portion of SkRect
1286 @return rounded SkIRect
1288 SkIRect round() const {
1289 SkIRect ir;
1294 /** Sets SkIRect by discarding the fractional portion of fLeft and fTop; and rounding
1299 @return rounded SkIRect
1301 SkIRect roundOut() const {
1302 SkIRect ir;
1306 /** Sets SkIRect by rounding up fLeft and fTop; and discarding the fractional portion
1311 @return rounded SkIRect
1313 SkIRect roundIn() const {
1314 SkIRect ir;
1385 inline bool SkIRect::contains(const SkRect& r) const {