OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkRect_DEFINED | 8 #ifndef SkRect_DEFINED |
9 #define SkRect_DEFINED | 9 #define SkRect_DEFINED |
10 | 10 |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 r.set(0, 0, SkIntToScalar(w), SkIntToScalar(h)); | 411 r.set(0, 0, SkIntToScalar(w), SkIntToScalar(h)); |
412 return r; | 412 return r; |
413 } | 413 } |
414 | 414 |
415 static SkRect SK_WARN_UNUSED_RESULT MakeSize(const SkSize& size) { | 415 static SkRect SK_WARN_UNUSED_RESULT MakeSize(const SkSize& size) { |
416 SkRect r; | 416 SkRect r; |
417 r.set(0, 0, size.width(), size.height()); | 417 r.set(0, 0, size.width(), size.height()); |
418 return r; | 418 return r; |
419 } | 419 } |
420 | 420 |
421 static SkRect SK_WARN_UNUSED_RESULT MakeLTRB(SkScalar l, SkScalar t, SkScala
r r, SkScalar b) { | 421 static constexpr SkRect SK_WARN_UNUSED_RESULT MakeLTRB(SkScalar l, SkScalar
t, SkScalar r, |
422 SkRect rect; | 422 SkScalar b) { |
423 rect.set(l, t, r, b); | 423 return SkRect {l, t, r, b}; |
424 return rect; | |
425 } | 424 } |
426 | 425 |
427 static SkRect SK_WARN_UNUSED_RESULT MakeXYWH(SkScalar x, SkScalar y, SkScala
r w, SkScalar h) { | 426 static SkRect SK_WARN_UNUSED_RESULT MakeXYWH(SkScalar x, SkScalar y, SkScala
r w, SkScalar h) { |
428 SkRect r; | 427 SkRect r; |
429 r.set(x, y, x + w, y + h); | 428 r.set(x, y, x + w, y + h); |
430 return r; | 429 return r; |
431 } | 430 } |
432 | 431 |
433 SK_ATTR_DEPRECATED("use Make()") | 432 SK_ATTR_DEPRECATED("use Make()") |
434 static SkRect SK_WARN_UNUSED_RESULT MakeFromIRect(const SkIRect& irect) { | 433 static SkRect SK_WARN_UNUSED_RESULT MakeFromIRect(const SkIRect& irect) { |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 void dumpHex() const { this->dump(true); } | 895 void dumpHex() const { this->dump(true); } |
897 }; | 896 }; |
898 | 897 |
899 inline bool SkIRect::contains(const SkRect& r) const { | 898 inline bool SkIRect::contains(const SkRect& r) const { |
900 return !r.isEmpty() && !this->isEmpty() && // check for empties | 899 return !r.isEmpty() && !this->isEmpty() && // check for empties |
901 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop && | 900 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop && |
902 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom; | 901 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom; |
903 } | 902 } |
904 | 903 |
905 #endif | 904 #endif |
OLD | NEW |