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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 SK_ATTR_DEPRECATED("use Make()") | 432 SK_ATTR_DEPRECATED("use Make()") |
433 static SkRect SK_WARN_UNUSED_RESULT MakeFromIRect(const SkIRect& irect) { | 433 static SkRect SK_WARN_UNUSED_RESULT MakeFromIRect(const SkIRect& irect) { |
434 SkRect r; | 434 SkRect r; |
435 r.set(SkIntToScalar(irect.fLeft), | 435 r.set(SkIntToScalar(irect.fLeft), |
436 SkIntToScalar(irect.fTop), | 436 SkIntToScalar(irect.fTop), |
437 SkIntToScalar(irect.fRight), | 437 SkIntToScalar(irect.fRight), |
438 SkIntToScalar(irect.fBottom)); | 438 SkIntToScalar(irect.fBottom)); |
439 return r; | 439 return r; |
440 } | 440 } |
441 | 441 |
| 442 static SkRect Make(const SkISize& size) { |
| 443 return MakeIWH(size.width(), size.height()); |
| 444 } |
| 445 |
442 static SkRect SK_WARN_UNUSED_RESULT Make(const SkIRect& irect) { | 446 static SkRect SK_WARN_UNUSED_RESULT Make(const SkIRect& irect) { |
443 SkRect r; | 447 SkRect r; |
444 r.set(SkIntToScalar(irect.fLeft), | 448 r.set(SkIntToScalar(irect.fLeft), |
445 SkIntToScalar(irect.fTop), | 449 SkIntToScalar(irect.fTop), |
446 SkIntToScalar(irect.fRight), | 450 SkIntToScalar(irect.fRight), |
447 SkIntToScalar(irect.fBottom)); | 451 SkIntToScalar(irect.fBottom)); |
448 return r; | 452 return r; |
449 } | 453 } |
450 | 454 |
451 /** | 455 /** |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 void dumpHex() const { this->dump(true); } | 899 void dumpHex() const { this->dump(true); } |
896 }; | 900 }; |
897 | 901 |
898 inline bool SkIRect::contains(const SkRect& r) const { | 902 inline bool SkIRect::contains(const SkRect& r) const { |
899 return !r.isEmpty() && !this->isEmpty() && // check for empties | 903 return !r.isEmpty() && !this->isEmpty() && // check for empties |
900 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop && | 904 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop && |
901 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom; | 905 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom; |
902 } | 906 } |
903 | 907 |
904 #endif | 908 #endif |
OLD | NEW |