17 static SkISize Make(int32_t w, int32_t h) {
return {w, h}; }
19 static SkISize MakeEmpty() {
return {0, 0}; }
21 void set(int32_t w, int32_t h) { *
this =
SkISize{w, h}; }
25 bool isZero()
const {
return 0 == fWidth && 0 == fHeight; }
28 bool isEmpty()
const {
return fWidth <= 0 || fHeight <= 0; }
33 int32_t width()
const {
return fWidth; }
34 int32_t height()
const {
return fHeight; }
36 bool equals(int32_t w, int32_t h)
const {
return fWidth == w && fHeight == h; }
39 static inline bool operator==(
const SkISize& a,
const SkISize& b) {
40 return a.fWidth == b.fWidth && a.fHeight == b.fHeight;
43 static inline bool operator!=(
const SkISize& a,
const SkISize& b) {
return !(a == b); }
51 static SkSize Make(SkScalar w, SkScalar h) {
return {w, h}; }
54 return {SkIntToScalar(src.width()), SkIntToScalar(src.height())};
58 return *
this =
SkSize{SkIntToScalar(src.fWidth), SkIntToScalar(src.fHeight)};
61 static SkSize MakeEmpty() {
return {0, 0}; }
63 void set(SkScalar w, SkScalar h) { *
this =
SkSize{w, h}; }
67 bool isZero()
const {
return 0 == fWidth && 0 == fHeight; }
70 bool isEmpty()
const {
return fWidth <= 0 || fHeight <= 0; }
75 SkScalar width()
const {
return fWidth; }
76 SkScalar height()
const {
return fHeight; }
78 bool equals(SkScalar w, SkScalar h)
const {
return fWidth == w && fHeight == h; }
80 SkISize toRound()
const {
return {SkScalarRoundToInt(fWidth), SkScalarRoundToInt(fHeight)}; }
82 SkISize toCeil()
const {
return {SkScalarCeilToInt(fWidth), SkScalarCeilToInt(fHeight)}; }
84 SkISize toFloor()
const {
return {SkScalarFloorToInt(fWidth), SkScalarFloorToInt(fHeight)}; }
87 static inline bool operator==(
const SkSize& a,
const SkSize& b) {
88 return a.fWidth == b.fWidth && a.fHeight == b.fHeight;
91 static inline bool operator!=(
const SkSize& a,
const SkSize& b) {
return !(a == b); }
bool isEmpty() const
Returns true if either widht or height are <= 0.
Definition: SkSize.h:70
bool isZero() const
Returns true iff fWidth == 0 && fHeight == 0.
Definition: SkSize.h:67
bool isZero() const
Returns true iff fWidth == 0 && fHeight == 0.
Definition: SkSize.h:25
void setEmpty()
Set the width and height to 0.
Definition: SkSize.h:31
bool isEmpty() const
Returns true if either widht or height are <= 0.
Definition: SkSize.h:28
void setEmpty()
Set the width and height to 0.
Definition: SkSize.h:73