Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1 | #Topic IRect
|
| 2 | #Alias IRect_Reference
|
| 3 |
|
| 4 | #Struct SkIRect
|
| 5 |
|
| 6 | SkIRect holds four 32 bit integer coordinates describing the upper and
|
| 7 | lower bounds of a rectangle. SkIRect may be created from outer bounds or
|
| 8 | from position, width, and height. SkIRect describes an area; if its right
|
| 9 | is less than or equal to its left, or if its bottom is less than or equal to
|
| 10 | its top, it is considered empty.
|
| 11 |
|
| 12 | #Topic Overview
|
| 13 |
|
| 14 | #Subtopic Subtopics
|
| 15 | #ToDo manually add subtopics ##
|
| 16 | #Table
|
| 17 | #Legend
|
| 18 | # topics # description ##
|
| 19 | #Legend ##
|
| 20 | #Table ##
|
| 21 | ##
|
| 22 |
|
| 23 | #Subtopic Operators
|
| 24 | #Table
|
| 25 | #Legend
|
| 26 | # description # function ##
|
| 27 | #Legend ##
|
| 28 | # bool operator!=(const SkIRect& a, const SkIRect& b) # Returns true if members are unequal. ##
|
| 29 | # bool operator==(const SkIRect& a, const SkIRect& b) # Returns true if members are equal. ##
|
| 30 | #Table ##
|
| 31 | #Subtopic ##
|
| 32 |
|
| 33 | #Subtopic Member_Functions
|
| 34 | #Table
|
| 35 | #Legend
|
| 36 | # description # function ##
|
| 37 | #Legend ##
|
| 38 | # EmptyIRect # Returns immutable bounds of (0, 0, 0, 0). ##
|
| 39 | # Intersects # Returns true if areas overlap. ##
|
| 40 | # IntersectsNoEmptyCheck # Returns true if areas overlap. Skips empty check. ##
|
| 41 | # MakeEmpty # Returns bounds of (0, 0, 0, 0). ##
|
| 42 | # MakeLTRB # Constructs from int left, top, right, bottom. ##
|
| 43 | # MakeLargest # Constructs from (SK_MinS32, SK_MinS32, SK_MaxS32, SK_MaxS32). ##
|
| 44 | # MakeSize # Constructs from ISize returning (0, 0, width, height). ##
|
| 45 | # MakeWH # Constructs from int input returning (0, 0, width, height). ##
|
| 46 | # MakeXYWH # Constructs from int input returning (x, y, width, height). ##
|
| 47 | # bottom() # Returns larger bounds in y, if sorted. ##
|
| 48 | # centerX # Returns midpoint in x. ##
|
| 49 | # centerY # Returns midpoint in y. ##
|
| 50 | # contains() # Returns true if points are equal or inside. ##
|
| 51 | # containsNoEmptyCheck # Returns true if points are equal or inside. Skips empty check. ##
|
| 52 | # height() # Returns span in y. ##
|
| 53 | # inset() # Moves the sides symmetrically about the center. ##
|
| 54 | # intersect # Sets to shared area; returns true if not empty. ##
|
| 55 | # intersectNoEmptyCheck # Sets to shared area; returns true if not empty. Skips empty check. ##
|
| 56 | # is16Bit # Returns true if members fit in 16-bit word. ##
|
| 57 | # isEmpty # Returns true if width or height are zero or negative. ##
|
| 58 | # isLargest # Returns true if equal to (SK_MinS32, SK_MinS32, SK_MaxS32, SK_MaxS32). ##
|
| 59 | # join() # Sets to union of bounds. ##
|
| 60 | # left() # Returns smaller bounds in x, if sorted. ##
|
| 61 | # makeInset # Constructs from sides moved symmetrically about the center. ##
|
| 62 | # makeOffset # Constructs from translated sides. ##
|
| 63 | # makeOutset # Constructs from sides moved symmetrically about the center. ##
|
| 64 | # makeSorted # Constructs, ordering sides from smaller to larger. ##
|
| 65 | # offset() # Translates sides without changing width and height. ##
|
| 66 | # offsetTo # Translates to (x, y) without changing width and height. ##
|
| 67 | # outset() # Moves the sides symmetrically about the center. ##
|
| 68 | # quickReject # Returns true if rectangles do not intersect. ##
|
| 69 | # right() # Returns larger bounds in x, if sorted. ##
|
| 70 | # set() # Sets to (left, top, right, bottom). ##
|
| 71 | # setEmpty # Sets to (0, 0, 0, 0). ##
|
| 72 | # setLTRB # Sets to SkScalar input (left, top, right, bottom). ##
|
| 73 | # setLargest # Sets to (SK_MinS32, SK_MinS32, SK_MaxS32, SK_MaxS32). ##
|
| 74 | # setLargestInverted # Sets to (SK_MaxS32, SK_MaxS32, SK_MinS32, SK_MinS32). ##
|
| 75 | # setXYWH # Sets to (x, y, width, height). ##
|
| 76 | # size() # Returns ISize (width, height). ##
|
| 77 | # sort() # Orders sides from smaller to larger. ##
|
| 78 | # top() # Returns smaller bounds in y, if sorted. ##
|
| 79 | # width() # Returns span in x. ##
|
| 80 | # x() # Returns bounds left. ##
|
| 81 | # y() # Returns bounds top. ##
|
| 82 | #Table ##
|
| 83 | #Subtopic ##
|
| 84 |
|
| 85 | #Topic ##
|
| 86 |
|
| 87 | #Member int32_t fLeft
|
| 88 | May contain any value. The smaller of the horizontal values when sorted.
|
| 89 | When equal to or greater than fRight, IRect is empty.
|
| 90 | ##
|
| 91 |
|
| 92 | #Member int32_t fTop
|
| 93 | May contain any value. The smaller of the horizontal values when sorted.
|
| 94 | When equal to or greater than fBottom, IRect is empty.
|
| 95 | ##
|
| 96 |
|
| 97 | #Member int32_t fRight
|
| 98 | May contain any value. The larger of the vertical values when sorted.
|
| 99 | When equal to or less than fLeft, IRect is empty.
|
| 100 | ##
|
| 101 |
|
| 102 | #Member int32_t fBottom
|
| 103 | May contain any value. The larger of the vertical values when sorted.
|
| 104 | When equal to or less than fTop, IRect is empty.
|
| 105 | ##
|
| 106 |
|
| 107 | # ------------------------------------------------------------------------------
|
| 108 |
|
| 109 | #Method static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeEmpty()
|
| 110 |
|
| 111 | Returns constructed IRect set to (0, 0, 0, 0).
|
| 112 | Many other rectangles are empty; if left is equal to or greater than right,
|
| 113 | or if top is equal to or greater than bottom. Setting all members to zero
|
| 114 | is a convenience, but does not designate a special empty rectangle.
|
| 115 |
|
| 116 | #Return bounds (0, 0, 0, 0) ##
|
| 117 |
|
| 118 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 119 | SkIRect rect = SkIRect::MakeEmpty();
|
| 120 | SkDebugf("MakeEmpty isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
|
| 121 | rect.offset(10, 10);
|
| 122 | SkDebugf("offset rect isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
|
| 123 | rect.inset(10, 10);
|
| 124 | SkDebugf("inset rect isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
|
| 125 | rect.outset(20, 20);
|
| 126 | SkDebugf("outset rect isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
|
| 127 | #StdOut
|
| 128 | MakeEmpty isEmpty: true
|
| 129 | offset rect isEmpty: true
|
| 130 | inset rect isEmpty: true
|
| 131 | outset rect isEmpty: false
|
| 132 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 133 | ##
|
| 134 |
|
| 135 | #SeeAlso EmptyIRect isEmpty setEmpty setLargestInverted SkRect::MakeEmpty
|
| 136 |
|
| 137 | ##
|
| 138 |
|
| 139 | # ------------------------------------------------------------------------------
|
| 140 |
|
| 141 | #Method static SkIRect SK_WARN_UNUSED_RESULT MakeLargest()
|
| 142 |
|
| 143 | Returns constructed IRect setting left and top to most negative value, and
|
| 144 | setting right and bottom to most positive value.
|
| 145 |
|
| 146 | #Return bounds (SK_MinS32, SK_MinS32, SK_MaxS32, SK_MaxS32) ##
|
| 147 |
|
| 148 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 149 | SkIRect rect = SkIRect::MakeLargest();
|
| 150 | SkDebugf("MakeLargest isLargest: %s\n", rect.isLargest() ? "true" : "false");
|
| 151 | SkDebugf("MakeLargest isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
|
| 152 | rect.outset(1, 1);
|
| 153 | SkDebugf("outset isLargest: %s\n", rect.isLargest() ? "true" : "false");
|
| 154 | SkDebugf("outset isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
|
| 155 | #StdOut
|
| 156 | MakeLargest isLargest: true
|
| 157 | MakeLargest isEmpty: false
|
| 158 | outset isLargest: false
|
| 159 | outset isEmpty: true
|
| 160 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 161 | ##
|
| 162 |
|
| 163 | #SeeAlso isLargest setLargest SkRect::MakeLargest
|
| 164 |
|
| 165 | ##
|
| 166 |
|
| 167 | # ------------------------------------------------------------------------------
|
| 168 |
|
| 169 | #Method static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeWH(int32_t w, int32_t h)
|
| 170 |
|
| 171 | Returns constructed IRect set to (0, 0, w, h). Does not validate input; w or h
|
| 172 | may be negative.
|
| 173 |
|
| 174 | #Param w width of constructed Rect ##
|
| 175 | #Param h height of constructed Rect ##
|
| 176 |
|
| 177 | #Return bounds (0, 0, w, h) ##
|
| 178 |
|
| 179 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 180 | SkIRect rect1 = SkIRect::MakeWH(25, 35);
|
| 181 | SkIRect rect2 = SkIRect::MakeSize({25, 35});
|
| 182 | SkIRect rect3 = SkIRect::MakeXYWH(0, 0, 25, 35);
|
| 183 | SkIRect rect4 = SkIRect::MakeLTRB(0, 0, 25, 35);
|
| 184 | SkDebugf("all %s" "equal\n", rect1 == rect2 && rect2 == rect3 && rect3 == rect4 ?
|
| 185 | "" : "not ");
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 186 | #StdOut
|
| 187 | all equal
|
| 188 | ##
|
| 189 | ##
|
| 190 |
|
| 191 | #SeeAlso MakeSize MakeXYWH SkRect::MakeWH SkRect::MakeIWH
|
| 192 |
|
| 193 | ##
|
| 194 |
|
| 195 | # ------------------------------------------------------------------------------
|
| 196 |
|
| 197 | #Method static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeSize(const SkISize& size)
|
| 198 |
|
| 199 | Returns constructed IRect set to (0, 0, size.width(), size.height()).
|
| 200 | Does not validate input; size.width() or size.height() may be negative.
|
| 201 |
|
| 202 | #Param size values for Rect width and height ##
|
| 203 |
|
| 204 | #Return bounds (0, 0, size.width(), size.height()) ##
|
| 205 |
|
| 206 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 207 | SkSize size = {25.5f, 35.5f};
|
| 208 | SkIRect rect = SkIRect::MakeSize(size.toRound());
|
| 209 | SkDebugf("round width: %d height: %d\n", rect.width(), rect.height());
|
| 210 | rect = SkIRect::MakeSize(size.toFloor());
|
| 211 | SkDebugf("floor width: %d height: %d\n", rect.width(), rect.height());
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 212 | #StdOut
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 213 | round width: 26 height: 36
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 214 | floor width: 25 height: 35
|
| 215 | ##
|
| 216 | ##
|
| 217 |
|
| 218 | #SeeAlso MakeWH MakeXYWH SkRect::Make SkRect::MakeIWH
|
| 219 |
|
| 220 | ##
|
| 221 |
|
| 222 | # ------------------------------------------------------------------------------
|
| 223 |
|
| 224 | #Method static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeLTRB(int32_t l, int32_t t, int32_t r, int32_t b)
|
| 225 |
|
| 226 | Returns constructed IRect set to (l, t, r, b). Does not sort input; Rect may
|
| 227 | result in fLeft greater than fRight, or fTop greater than fBottom.
|
| 228 |
|
| 229 | #Param l integer stored in fLeft ##
|
| 230 | #Param t integer stored in fTop ##
|
| 231 | #Param r integer stored in fRight ##
|
| 232 | #Param b integer stored in fBottom ##
|
| 233 |
|
| 234 | #Return bounds (l, t, r, b) ##
|
| 235 |
|
| 236 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 237 | SkIRect rect = SkIRect::MakeLTRB(5, 35, 15, 25);
|
| 238 | SkDebugf("rect: %d, %d, %d, %d isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
|
| 239 | rect.bottom(), rect.isEmpty() ? "true" : "false");
|
| 240 | rect.sort();
|
| 241 | SkDebugf("rect: %d, %d, %d, %d isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
|
| 242 | rect.bottom(), rect.isEmpty() ? "true" : "false");
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 243 | #StdOut
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 244 | rect: 5, 35, 15, 25 isEmpty: true
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 245 | rect: 5, 25, 15, 35 isEmpty: false
|
| 246 | ##
|
| 247 | ##
|
| 248 |
|
| 249 | #SeeAlso MakeXYWH SkRect::MakeLTRB
|
| 250 |
|
| 251 | ##
|
| 252 |
|
| 253 | # ------------------------------------------------------------------------------
|
| 254 |
|
| 255 | #Method static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
|
| 256 |
|
| 257 | Returns constructed IRect set to:
|
| 258 | #Formula
|
| 259 | (x, y, x + w, y + h)
|
| 260 | ##
|
| 261 | . Does not validate input;
|
| 262 | w or h may be negative.
|
| 263 |
|
| 264 | #Param x stored in fLeft ##
|
| 265 | #Param y stored in fTop ##
|
| 266 | #Param w added to x and stored in fRight ##
|
| 267 | #Param h added to y and stored in fBottom ##
|
| 268 |
|
| 269 | #Return bounds at (x, y) with width w and height h ##
|
| 270 |
|
| 271 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 272 | SkIRect rect = SkIRect::MakeXYWH(5, 35, -15, 25);
|
| 273 | SkDebugf("rect: %d, %d, %d, %d isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
|
| 274 | rect.bottom(), rect.isEmpty() ? "true" : "false");
|
| 275 | rect.sort();
|
| 276 | SkDebugf("rect: %d, %d, %d, %d isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
|
| 277 | rect.bottom(), rect.isEmpty() ? "true" : "false");
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 278 | #StdOut
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 279 | rect: 5, 35, -10, 60 isEmpty: true
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 280 | rect: -10, 35, 5, 60 isEmpty: false
|
| 281 | ##
|
| 282 | ##
|
| 283 |
|
| 284 | #SeeAlso MakeLTRB SkRect::MakeXYWH
|
| 285 |
|
| 286 | ##
|
| 287 |
|
| 288 | # ------------------------------------------------------------------------------
|
| 289 |
|
| 290 | #Method int left() const
|
| 291 |
|
| 292 | Returns left edge of IRect, if sorted.
|
| 293 | Call sort() to reverse fLeft and fRight if needed.
|
| 294 |
|
| 295 | #Return fLeft ##
|
| 296 |
|
| 297 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 298 | SkIRect unsorted = { 15, 5, 10, 25 };
|
| 299 | SkDebugf("unsorted.fLeft: %d unsorted.left(): %d\n", unsorted.fLeft, unsorted.left());
|
| 300 | SkIRect sorted = unsorted.makeSorted();
|
| 301 | SkDebugf("sorted.fLeft: %d sorted.left(): %d\n", sorted.fLeft, sorted.left());
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 302 | #StdOut
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 303 | unsorted.fLeft: 15 unsorted.left(): 15
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 304 | sorted.fLeft: 10 sorted.left(): 10
|
| 305 | ##
|
| 306 | ##
|
| 307 |
|
| 308 | #SeeAlso fLeft x() SkRect::left()
|
| 309 |
|
| 310 | ##
|
| 311 |
|
| 312 | # ------------------------------------------------------------------------------
|
| 313 |
|
| 314 | #Method int top() const
|
| 315 |
|
| 316 | Returns top edge of IRect, if sorted. Call isEmpty to see if IRect may be invalid,
|
| 317 | and sort() to reverse fTop and fBottom if needed.
|
| 318 |
|
| 319 | #Return fTop ##
|
| 320 |
|
| 321 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 322 | SkIRect unsorted = { 15, 25, 10, 5 };
|
| 323 | SkDebugf("unsorted.fTop: %d unsorted.top(): %d\n", unsorted.fTop, unsorted.top());
|
| 324 | SkIRect sorted = unsorted.makeSorted();
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 325 | SkDebugf("sorted.fTop: %d sorted.top(): %d\n", sorted.fTop, sorted.top());
|
| 326 | #StdOut
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 327 | unsorted.fTop: 25 unsorted.top(): 25
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 328 | sorted.fTop: 5 sorted.top(): 5
|
| 329 | ##
|
| 330 | ##
|
| 331 |
|
| 332 | #SeeAlso fTop y() SkRect::top()
|
| 333 |
|
| 334 | ##
|
| 335 |
|
| 336 | # ------------------------------------------------------------------------------
|
| 337 |
|
| 338 | #Method int right() const
|
| 339 |
|
| 340 | Returns right edge of IRect, if sorted.
|
| 341 | Call sort() to reverse fLeft and fRight if needed.
|
| 342 |
|
| 343 | #Return fRight ##
|
| 344 |
|
| 345 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 346 | SkIRect unsorted = { 15, 25, 10, 5 };
|
| 347 | SkDebugf("unsorted.fRight: %d unsorted.right(): %d\n", unsorted.fRight, unsorted.right());
|
| 348 | SkIRect sorted = unsorted.makeSorted();
|
| 349 | SkDebugf("sorted.fRight: %d sorted.right(): %d\n", sorted.fRight, sorted.right());
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 350 | #StdOut
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 351 | unsorted.fRight: 10 unsorted.right(): 10
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 352 | sorted.fRight: 15 sorted.right(): 15
|
| 353 | ##
|
| 354 | ##
|
| 355 |
|
| 356 | #SeeAlso fRight SkRect::right()
|
| 357 |
|
| 358 | ##
|
| 359 |
|
| 360 | # ------------------------------------------------------------------------------
|
| 361 |
|
| 362 | #Method int bottom() const
|
| 363 |
|
| 364 | Returns bottom edge of IRect, if sorted. Call isEmpty to see if IRect may be invalid,
|
| 365 | and sort() to reverse fTop and fBottom if needed.
|
| 366 |
|
| 367 | #Return fBottom ##
|
| 368 |
|
| 369 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 370 | SkIRect unsorted = { 15, 25, 10, 5 };
|
| 371 | SkDebugf("unsorted.fBottom: %d unsorted.bottom(): %d\n", unsorted.fBottom, unsorted.bottom());
|
| 372 | SkIRect sorted = unsorted.makeSorted();
|
| 373 | SkDebugf("sorted.fBottom: %d sorted.bottom(): %d\n", sorted.fBottom, sorted.bottom());
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 374 | #StdOut
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 375 | unsorted.fBottom: 5 unsorted.bottom(): 5
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 376 | sorted.fBottom: 25 sorted.bottom(): 25
|
| 377 | ##
|
| 378 | ##
|
| 379 |
|
| 380 | #SeeAlso fBottom SkRect::bottom()
|
| 381 |
|
| 382 | ##
|
| 383 |
|
| 384 | # ------------------------------------------------------------------------------
|
| 385 |
|
| 386 | #Method int x() const
|
| 387 |
|
| 388 | Returns left edge of IRect, if sorted. Call isEmpty to see if IRect may be invalid,
|
| 389 | and sort() to reverse fLeft and fRight if needed.
|
| 390 |
|
| 391 | #Return fLeft ##
|
| 392 |
|
| 393 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 394 | SkIRect unsorted = { 15, 5, 10, 25 };
|
| 395 | SkDebugf("unsorted.fLeft: %d unsorted.x(): %d\n", unsorted.fLeft, unsorted.x());
|
| 396 | SkIRect sorted = unsorted.makeSorted();
|
| 397 | SkDebugf("sorted.fLeft: %d sorted.x(): %d\n", sorted.fLeft, sorted.x());
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 398 | #StdOut
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 399 | unsorted.fLeft: 15 unsorted.x(): 15
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 400 | sorted.fLeft: 10 sorted.x(): 10
|
| 401 | ##
|
| 402 | ##
|
| 403 |
|
| 404 | #SeeAlso fLeft left() y() SkRect::x()
|
| 405 |
|
| 406 | ##
|
| 407 |
|
| 408 | # ------------------------------------------------------------------------------
|
| 409 |
|
| 410 | #Method int y() const
|
| 411 |
|
| 412 | Returns top edge of IRect, if sorted. Call isEmpty to see if IRect may be invalid,
|
| 413 | and sort() to reverse fTop and fBottom if needed.
|
| 414 |
|
| 415 | #Return fTop ##
|
| 416 |
|
| 417 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 418 | SkIRect unsorted = { 15, 25, 10, 5 };
|
| 419 | SkDebugf("unsorted.fTop: %d unsorted.y(): %d\n", unsorted.fTop, unsorted.y());
|
| 420 | SkIRect sorted = unsorted.makeSorted();
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 421 | SkDebugf("sorted.fTop: %d sorted.y(): %d\n", sorted.fTop, sorted.y());
|
| 422 | #StdOut
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 423 | unsorted.fTop: 25 unsorted.y(): 25
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 424 | sorted.fTop: 5 sorted.y(): 5
|
| 425 | ##
|
| 426 | ##
|
| 427 |
|
| 428 | #SeeAlso fTop top() x() SkRect::y()
|
| 429 |
|
| 430 | ##
|
| 431 |
|
| 432 | # ------------------------------------------------------------------------------
|
| 433 |
|
| 434 | #Method int width() const
|
| 435 |
|
| 436 | Returns span on the x-axis. This does not check if IRect is sorted, or if
|
| 437 | result fits in 32-bit signed integer; result may be negative.
|
| 438 |
|
| 439 | #Return fRight minus fLeft ##
|
| 440 |
|
| 441 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 442 | SkIRect unsorted = { 15, 25, 10, 5 };
|
| 443 | SkDebugf("unsorted width: %d\n", unsorted.width());
|
| 444 | SkIRect large = { -2147483647, 1, 2147483644, 2 };
|
| 445 | SkDebugf("large width: %d\n", large.width());
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 446 | #StdOut
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 447 | unsorted width: -5
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 448 | large width: -5
|
| 449 | ##
|
| 450 | ##
|
| 451 |
|
| 452 | #SeeAlso height() SkRect::width()
|
| 453 |
|
| 454 | ##
|
| 455 |
|
| 456 | # ------------------------------------------------------------------------------
|
| 457 |
|
| 458 | #Method int height() const
|
| 459 |
|
| 460 | Returns span on the y-axis. This does not check if IRect is sorted, or if
|
| 461 | result fits in 32-bit signed integer; result may be negative.
|
| 462 |
|
| 463 | #Return fBottom minus fTop ##
|
| 464 |
|
| 465 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 466 | SkIRect unsorted = { 15, 25, 10, 20 };
|
| 467 | SkDebugf("unsorted height: %d\n", unsorted.height());
|
| 468 | SkIRect large = { 1, -2147483647, 2, 2147483644 };
|
| 469 | SkDebugf("large height: %d\n", large.height());
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 470 | #StdOut
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 471 | unsorted height: -5
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 472 | large height: -5
|
| 473 | ##
|
| 474 | ##
|
| 475 |
|
| 476 | #SeeAlso width() SkRect::height()
|
| 477 |
|
| 478 | ##
|
| 479 |
|
| 480 | # ------------------------------------------------------------------------------
|
| 481 |
|
| 482 | #Method SkISize size() const
|
| 483 |
|
| 484 | Returns spans on the x-axis and y-axis. This does not check if IRect is sorted,
|
| 485 | or if result fits in 32-bit signed integer; result may be negative.
|
| 486 |
|
| 487 | #Return ISize (width, height) ##
|
| 488 |
|
| 489 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 490 | auto debugster = [](const char* prefix, const SkIRect& rect) -> void {
|
| 491 | SkISize size = rect.size();
|
| 492 | SkDebugf("%s ", prefix);
|
| 493 | SkDebugf("rect: %d, %d, %d, %d ", rect.left(), rect.top(), rect.right(), rect.bottom());
|
| 494 | SkDebugf("size: %d, %d\n", size.width(), size.height());
|
| 495 | };
|
| 496 | SkIRect rect = {20, 30, 40, 50};
|
| 497 | debugster("original", rect);
|
| 498 | rect.offset(20, 20);
|
| 499 | debugster(" offset", rect);
|
| 500 | rect.outset(20, 20);
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 501 | debugster(" outset", rect);
|
| 502 | #StdOut
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 503 | original rect: 20, 30, 40, 50 size: 20, 20
|
| 504 | offset rect: 40, 50, 60, 70 size: 20, 20
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 505 | outset rect: 20, 30, 80, 90 size: 60, 60
|
| 506 | ##
|
| 507 | ##
|
| 508 |
|
| 509 | #SeeAlso height() width() MakeSize
|
| 510 |
|
| 511 | ##
|
| 512 |
|
| 513 | # ------------------------------------------------------------------------------
|
| 514 |
|
| 515 | #Method int centerX() const
|
| 516 |
|
| 517 | Returns average of left edge and right edge. Result does not change if Rect
|
| 518 | is sorted. Result may be incorrect if Rect is far from the origin.
|
| 519 |
|
| 520 | Result is rounded down.
|
| 521 |
|
| 522 | #Return midpoint in x ##
|
| 523 |
|
| 524 | #Example
|
| 525 | #Description
|
| 526 | Dividing by two rounds towards zero. centerX uses a bit shift and rounds down.
|
| 527 | ##
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 528 | SkIRect tests[] = {{20, 30, 41, 51}, {-20, -30, -41, -51}, {-10, -10, 11, 11}};
|
| 529 | for (auto rect : tests) {
|
| 530 | SkDebugf("left: %3d right: %3d centerX: %3d ", rect.left(), rect.right(), rect.centerX());
|
| 531 | SkDebugf("div2: %3d\n", (rect.left() + rect.right()) / 2);
|
| 532 | }
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 533 | #StdOut
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 534 | left: 20 right: 41 centerX: 30 div2: 30
|
| 535 | left: -20 right: -41 centerX: -31 div2: -30
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 536 | left: -10 right: 11 centerX: 0 div2: 0
|
| 537 | ##
|
| 538 | ##
|
| 539 |
|
| 540 | #SeeAlso centerY SkRect::centerX
|
| 541 |
|
| 542 | ##
|
| 543 |
|
| 544 | # ------------------------------------------------------------------------------
|
| 545 |
|
| 546 | #Method int centerY() const
|
| 547 |
|
| 548 | Returns average of top edge and bottom edge. Result does not change if Rect
|
| 549 | is sorted. Result may be incorrect if Rect is far from the origin.
|
| 550 |
|
| 551 | Result is rounded down.
|
| 552 |
|
| 553 | #Return midpoint in y ##
|
| 554 |
|
| 555 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 556 | SkIRect rect = { 0, 0, 2, 2 };
|
| 557 | rect.offset(0x40000000, 0x40000000);
|
| 558 | SkDebugf("left: %d right: %d centerX: %d ", rect.left(), rect.right(), rect.centerX());
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 559 | SkDebugf("safe mid x: %d\n", rect.left() / 2 + rect.right() / 2);
|
| 560 | #StdOut
|
| 561 | left: 1073741824 right: 1073741826 centerX: -1073741823 safe mid x: 1073741825
|
| 562 | ##
|
| 563 | ##
|
| 564 |
|
| 565 | #SeeAlso centerX SkRect::centerY
|
| 566 |
|
| 567 | ##
|
| 568 |
|
| 569 | # ------------------------------------------------------------------------------
|
| 570 |
|
| 571 | #Method bool isEmpty() const
|
| 572 |
|
| 573 | Returns true if fLeft is equal to or greater than fRight, or if fTop is equal
|
| 574 | to or greater than fBottom. Call sort() to reverse rectangles with negative
|
| 575 | width() or height().
|
| 576 |
|
| 577 | #Return true if width() or height() are zero or negative ##
|
| 578 |
|
| 579 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 580 | SkIRect tests[] = {{20, 40, 10, 50}, {20, 40, 20, 50}};
|
| 581 | for (auto rect : tests) {
|
| 582 | SkDebugf("rect: {%d, %d, %d, %d} is" "%s empty\n", rect.left(), rect.top(), rect.right(),
|
| 583 | rect.bottom(), rect.isEmpty() ? "" : " not");
|
| 584 | rect.sort();
|
| 585 | SkDebugf("sorted: {%d, %d, %d, %d} is" "%s empty\n", rect.left(), rect.top(), rect.right(),
|
| 586 | rect.bottom(), rect.isEmpty() ? "" : " not");
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 587 | }
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 588 | #StdOut
|
| 589 | rect: {20, 40, 10, 50} is empty
|
| 590 | sorted: {10, 40, 20, 50} is not empty
|
| 591 | rect: {20, 40, 20, 50} is empty
|
| 592 | sorted: {20, 40, 20, 50} is empty
|
| 593 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 594 | ##
|
| 595 |
|
| 596 | #SeeAlso EmptyIRect MakeEmpty sort SkRect::isEmpty
|
| 597 |
|
| 598 | ##
|
| 599 |
|
| 600 | # ------------------------------------------------------------------------------
|
| 601 |
|
| 602 | #Method bool isLargest() const
|
| 603 |
|
| 604 | Returns true if IRect encloses largest possible area.
|
| 605 |
|
| 606 | #Return true if equal to (SK_MinS32, SK_MinS32, SK_MaxS32, SK_MaxS32) ##
|
| 607 |
|
| 608 | #Example
|
| 609 | #Description
|
| 610 | Note that the width is not negative, yet it cannot be represented as a 32-bit
|
| 611 | signed integer.
|
| 612 | ##
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 613 | SkIRect large = SkIRect::MakeLargest();
|
| 614 | SkDebugf("large is largest: %s\n" ,large.isLargest() ? "true" : "false");
|
| 615 | SkDebugf("large width %d\n", large.width());
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 616 | SkDebugf("large is empty: %s\n", large.isEmpty() ? "true" : "false");
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 617 | #StdOut
|
| 618 | large is largest: true
|
| 619 | large width -2
|
| 620 | large is empty: false
|
| 621 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 622 | ##
|
| 623 |
|
| 624 | #SeeAlso MakeLargest SkRect::isLargest
|
| 625 |
|
| 626 | ##
|
| 627 |
|
| 628 | # ------------------------------------------------------------------------------
|
| 629 |
|
| 630 | #Method bool operator==(const SkIRect& a, const SkIRect& b)
|
| 631 |
|
| 632 | Returns true if all members in a: fLeft, fTop, fRight, and fBottom; are
|
| 633 | identical to corresponding members in b.
|
| 634 |
|
| 635 | #Param a IRect to compare ##
|
| 636 | #Param b IRect to compare ##
|
| 637 |
|
| 638 | #Return true if members are equal ##
|
| 639 |
|
| 640 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 641 | SkIRect test = {0, 0, 2, 2};
|
| 642 | SkIRect sorted = test.makeSorted();
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 643 | SkDebugf("test %c= sorted\n", test == sorted ? '=' : '!');
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 644 | #StdOut
|
| 645 | test == sorted
|
| 646 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 647 | ##
|
| 648 |
|
| 649 | #SeeAlso operator!=(const SkIRect& a, const SkIRect& b)
|
| 650 |
|
| 651 | ##
|
| 652 |
|
| 653 | # ------------------------------------------------------------------------------
|
| 654 |
|
| 655 | #Method bool operator!=(const SkIRect& a, const SkIRect& b)
|
| 656 |
|
| 657 | Returns true if any member in a: fLeft, fTop, fRight, and fBottom; is not
|
| 658 | identical to the corresponding member in b.
|
| 659 |
|
| 660 | #Param a IRect to compare ##
|
| 661 | #Param b IRect to compare ##
|
| 662 |
|
| 663 | #Return true if members are not equal ##
|
| 664 |
|
| 665 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 666 | SkIRect test = {2, 2, 0, 0};
|
| 667 | SkIRect sorted = test.makeSorted();
|
| 668 | SkDebugf("test %c= sorted\n", test != sorted ? '!' : '=');
|
| 669 | #StdOut
|
| 670 | test != sorted
|
| 671 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 672 | ##
|
| 673 |
|
| 674 | #SeeAlso operator==(const SkIRect& a, const SkIRect& b)
|
| 675 |
|
| 676 | ##
|
| 677 |
|
| 678 | # ------------------------------------------------------------------------------
|
| 679 |
|
| 680 | #Method bool is16Bit() const
|
| 681 |
|
| 682 | Returns true if all members: fLeft, fTop, fRight, and fBottom; values are
|
| 683 | equal to or larger than -32768 and equal to or smaller than 32767.
|
| 684 |
|
| 685 | #Return true if members fit in 16-bit word ##
|
| 686 |
|
| 687 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 688 | SkIRect tests[] = {{-32768, -32768, 32767, 32767}, {-32768, -32768, 32768, 32768}};
|
| 689 | for (auto rect : tests) {
|
| 690 | SkDebugf("{%d, %d, %d, %d} %s in 16 bits\n", rect.fLeft, rect.fTop, rect.fRight,
|
| 691 | rect.fBottom, rect.is16Bit() ? "fits" : "does not fit");
|
| 692 | }
|
| 693 | #StdOut
|
| 694 | {-32768, -32768, 32767, 32767} fits in 16 bits
|
| 695 | {-32768, -32768, 32768, 32768} does not fit in 16 bits
|
| 696 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 697 | ##
|
| 698 |
|
| 699 | #SeeAlso SkTFitsIn
|
| 700 |
|
| 701 | ##
|
| 702 |
|
| 703 | # ------------------------------------------------------------------------------
|
| 704 |
|
| 705 | #Method void setEmpty()
|
| 706 |
|
| 707 | Sets IRect to (0, 0, 0, 0).
|
| 708 |
|
| 709 | Many other rectangles are empty; if left is equal to or greater than right,
|
| 710 | or if top is equal to or greater than bottom. Setting all members to zero
|
| 711 | is a convenience, but does not designate a special empty rectangle.
|
| 712 |
|
| 713 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 714 | SkIRect rect = {3, 4, 1, 2};
|
| 715 | for (int i = 0; i < 2; ++i) {
|
| 716 | SkDebugf("rect: {%d, %d, %d, %d} is %s" "empty\n", rect.fLeft, rect.fTop,
|
| 717 | rect.fRight, rect.fBottom, rect.isEmpty() ? "" : "not ");
|
| 718 | rect.setEmpty();
|
| 719 | }
|
| 720 | #StdOut
|
| 721 | rect: {3, 4, 1, 2} is empty
|
| 722 | rect: {0, 0, 0, 0} is empty
|
| 723 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 724 | ##
|
| 725 |
|
| 726 | #SeeAlso MakeEmpty SkRect::setEmpty
|
| 727 |
|
| 728 | ##
|
| 729 |
|
| 730 | # ------------------------------------------------------------------------------
|
| 731 |
|
| 732 | #Method void set(int32_t left, int32_t top, int32_t right, int32_t bottom)
|
| 733 |
|
| 734 | Sets IRect to (left, top, right, bottom).
|
| 735 | left and right are not sorted; left is not necessarily less than right.
|
| 736 | top and bottom are not sorted; top is not necessarily less than bottom.
|
| 737 |
|
| 738 | #Param left assigned to fLeft ##
|
| 739 | #Param top assigned to fTop ##
|
| 740 | #Param right assigned to fRight ##
|
| 741 | #Param bottom assigned to fBottom ##
|
| 742 |
|
| 743 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 744 | SkIRect rect1 = {3, 4, 1, 2};
|
| 745 | SkDebugf("rect1: {%d, %d, %d, %d}\n", rect1.fLeft, rect1.fTop, rect1.fRight, rect1.fBottom);
|
| 746 | SkIRect rect2;
|
| 747 | rect2.set(3, 4, 1, 2);
|
| 748 | SkDebugf("rect2: {%d, %d, %d, %d}\n", rect2.fLeft, rect2.fTop, rect2.fRight, rect2.fBottom);
|
| 749 | #StdOut
|
| 750 | rect1: {3, 4, 1, 2}
|
| 751 | rect2: {3, 4, 1, 2}
|
| 752 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 753 | ##
|
| 754 |
|
| 755 | #SeeAlso setLTRB setXYWH SkRect::set
|
| 756 |
|
| 757 | ##
|
| 758 |
|
| 759 | # ------------------------------------------------------------------------------
|
| 760 |
|
| 761 | #Method void setLTRB(int32_t left, int32_t top, int32_t right, int32_t bottom)
|
| 762 |
|
| 763 | Sets IRect to (left, top, right, bottom).
|
| 764 | left and right are not sorted; left is not necessarily less than right.
|
| 765 | top and bottom are not sorted; top is not necessarily less than bottom.
|
| 766 |
|
| 767 | #Param left stored in fLeft ##
|
| 768 | #Param top stored in fTop ##
|
| 769 | #Param right stored in fRight ##
|
| 770 | #Param bottom stored in fBottom ##
|
| 771 |
|
| 772 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 773 | SkIRect rect1 = {3, 4, 1, 2};
|
| 774 | SkDebugf("rect1: {%d, %d, %d, %d}\n", rect1.fLeft, rect1.fTop, rect1.fRight, rect1.fBottom);
|
| 775 | SkIRect rect2;
|
| 776 | rect2.setLTRB(3, 4, 1, 2);
|
| 777 | SkDebugf("rect2: {%d, %d, %d, %d}\n", rect2.fLeft, rect2.fTop, rect2.fRight, rect2.fBottom);
|
| 778 | #StdOut
|
| 779 | rect1: {3, 4, 1, 2}
|
| 780 | rect2: {3, 4, 1, 2}
|
| 781 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 782 | ##
|
| 783 |
|
| 784 | #SeeAlso set setXYWH SkRect::setLTRB
|
| 785 |
|
| 786 | ##
|
| 787 |
|
| 788 | # ------------------------------------------------------------------------------
|
| 789 |
|
| 790 | #Method void setXYWH(int32_t x, int32_t y, int32_t width, int32_t height)
|
| 791 |
|
| 792 | Sets IRect to:
|
| 793 | #Formula
|
| 794 | (x, y, x + width, y + height)
|
| 795 | ##
|
| 796 | . Does not validate input;
|
| 797 | width or height may be negative.
|
| 798 |
|
| 799 | #Param x stored in fLeft ##
|
| 800 | #Param y stored in fTop ##
|
| 801 | #Param width added to x and stored in fRight ##
|
| 802 | #Param height added to y and stored in fBottom ##
|
| 803 |
|
| 804 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 805 | SkIRect rect;
|
| 806 | rect.setXYWH(5, 35, -15, 25);
|
| 807 | SkDebugf("rect: %d, %d, %d, %d isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
|
| 808 | rect.bottom(), rect.isEmpty() ? "true" : "false");
|
| 809 | rect.sort();
|
| 810 | SkDebugf("rect: %d, %d, %d, %d isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
|
| 811 | rect.bottom(), rect.isEmpty() ? "true" : "false");
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 812 | #StdOut
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 813 | rect: 5, 35, -10, 60 isEmpty: true
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 814 | rect: -10, 35, 5, 60 isEmpty: false
|
| 815 | ##
|
| 816 | ##
|
| 817 |
|
| 818 | #SeeAlso MakeXYWH setLTRB set SkRect::setXYWH
|
| 819 |
|
| 820 | ##
|
| 821 |
|
| 822 | # ------------------------------------------------------------------------------
|
| 823 |
|
| 824 | #Method void setLargest()
|
| 825 |
|
| 826 | Sets rectangle left and top to most negative value, and sets
|
| 827 | right and bottom to most positive value.
|
| 828 |
|
| 829 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 830 | SkIRect rect;
|
| 831 | rect.setLargest();
|
| 832 | SkDebugf("MakeLargest isLargest: %s\n", rect.isLargest() ? "true" : "false");
|
| 833 | SkDebugf("MakeLargest isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
|
| 834 | rect.outset(1, 1);
|
| 835 | SkDebugf("outset isLargest: %s\n", rect.isLargest() ? "true" : "false");
|
| 836 | SkDebugf("outset isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
|
| 837 | #StdOut
|
| 838 | MakeLargest isLargest: true
|
| 839 | MakeLargest isEmpty: false
|
| 840 | outset isLargest: false
|
| 841 | outset isEmpty: true
|
| 842 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 843 | ##
|
| 844 |
|
| 845 | #SeeAlso MakeLargest isLargest setLargestInverted SK_MinS32 SK_MaxS32
|
| 846 |
|
| 847 | ##
|
| 848 |
|
| 849 | # ------------------------------------------------------------------------------
|
| 850 |
|
| 851 | #Method void setLargestInverted()
|
| 852 | #ToDo move this to private
|
| 853 | ##
|
| 854 |
|
| 855 | Sets rectangle left and top to most positive value, and sets
|
| 856 | right and bottom to most negative value. This is used internally to
|
| 857 | flag that a condition is met, but otherwise has no special purpose.
|
| 858 |
|
| 859 | #NoExample
|
| 860 | ##
|
| 861 |
|
| 862 | #SeeAlso setEmpty setLargest
|
| 863 |
|
| 864 | ##
|
| 865 |
|
| 866 | # ------------------------------------------------------------------------------
|
| 867 |
|
| 868 | #Method SkIRect makeOffset(int32_t dx, int32_t dy) const
|
| 869 |
|
| 870 | Returns IRect offset by (dx, dy).
|
| 871 |
|
| 872 | If dx is negative, IRect returned is moved to the left.
|
| 873 | If dx is positive, IRect returned is moved to the right.
|
| 874 | If dy is negative, IRect returned is moved upward.
|
| 875 | If dy is positive, IRect returned is moved downward.
|
| 876 |
|
| 877 | #Param dx offset added to fLeft and fRight ##
|
| 878 | #Param dy offset added to fTop and fBottom ##
|
| 879 |
|
| 880 | #Return Rect offset in x or y, with original width and height ##
|
| 881 |
|
| 882 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 883 | SkIRect rect = { 10, 50, 20, 60 };
|
| 884 | SkDebugf("rect: %d, %d, %d, %d isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
|
| 885 | rect.bottom(), rect.isEmpty() ? "true" : "false");
|
| 886 | rect = rect.makeOffset(15, 32);
|
| 887 | SkDebugf("rect: %d, %d, %d, %d isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
|
| 888 | rect.bottom(), rect.isEmpty() ? "true" : "false");
|
| 889 | #StdOut
|
| 890 | rect: 10, 50, 20, 60 isEmpty: false
|
| 891 | rect: 25, 82, 35, 92 isEmpty: false
|
| 892 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 893 | ##
|
| 894 |
|
| 895 | #SeeAlso offset() makeInset makeOutset SkRect::makeOffset
|
| 896 |
|
| 897 | ##
|
| 898 |
|
| 899 | # ------------------------------------------------------------------------------
|
| 900 |
|
| 901 | #Method SkIRect makeInset(int32_t dx, int32_t dy) const
|
| 902 |
|
| 903 | Returns IRect, inset by (dx, dy).
|
| 904 |
|
| 905 | If dx is negative, IRect returned is wider.
|
| 906 | If dx is positive, IRect returned is narrower.
|
| 907 | If dy is negative, IRect returned is taller.
|
| 908 | If dy is positive, IRect returned is shorter.
|
| 909 |
|
| 910 | #Param dx offset added to fLeft and subtracted from fRight ##
|
| 911 | #Param dy offset added to fTop and subtracted from fBottom ##
|
| 912 |
|
| 913 | #Return Rect inset symmetrically left and right, top and bottom ##
|
| 914 |
|
| 915 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 916 | SkIRect rect = { 10, 50, 20, 60 };
|
| 917 | SkDebugf("rect: %d, %d, %d, %d isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
|
| 918 | rect.bottom(), rect.isEmpty() ? "true" : "false");
|
| 919 | rect = rect.makeInset(15, 32);
|
| 920 | SkDebugf("rect: %d, %d, %d, %d isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
|
| 921 | rect.bottom(), rect.isEmpty() ? "true" : "false");
|
| 922 | #StdOut
|
| 923 | rect: 10, 50, 20, 60 isEmpty: false
|
| 924 | rect: 25, 82, 5, 28 isEmpty: true
|
| 925 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 926 | ##
|
| 927 |
|
| 928 | #SeeAlso inset() makeOffset makeOutset SkRect::makeInset
|
| 929 |
|
| 930 | ##
|
| 931 |
|
| 932 | # ------------------------------------------------------------------------------
|
| 933 |
|
| 934 | #Method SkIRect makeOutset(int32_t dx, int32_t dy) const
|
| 935 |
|
| 936 | Returns IRect, outset by (dx, dy).
|
| 937 |
|
| 938 | If dx is negative, IRect returned is narrower.
|
| 939 | If dx is positive, IRect returned is wider.
|
| 940 | If dy is negative, IRect returned is shorter.
|
| 941 | If dy is positive, IRect returned is taller.
|
| 942 |
|
| 943 | #Param dx offset subtracted to fLeft and added from fRight ##
|
| 944 | #Param dy offset subtracted to fTop and added from fBottom ##
|
| 945 |
|
| 946 | #Return Rect outset symmetrically left and right, top and bottom ##
|
| 947 |
|
| 948 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 949 | SkIRect rect = { 10, 50, 20, 60 };
|
| 950 | SkDebugf("rect: %d, %d, %d, %d isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
|
| 951 | rect.bottom(), rect.isEmpty() ? "true" : "false");
|
| 952 | rect = rect.makeOutset(15, 32);
|
| 953 | SkDebugf("rect: %d, %d, %d, %d isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
|
| 954 | rect.bottom(), rect.isEmpty() ? "true" : "false");
|
| 955 | #StdOut
|
| 956 | rect: 10, 50, 20, 60 isEmpty: false
|
| 957 | rect: -5, 18, 35, 92 isEmpty: false
|
| 958 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 959 | ##
|
| 960 |
|
| 961 | #SeeAlso outset() makeOffset makeInset SkRect::makeOutset
|
| 962 |
|
| 963 | ##
|
| 964 |
|
| 965 | # ------------------------------------------------------------------------------
|
| 966 |
|
| 967 | #Method void offset(int32_t dx, int32_t dy)
|
| 968 |
|
| 969 | Offsets IRect by adding dx to fLeft, fRight; and by adding dy to fTop, fBottom.
|
| 970 |
|
| 971 | If dx is negative, moves IRect returned to the left.
|
| 972 | If dx is positive, moves IRect returned to the right.
|
| 973 | If dy is negative, moves IRect returned upward.
|
| 974 | If dy is positive, moves IRect returned downward.
|
| 975 |
|
| 976 | #Param dx offset added to fLeft and fRight ##
|
| 977 | #Param dy offset added to fTop and fBottom ##
|
| 978 |
|
| 979 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 980 | SkIRect rect = { 10, 14, 50, 73 };
|
| 981 | rect.offset(5, 13);
|
| 982 | SkDebugf("rect: %d, %d, %d, %d\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
|
| 983 | #StdOut
|
| 984 | rect: 15, 27, 55, 86
|
| 985 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 986 | ##
|
| 987 |
|
| 988 | #SeeAlso offsetTo makeOffset SkRect::offset
|
| 989 |
|
| 990 | ##
|
| 991 |
|
| 992 | # ------------------------------------------------------------------------------
|
| 993 |
|
| 994 | #Method void offset(const SkIPoint& delta)
|
| 995 |
|
| 996 | Offsets IRect by adding delta.fX to fLeft, fRight; and by adding delta.fY to
|
| 997 | fTop, fBottom.
|
| 998 |
|
| 999 | If delta.fX is negative, moves IRect returned to the left.
|
| 1000 | If delta.fX is positive, moves IRect returned to the right.
|
| 1001 | If delta.fY is negative, moves IRect returned upward.
|
| 1002 | If delta.fY is positive, moves IRect returned downward.
|
| 1003 |
|
| 1004 | #Param delta offset added to IRect ##
|
| 1005 |
|
| 1006 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1007 | SkIRect rect = { 10, 14, 50, 73 };
|
| 1008 | rect.offset({5, 13});
|
| 1009 | SkDebugf("rect: %d, %d, %d, %d\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
|
| 1010 | #StdOut
|
| 1011 | rect: 15, 27, 55, 86
|
| 1012 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1013 | ##
|
| 1014 |
|
| 1015 | #SeeAlso offsetTo makeOffset SkRect::offset
|
| 1016 |
|
| 1017 | ##
|
| 1018 |
|
| 1019 | # ------------------------------------------------------------------------------
|
| 1020 |
|
| 1021 | #Method void offsetTo(int32_t newX, int32_t newY)
|
| 1022 |
|
| 1023 | Offsets IRect so that fLeft equals newX, and fTop equals newY. width and height
|
| 1024 | are unchanged.
|
| 1025 |
|
| 1026 | #Param newX stored in fLeft, preserving width() ##
|
| 1027 | #Param newY stored in fTop, preserving height() ##
|
| 1028 |
|
| 1029 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1030 | SkIRect rect = { 10, 14, 50, 73 };
|
| 1031 | rect.offsetTo(15, 27);
|
| 1032 | SkDebugf("rect: %d, %d, %d, %d\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
|
| 1033 | #StdOut
|
| 1034 | rect: 15, 27, 55, 86
|
| 1035 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1036 | ##
|
| 1037 |
|
| 1038 | #SeeAlso offset makeOffset setXYWH SkRect::offsetTo
|
| 1039 |
|
| 1040 | ##
|
| 1041 |
|
| 1042 | # ------------------------------------------------------------------------------
|
| 1043 |
|
| 1044 | #Method void inset(int32_t dx, int32_t dy)
|
| 1045 |
|
| 1046 | Insets IRect by (dx,dy).
|
| 1047 |
|
| 1048 | If dx is positive, makes IRect narrower.
|
| 1049 | If dx is negative, makes IRect wider.
|
| 1050 | If dy is positive, makes IRect shorter.
|
| 1051 | If dy is negative, makes IRect taller.
|
| 1052 |
|
| 1053 | #Param dx offset added to fLeft and subtracted from fRight ##
|
| 1054 | #Param dy offset added to fTop and subtracted from fBottom ##
|
| 1055 |
|
| 1056 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1057 | SkIRect rect = { 10, 14, 50, 73 };
|
| 1058 | rect.inset(5, 13);
|
| 1059 | SkDebugf("rect: %d, %d, %d, %d\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
|
| 1060 | #StdOut
|
| 1061 | rect: 15, 27, 45, 60
|
| 1062 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1063 | ##
|
| 1064 |
|
| 1065 | #SeeAlso outset makeInset SkRect::inset
|
| 1066 |
|
| 1067 | ##
|
| 1068 |
|
| 1069 | # ------------------------------------------------------------------------------
|
| 1070 |
|
| 1071 | #Method void outset(int32_t dx, int32_t dy)
|
| 1072 |
|
| 1073 | Outsets IRect by (dx, dy).
|
| 1074 |
|
| 1075 | If dx is positive, makes Rect wider.
|
| 1076 | If dx is negative, makes Rect narrower.
|
| 1077 | If dy is positive, makes Rect taller.
|
| 1078 | If dy is negative, makes Rect shorter.
|
| 1079 |
|
| 1080 | #Param dx subtracted to fLeft and added from fRight ##
|
| 1081 | #Param dy subtracted to fTop and added from fBottom ##
|
| 1082 |
|
| 1083 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1084 | SkIRect rect = { 10, 14, 50, 73 };
|
| 1085 | rect.outset(5, 13);
|
| 1086 | SkDebugf("rect: %d, %d, %d, %d\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
|
| 1087 | #StdOut
|
| 1088 | rect: 5, 1, 55, 86
|
| 1089 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1090 | ##
|
| 1091 |
|
| 1092 | #SeeAlso inset makeOutset SkRect::outset
|
| 1093 |
|
| 1094 | ##
|
| 1095 |
|
| 1096 | # ------------------------------------------------------------------------------
|
| 1097 |
|
| 1098 | #Method bool quickReject(int l, int t, int r, int b) const
|
| 1099 |
|
| 1100 | Constructs IRect (l, t, r, b) and returns true if constructed IRect does not
|
| 1101 | intersect IRect. Does not check to see if construction or IRect is empty.
|
| 1102 |
|
| 1103 | Is implemented with short circuit logic so that true can be returned after
|
| 1104 | a single compare.
|
| 1105 |
|
| 1106 | #Param l x minimum of constructed Rect ##
|
| 1107 | #Param t y minimum of constructed Rect ##
|
| 1108 | #Param r x maximum of constructed Rect ##
|
| 1109 | #Param b y maximum of constructed Rect ##
|
| 1110 |
|
| 1111 | #Return true if construction and IRect have no area in common ##
|
| 1112 |
|
| 1113 | #Example
|
| 1114 | #Description
|
| 1115 | quickReject is the complement of Intersects.
|
| 1116 | ##
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1117 | const SkIRect rect = {7, 11, 13, 17};
|
| 1118 | const int32_t* r = &rect.fLeft;
|
| 1119 | const SkIRect tests[] = { {13, 11, 15, 17}, { 7, 7, 13, 11 }, { 12, 16, 14, 18 } };
|
| 1120 | for (auto& test : tests) {
|
| 1121 | const int32_t* t = &test.fLeft;
|
| 1122 | SkDebugf("rect (%d, %d, %d, %d) test(%d, %d, %d, %d) quickReject %s; intersects %s\n",
|
| 1123 | r[0], r[1], r[2], r[3], t[0], t[1], t[2], t[3],
|
| 1124 | rect.quickReject(t[0], t[1], t[2], t[3]) ? "true" : "false",
|
| 1125 | SkIRect::Intersects(rect, test) ? "true" : "false");
|
| 1126 | }
|
| 1127 | #StdOut
|
| 1128 | rect (7, 11, 13, 17) test(13, 11, 15, 17) quickReject true; intersects false
|
| 1129 | rect (7, 11, 13, 17) test(7, 7, 13, 11) quickReject true; intersects false
|
| 1130 | rect (7, 11, 13, 17) test(12, 16, 14, 18) quickReject false; intersects true
|
| 1131 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1132 | ##
|
| 1133 |
|
| 1134 | #SeeAlso Intersects
|
| 1135 |
|
| 1136 | ##
|
| 1137 |
|
| 1138 | # ------------------------------------------------------------------------------
|
| 1139 |
|
| 1140 | #Method bool contains(int32_t x, int32_t y) const
|
| 1141 |
|
| 1142 | Returns true if:
|
| 1143 | #Formula
|
| 1144 | fLeft <= x < fRight && fTop <= y < fBottom
|
| 1145 | ##
|
| 1146 | .
|
| 1147 | Returns false if Rect is empty.
|
| 1148 |
|
| 1149 | Considers input to describe constructed IRect:
|
| 1150 | #Formula
|
| 1151 | (x, y, x + 1, y + 1)
|
| 1152 | ##
|
| 1153 | and
|
| 1154 | returns true if constructed area is completely enclosed by IRect area.
|
| 1155 |
|
| 1156 | #Param x test Point x-coordinate ##
|
| 1157 | #Param y test Point y-coordinate ##
|
| 1158 |
|
| 1159 | #Return true if (x, y) is inside IRect ##
|
| 1160 |
|
| 1161 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1162 | SkIRect rect = { 30, 50, 40, 60 };
|
| 1163 | SkIPoint pts[] = { { 30, 50}, { 40, 50}, { 30, 60} };
|
| 1164 | for (auto pt : pts) {
|
| 1165 | SkDebugf("rect: (%d, %d, %d, %d) %s (%d, %d)\n",
|
| 1166 | rect.left(), rect.top(), rect.right(), rect.bottom(),
|
| 1167 | rect.contains(pt.x(), pt.y()) ? "contains" : "does not contain", pt.x(), pt.y());
|
| 1168 | }
|
| 1169 | #StdOut
|
| 1170 | rect: (30, 50, 40, 60) contains (30, 50)
|
| 1171 | rect: (30, 50, 40, 60) does not contain (40, 50)
|
| 1172 | rect: (30, 50, 40, 60) does not contain (30, 60)
|
| 1173 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1174 | ##
|
| 1175 |
|
| 1176 | #SeeAlso containsNoEmptyCheck SkRect::contains
|
| 1177 |
|
| 1178 | ##
|
| 1179 |
|
| 1180 | # ------------------------------------------------------------------------------
|
| 1181 |
|
| 1182 | #Method bool contains(int32_t left, int32_t top, int32_t right, int32_t bottom) const
|
| 1183 |
|
| 1184 | Constructs Rect to intersect from (left, top, right, bottom). Does not sort
|
| 1185 | construction.
|
| 1186 |
|
| 1187 | Returns true if Rect contains construction.
|
| 1188 | Returns false if Rect is empty or construction is empty.
|
| 1189 |
|
| 1190 | #Param left x minimum of constructed Rect ##
|
| 1191 | #Param top y minimum of constructed Rect ##
|
| 1192 | #Param right x maximum of constructed Rect ##
|
| 1193 | #Param bottom y maximum of constructed Rect ##
|
| 1194 |
|
| 1195 | #Return true if all sides of IRect are outside construction ##
|
| 1196 |
|
| 1197 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1198 | SkIRect rect = { 30, 50, 40, 60 };
|
| 1199 | SkIRect tests[] = { { 30, 50, 31, 51}, { 39, 49, 40, 50}, { 29, 59, 30, 60} };
|
| 1200 | for (auto contained : tests) {
|
| 1201 | bool success = rect.contains(
|
| 1202 | contained.left(), contained.top(), contained.right(), contained.bottom());
|
| 1203 | SkDebugf("rect: (%d, %d, %d, %d) %s (%d, %d, %d, %d)\n",
|
| 1204 | rect.left(), rect.top(), rect.right(), rect.bottom(),
|
| 1205 | success ? "contains" : "does not contain",
|
| 1206 | contained.left(), contained.top(), contained.right(), contained.bottom());
|
| 1207 | }
|
| 1208 | #StdOut
|
| 1209 | rect: (30, 50, 40, 60) contains (30, 50, 31, 51)
|
| 1210 | rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50)
|
| 1211 | rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60)
|
| 1212 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1213 | ##
|
| 1214 |
|
| 1215 | #SeeAlso containsNoEmptyCheck SkRect::contains
|
| 1216 |
|
| 1217 | ##
|
| 1218 |
|
| 1219 | # ------------------------------------------------------------------------------
|
| 1220 |
|
| 1221 | #Method bool contains(const SkIRect& r) const
|
| 1222 |
|
| 1223 | Returns true if Rect contains r.
|
| 1224 | Returns false if Rect is empty or r is empty.
|
| 1225 |
|
| 1226 | Rect contains r when Rect area completely includes r area.
|
| 1227 |
|
| 1228 | #Param r IRect contained ##
|
| 1229 |
|
| 1230 | #Return true if all sides of IRect are outside r ##
|
| 1231 |
|
| 1232 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1233 | SkIRect rect = { 30, 50, 40, 60 };
|
| 1234 | SkIRect tests[] = { { 30, 50, 31, 51}, { 39, 49, 40, 50}, { 29, 59, 30, 60} };
|
| 1235 | for (auto contained : tests) {
|
| 1236 | SkDebugf("rect: (%d, %d, %d, %d) %s (%d, %d, %d, %d)\n",
|
| 1237 | rect.left(), rect.top(), rect.right(), rect.bottom(),
|
| 1238 | rect.contains(contained) ? "contains" : "does not contain",
|
| 1239 | contained.left(), contained.top(), contained.right(), contained.bottom());
|
| 1240 | }
|
| 1241 | #StdOut
|
| 1242 | rect: (30, 50, 40, 60) contains (30, 50, 31, 51)
|
| 1243 | rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50)
|
| 1244 | rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60)
|
| 1245 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1246 | ##
|
| 1247 |
|
| 1248 | #SeeAlso containsNoEmptyCheck SkRect::contains
|
| 1249 |
|
| 1250 | ##
|
| 1251 |
|
| 1252 | # ------------------------------------------------------------------------------
|
| 1253 |
|
| 1254 | #Method bool contains(const SkRect& r) const
|
| 1255 |
|
| 1256 | Returns true if Rect contains r.
|
| 1257 | Returns false if Rect is empty or r is empty.
|
| 1258 |
|
| 1259 | Rect contains r when Rect area completely includes r area.
|
| 1260 |
|
| 1261 | #Param r Rect contained ##
|
| 1262 |
|
| 1263 | #Return true if all sides of IRect are outside r ##
|
| 1264 |
|
| 1265 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1266 | SkIRect rect = { 30, 50, 40, 60 };
|
| 1267 | SkRect tests[] = { { 30, 50, 31, 51}, { 39, 49, 40, 50}, { 29, 59, 30, 60} };
|
| 1268 | for (auto contained : tests) {
|
| 1269 | SkDebugf("rect: (%d, %d, %d, %d) %s (%g, %g, %g, %g)\n",
|
| 1270 | rect.left(), rect.top(), rect.right(), rect.bottom(),
|
| 1271 | rect.contains(contained) ? "contains" : "does not contain",
|
| 1272 | contained.left(), contained.top(), contained.right(), contained.bottom());
|
| 1273 | }
|
| 1274 | #StdOut
|
| 1275 | rect: (30, 50, 40, 60) contains (30, 50, 31, 51)
|
| 1276 | rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50)
|
| 1277 | rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60)
|
| 1278 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1279 | ##
|
| 1280 |
|
| 1281 | #SeeAlso containsNoEmptyCheck SkRect::contains
|
| 1282 |
|
| 1283 | ##
|
| 1284 |
|
| 1285 | # ------------------------------------------------------------------------------
|
| 1286 |
|
| 1287 | #Method bool containsNoEmptyCheck(int32_t left, int32_t top,
|
| 1288 | int32_t right, int32_t bottom) const
|
| 1289 |
|
| 1290 | Constructs IRect from (left, top, right, bottom). Does not sort
|
| 1291 | construction.
|
| 1292 |
|
| 1293 | Returns true if Rect contains construction.
|
| 1294 | Asserts if IRect is empty or construction is empty, and if SK_DEBUG is defined.
|
| 1295 |
|
| 1296 | Return is undefined if Rect is empty or construction is empty.
|
| 1297 |
|
| 1298 | #Param left x minimum of constructed Rect ##
|
| 1299 | #Param top y minimum of constructed Rect ##
|
| 1300 | #Param right x maximum of constructed Rect ##
|
| 1301 | #Param bottom y maximum of constructed Rect ##
|
| 1302 |
|
| 1303 | #Return true if all sides of IRect are outside construction ##
|
| 1304 |
|
| 1305 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1306 | SkIRect rect = { 30, 50, 40, 60 };
|
| 1307 | SkIRect tests[] = { { 30, 50, 31, 51}, { 39, 49, 40, 50}, { 29, 59, 30, 60} };
|
| 1308 | for (auto contained : tests) {
|
| 1309 | bool success = rect.containsNoEmptyCheck(
|
| 1310 | contained.left(), contained.top(), contained.right(), contained.bottom());
|
| 1311 | SkDebugf("rect: (%d, %d, %d, %d) %s (%d, %d, %d, %d)\n",
|
| 1312 | rect.left(), rect.top(), rect.right(), rect.bottom(),
|
| 1313 | success ? "contains" : "does not contain",
|
| 1314 | contained.left(), contained.top(), contained.right(), contained.bottom());
|
| 1315 | }
|
| 1316 | #StdOut
|
| 1317 | rect: (30, 50, 40, 60) contains (30, 50, 31, 51)
|
| 1318 | rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50)
|
| 1319 | rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60)
|
| 1320 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1321 | ##
|
| 1322 |
|
| 1323 | #SeeAlso contains SkRect::contains
|
| 1324 |
|
| 1325 | ##
|
| 1326 |
|
| 1327 | # ------------------------------------------------------------------------------
|
| 1328 |
|
| 1329 | #Method bool containsNoEmptyCheck(const SkIRect& r) const
|
| 1330 |
|
| 1331 | Returns true if Rect contains construction.
|
| 1332 | Asserts if IRect is empty or construction is empty, and if SK_DEBUG is defined.
|
| 1333 |
|
| 1334 | Return is undefined if Rect is empty or construction is empty.
|
| 1335 |
|
| 1336 | #Param r Rect contained ##
|
| 1337 |
|
| 1338 | #Return true if all sides of IRect are outside r ##
|
| 1339 |
|
| 1340 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1341 | SkIRect rect = { 30, 50, 40, 60 };
|
| 1342 | SkIRect tests[] = { { 30, 50, 31, 51}, { 39, 49, 40, 50}, { 29, 59, 30, 60} };
|
| 1343 | for (auto contained : tests) {
|
| 1344 | SkDebugf("rect: (%d, %d, %d, %d) %s (%d, %d, %d, %d)\n",
|
| 1345 | rect.left(), rect.top(), rect.right(), rect.bottom(),
|
| 1346 | rect.containsNoEmptyCheck(contained) ? "contains" : "does not contain",
|
| 1347 | contained.left(), contained.top(), contained.right(), contained.bottom());
|
| 1348 | }
|
| 1349 | #StdOut
|
| 1350 | rect: (30, 50, 40, 60) contains (30, 50, 31, 51)
|
| 1351 | rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50)
|
| 1352 | rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60)
|
| 1353 | ##
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1354 | ##
|
| 1355 |
|
| 1356 | #SeeAlso contains SkRect::contains
|
| 1357 |
|
| 1358 | ##
|
| 1359 |
|
| 1360 | #Topic Intersection
|
| 1361 |
|
| 1362 | IRects intersect when they enclose a common area. To intersect, each of the pair
|
| 1363 | must describe area; fLeft is less than fRight, and fTop is less than fBottom;
|
| 1364 | empty() returns false. The intersection of IRect pair can be described by:
|
| 1365 | #Formula
|
| 1366 | (max(a.fLeft, b.fLeft), max(a.fTop, b.fTop),
|
| 1367 | min(a.fRight, b.fRight), min(a.fBottom, b.fBottom))
|
| 1368 | ##
|
| 1369 | The intersection is only meaningful if the resulting IRect is not empty and
|
| 1370 | describes an area: fLeft is less than fRight, and fTop is less than fBottom.
|
| 1371 |
|
| 1372 | # ------------------------------------------------------------------------------
|
| 1373 |
|
| 1374 | #Method bool intersect(const SkIRect& r)
|
| 1375 |
|
| 1376 | Returns true if IRect intersects r, and sets IRect to intersection.
|
| 1377 | Returns false if IRect does not intersect r, and leaves IRect unchanged.
|
| 1378 |
|
| 1379 | Returns false if either r or IRect is empty, leaving IRect unchanged.
|
| 1380 |
|
| 1381 | #Param r limit of result ##
|
| 1382 |
|
| 1383 | #Return true if r and Rect have area in common ##
|
| 1384 |
|
| 1385 | #Example
|
| 1386 | #Description
|
| 1387 | Two SkDebugf calls are required. If the calls are combined, their arguments
|
| 1388 | may not be evaluated in left to right order: the printed intersection may
|
| 1389 | be before or after the call to intersect.
|
| 1390 | ##
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1391 | SkIRect leftRect = { 10, 40, 50, 80 };
|
| 1392 | SkIRect rightRect = { 30, 60, 70, 90 };
|
| 1393 | SkDebugf("%s intersection: ", leftRect.intersect(rightRect) ? "" : "no ");
|
| 1394 | SkDebugf("%d, %d, %d, %d\n", leftRect.left(), leftRect.top(),
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1395 | leftRect.right(), leftRect.bottom());
|
| 1396 | #StdOut
|
| 1397 | intersection: 30, 60, 50, 80
|
| 1398 | ##
|
| 1399 | ##
|
| 1400 |
|
| 1401 | #SeeAlso Intersects intersectNoEmptyCheck join SkRect::intersect
|
| 1402 |
|
| 1403 | ##
|
| 1404 |
|
| 1405 | # ------------------------------------------------------------------------------
|
| 1406 |
|
| 1407 | #Method bool SK_WARN_UNUSED_RESULT intersect(const SkIRect& a, const SkIRect& b)
|
| 1408 |
|
| 1409 | Returns true if a intersects b, and sets IRect to intersection.
|
| 1410 | Returns false if a does not intersect b, and leaves IRect unchanged.
|
| 1411 |
|
| 1412 | Returns false if either a or b is empty, leaving IRect unchanged.
|
| 1413 |
|
| 1414 | #Param a IRect to intersect ##
|
| 1415 | #Param b IRect to intersect ##
|
| 1416 |
|
| 1417 | #Return true if a and b have area in common ##
|
| 1418 |
|
| 1419 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1420 | SkIRect result;
|
| 1421 | bool intersected = result.intersect({ 10, 40, 50, 80 }, { 30, 60, 70, 90 });
|
| 1422 | SkDebugf("%s intersection: %d, %d, %d, %d\n", intersected ? "" : "no ",
|
| 1423 | result.left(), result.top(), result.right(), result.bottom());
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1424 | #StdOut
|
| 1425 | intersection: 30, 60, 50, 80
|
| 1426 | ##
|
| 1427 | ##
|
| 1428 |
|
| 1429 | #SeeAlso Intersects intersectNoEmptyCheck join SkRect::intersect
|
| 1430 |
|
| 1431 | ##
|
| 1432 |
|
| 1433 | # ------------------------------------------------------------------------------
|
| 1434 |
|
| 1435 | #Method bool SK_WARN_UNUSED_RESULT intersectNoEmptyCheck(const SkIRect& a, const SkIRect& b)
|
| 1436 |
|
| 1437 | Returns true if a intersects b, and sets IRect to intersection.
|
| 1438 | Returns false if a does not intersect b, and leaves IRect unchanged.
|
| 1439 |
|
| 1440 | Asserts if either a or b is empty, and if SK_DEBUG is defined.
|
| 1441 |
|
| 1442 | #Param a IRect to intersect ##
|
| 1443 | #Param b IRect to intersect ##
|
| 1444 |
|
| 1445 | #Return true if a and b have area in common ##
|
| 1446 |
|
| 1447 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1448 | SkIRect result;
|
| 1449 | bool intersected = result.intersectNoEmptyCheck({ 10, 40, 50, 80 }, { 30, 60, 70, 90 });
|
| 1450 | SkDebugf("intersection: %d, %d, %d, %d\n",
|
| 1451 | result.left(), result.top(), result.right(), result.bottom());
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1452 | #StdOut
|
| 1453 | intersection: 30, 60, 50, 80
|
| 1454 | ##
|
| 1455 | ##
|
| 1456 |
|
| 1457 | #SeeAlso Intersects intersect join SkRect::intersect
|
| 1458 |
|
| 1459 | ##
|
| 1460 |
|
| 1461 | # ------------------------------------------------------------------------------
|
| 1462 |
|
| 1463 | #Method bool intersect(int32_t left, int32_t top, int32_t right, int32_t bottom)
|
| 1464 |
|
| 1465 | Constructs IRect to intersect from (left, top, right, bottom). Does not sort
|
| 1466 | construction.
|
| 1467 |
|
| 1468 | Returns true if IRect intersects construction, and sets IRect to intersection.
|
| 1469 | Returns false if IRect does not intersect construction, and leaves IRect unchanged.
|
| 1470 |
|
| 1471 | Returns false if either construction or IRect is empty, leaving IRect unchanged.
|
| 1472 |
|
| 1473 | #Param left x minimum of constructed IRect ##
|
| 1474 | #Param top y minimum of constructed IRect ##
|
| 1475 | #Param right x maximum of constructed IRect ##
|
| 1476 | #Param bottom y maximum of constructed IRect ##
|
| 1477 |
|
| 1478 | #Return true if construction and IRect have area in common ##
|
| 1479 |
|
| 1480 | #Example
|
| 1481 | #Description
|
| 1482 | Two SkDebugf calls are required. If the calls are combined, their arguments
|
| 1483 | may not be evaluated in left to right order: the printed intersection may
|
| 1484 | be before or after the call to intersect.
|
| 1485 | ##
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1486 | SkIRect leftRect = { 10, 40, 50, 80 };
|
| 1487 | SkDebugf("%s intersection: ", leftRect.intersect(30, 60, 70, 90) ? "" : "no ");
|
| 1488 | SkDebugf("%d, %d, %d, %d\n", leftRect.left(), leftRect.top(),
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1489 | leftRect.right(), leftRect.bottom());
|
| 1490 | #StdOut
|
| 1491 | intersection: 30, 60, 50, 80
|
| 1492 | ##
|
| 1493 | ##
|
| 1494 |
|
| 1495 | #SeeAlso intersectNoEmptyCheck Intersects join SkRect::intersect
|
| 1496 |
|
| 1497 | ##
|
| 1498 |
|
| 1499 | # ------------------------------------------------------------------------------
|
| 1500 |
|
| 1501 | #Method static bool Intersects(const SkIRect& a, const SkIRect& b)
|
| 1502 |
|
| 1503 | Returns true if a intersects b.
|
| 1504 | Returns false if either a or b is empty, or do not intersect.
|
| 1505 |
|
| 1506 | #Param a IRect to intersect ##
|
| 1507 | #Param b IRect to intersect ##
|
| 1508 |
|
| 1509 | #Return true if a and b have area in common ##
|
| 1510 |
|
| 1511 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1512 | SkDebugf("%s intersection", SkIRect::Intersects({10, 40, 50, 80}, {30, 60, 70, 90}) ? "" : "no ");
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1513 | #StdOut
|
| 1514 | intersection
|
| 1515 | ##
|
| 1516 | ##
|
| 1517 |
|
| 1518 | #SeeAlso IntersectsNoEmptyCheck intersect SkRect::intersect
|
| 1519 |
|
| 1520 | ##
|
| 1521 |
|
| 1522 | # ------------------------------------------------------------------------------
|
| 1523 |
|
| 1524 | #Method static bool IntersectsNoEmptyCheck(const SkIRect& a, const SkIRect& b)
|
| 1525 |
|
| 1526 | Returns true if a intersects b.
|
| 1527 | Asserts if either a or b is empty, and if SK_DEBUG is defined.
|
| 1528 |
|
| 1529 | #Param a IRect to intersect ##
|
| 1530 | #Param b IRect to intersect ##
|
| 1531 |
|
| 1532 | #Return true if a and b have area in common ##
|
| 1533 |
|
| 1534 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1535 | SkDebugf("%s intersection", SkIRect::IntersectsNoEmptyCheck(
|
| 1536 | {10, 40, 50, 80}, {30, 60, 70, 90}) ? "" : "no ");
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1537 | #StdOut
|
| 1538 | intersection
|
| 1539 | ##
|
| 1540 | ##
|
| 1541 |
|
| 1542 | #SeeAlso Intersects intersect SkRect::intersect
|
| 1543 |
|
| 1544 | ##
|
| 1545 |
|
| 1546 | #Topic Intersection ##
|
| 1547 |
|
| 1548 | # ------------------------------------------------------------------------------
|
| 1549 |
|
| 1550 | #Method void join(int32_t left, int32_t top, int32_t right, int32_t bottom)
|
| 1551 |
|
| 1552 | Constructs Rect to intersect from (left, top, right, bottom). Does not sort
|
| 1553 | construction.
|
| 1554 |
|
| 1555 | Sets Rect to the union of itself and the construction.
|
| 1556 |
|
| 1557 | Has no effect if construction is empty. Otherwise, if Rect is empty, sets
|
| 1558 | Rect to construction.
|
| 1559 |
|
| 1560 | #Param left x minimum of constructed Rect ##
|
| 1561 | #Param top y minimum of constructed Rect ##
|
| 1562 | #Param right x maximum of constructed Rect ##
|
| 1563 | #Param bottom y maximum of constructed Rect ##
|
| 1564 |
|
| 1565 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1566 | SkIRect rect = { 10, 20, 15, 25};
|
| 1567 | rect.join(50, 60, 55, 65);
|
| 1568 | SkDebugf("join: %d, %d, %d, %d\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1569 | #StdOut
|
| 1570 | join: 10, 20, 55, 65
|
| 1571 | ##
|
| 1572 | ##
|
| 1573 |
|
| 1574 | #SeeAlso set SkRect::join
|
| 1575 |
|
| 1576 | ##
|
| 1577 |
|
| 1578 | # ------------------------------------------------------------------------------
|
| 1579 |
|
| 1580 | #Method void join(const SkIRect& r)
|
| 1581 |
|
| 1582 | Sets Rect to the union of itself and r.
|
| 1583 |
|
| 1584 | Has no effect if r is empty. Otherwise, if Rect is empty, sets Rect to r.
|
| 1585 |
|
| 1586 | #Param r expansion Rect ##
|
| 1587 |
|
| 1588 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1589 | SkIRect rect = { 10, 20, 15, 25};
|
| 1590 | rect.join({50, 60, 55, 65});
|
| 1591 | SkDebugf("join: %d, %d, %d, %d\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1592 | #StdOut
|
| 1593 | join: 10, 20, 55, 65
|
| 1594 | ##
|
| 1595 | ##
|
| 1596 |
|
| 1597 | #SeeAlso set SkRect::join
|
| 1598 |
|
| 1599 | ##
|
| 1600 |
|
| 1601 | # ------------------------------------------------------------------------------
|
| 1602 |
|
| 1603 | #Method void sort()
|
| 1604 |
|
| 1605 | Swaps fLeft and fRight if fLeft is greater than fRight; and swaps
|
| 1606 | fTop and fBottom if fTop is greater than fBottom. Result may be empty,
|
| 1607 | and width() and height() will be zero or positive.
|
| 1608 |
|
| 1609 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1610 | SkIRect rect = { 30, 50, 20, 10 };
|
| 1611 | SkDebugf("rect: %d, %d, %d, %d\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
|
| 1612 | rect.sort();
|
| 1613 | SkDebugf("sorted: %d, %d, %d, %d\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1614 | #StdOut
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1615 | rect: 30, 50, 20, 10
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1616 | sorted: 20, 10, 30, 50
|
| 1617 | ##
|
| 1618 | ##
|
| 1619 |
|
| 1620 | #SeeAlso makeSorted SkRect::sort
|
| 1621 |
|
| 1622 | ##
|
| 1623 |
|
| 1624 | # ------------------------------------------------------------------------------
|
| 1625 |
|
| 1626 | #Method SkIRect makeSorted() const
|
| 1627 |
|
| 1628 | Returns Rect with fLeft and fRight swapped if fLeft is greater than fRight; and
|
| 1629 | with fTop and fBottom swapped if fTop is greater than fBottom. Result may be empty;
|
| 1630 | and width() and height() will be zero or positive.
|
| 1631 |
|
| 1632 | #Return sorted IRect ##
|
| 1633 |
|
| 1634 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1635 | SkIRect rect = { 30, 50, 20, 10 };
|
| 1636 | SkDebugf("rect: %d, %d, %d, %d\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
|
| 1637 | SkIRect sort = rect.makeSorted();
|
| 1638 | SkDebugf("sorted: %d, %d, %d, %d\n", sort.fLeft, sort.fTop, sort.fRight, sort.fBottom);
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1639 | #StdOut
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1640 | rect: 30, 50, 20, 10
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1641 | sorted: 20, 10, 30, 50
|
| 1642 | ##
|
| 1643 | ##
|
| 1644 |
|
| 1645 | #SeeAlso sort SkRect::makeSorted
|
| 1646 |
|
| 1647 | ##
|
| 1648 |
|
| 1649 | # ------------------------------------------------------------------------------
|
| 1650 |
|
| 1651 | #Method static const SkIRect& SK_WARN_UNUSED_RESULT EmptyIRect()
|
| 1652 |
|
| 1653 | Returns a reference to immutable empty IRect, set to (0, 0, 0, 0).
|
| 1654 |
|
| 1655 | #Return global IRect set to all zeroes ##
|
| 1656 |
|
| 1657 | #Example
|
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1658 | const SkIRect& rect = SkIRect::EmptyIRect();
|
| 1659 | SkDebugf("rect: %d, %d, %d, %d\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
|
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1660 | #StdOut
|
| 1661 | rect: 0, 0, 0, 0
|
| 1662 | ##
|
| 1663 | ##
|
| 1664 |
|
| 1665 | #SeeAlso MakeEmpty
|
| 1666 |
|
| 1667 | ##
|
| 1668 |
|
| 1669 | #Struct SkIRect ##
|
| 1670 |
|
| 1671 | #Topic IRect ##
|