Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
SkIPoint Struct Reference

#include <SkPoint_impl.h>

Public Member Functions

constexpr int32_t x () const
 
constexpr int32_t y () const
 
bool isZero () const
 
void set (int32_t x, int32_t y)
 
SkIPoint operator- () const
 
void operator+= (const SkIVector &v)
 
void operator-= (const SkIVector &v)
 
bool equals (int32_t x, int32_t y) const
 

Static Public Member Functions

static constexpr SkIPoint Make (int32_t x, int32_t y)
 

Public Attributes

int32_t fX
 x-axis value More...
 
int32_t fY
 y-axis value More...
 

Friends

bool operator== (const SkIPoint &a, const SkIPoint &b)
 
bool operator!= (const SkIPoint &a, const SkIPoint &b)
 
SkIVector operator- (const SkIPoint &a, const SkIPoint &b)
 
SkIPoint operator+ (const SkIPoint &a, const SkIVector &b)
 

Detailed Description

SkIPoint holds two 32-bit integer coordinates.

Definition at line 28 of file SkPoint_impl.h.

Member Function Documentation

◆ equals()

bool SkIPoint::equals ( int32_t  x,
int32_t  y 
) const
inline

Returns true if SkIPoint is equivalent to SkIPoint constructed from (x, y).

Parameters
xvalue compared with fX
yvalue compared with fY
Returns
true if SkIPoint equals (x, y)

Definition at line 102 of file SkPoint_impl.h.

102 {
103 return fX == x && fY == y;
104 }
constexpr int32_t y() const
Definition: SkPoint_impl.h:52
int32_t fX
x-axis value
Definition: SkPoint_impl.h:29
int32_t fY
y-axis value
Definition: SkPoint_impl.h:30
constexpr int32_t x() const
Definition: SkPoint_impl.h:46

◆ isZero()

bool SkIPoint::isZero ( ) const
inline

Returns true if fX and fY are both zero.

Returns
true if fX is zero and fY is zero

Definition at line 58 of file SkPoint_impl.h.

58{ return (fX | fY) == 0; }

◆ Make()

static constexpr SkIPoint SkIPoint::Make ( int32_t  x,
int32_t  y 
)
inlinestaticconstexpr

Sets fX to x, fY to y.

Parameters
xinteger x-axis value of constructed SkIPoint
yinteger y-axis value of constructed SkIPoint
Returns
SkIPoint (x, y)

Definition at line 38 of file SkPoint_impl.h.

38 {
39 return {x, y};
40 }

◆ operator+=()

void SkIPoint::operator+= ( const SkIVector v)
inline

Offsets SkIPoint by ivector v. Sets SkIPoint to (fX + v.fX, fY + v.fY).

Parameters
vivector to add

Definition at line 82 of file SkPoint_impl.h.

82 {
83 fX = Sk32_sat_add(fX, v.fX);
84 fY = Sk32_sat_add(fY, v.fY);
85 }
static constexpr int32_t Sk32_sat_add(int32_t a, int32_t b)
Definition: SkSafe32.h:20

◆ operator-()

SkIPoint SkIPoint::operator- ( ) const
inline

Returns SkIPoint changing the signs of fX and fY.

Returns
SkIPoint as (-fX, -fY)

Definition at line 74 of file SkPoint_impl.h.

74 {
75 return {-fX, -fY};
76 }

◆ operator-=()

void SkIPoint::operator-= ( const SkIVector v)
inline

Subtracts ivector v from SkIPoint. Sets SkIPoint to: (fX - v.fX, fY - v.fY).

Parameters
vivector to subtract

Definition at line 91 of file SkPoint_impl.h.

91 {
92 fX = Sk32_sat_sub(fX, v.fX);
93 fY = Sk32_sat_sub(fY, v.fY);
94 }
static constexpr int32_t Sk32_sat_sub(int32_t a, int32_t b)
Definition: SkSafe32.h:24

◆ set()

void SkIPoint::set ( int32_t  x,
int32_t  y 
)
inline

Sets fX to x and fY to y.

Parameters
xnew value for fX
ynew value for fY

Definition at line 65 of file SkPoint_impl.h.

65 {
66 fX = x;
67 fY = y;
68 }

◆ x()

constexpr int32_t SkIPoint::x ( ) const
inlineconstexpr

Returns x-axis value of SkIPoint.

Returns
fX

Definition at line 46 of file SkPoint_impl.h.

46{ return fX; }

◆ y()

constexpr int32_t SkIPoint::y ( ) const
inlineconstexpr

Returns y-axis value of SkIPoint.

Returns
fY

Definition at line 52 of file SkPoint_impl.h.

52{ return fY; }

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const SkIPoint a,
const SkIPoint b 
)
friend

Returns true if a is not equivalent to b.

Parameters
aSkIPoint to compare
bSkIPoint to compare
Returns
true if a.fX != b.fX or a.fY != b.fY

Definition at line 122 of file SkPoint_impl.h.

122 {
123 return a.fX != b.fX || a.fY != b.fY;
124 }
static bool b
struct MyStruct a[10]

◆ operator+

SkIPoint operator+ ( const SkIPoint a,
const SkIVector b 
)
friend

Returns SkIPoint resulting from SkIPoint a offset by ivector b, computed as: (a.fX + b.fX, a.fY + b.fY).

Can also be used to offset SkIPoint b by ivector a, returning SkIPoint. Can also be used to add ivector to ivector, returning ivector.

Parameters
aSkIPoint or ivector to add to
bSkIPoint or ivector to add
Returns
SkIPoint equal to a offset by b

Definition at line 148 of file SkPoint_impl.h.

148 {
149 return { Sk32_sat_add(a.fX, b.fX), Sk32_sat_add(a.fY, b.fY) };
150 }

◆ operator-

SkIVector operator- ( const SkIPoint a,
const SkIPoint b 
)
friend

Returns ivector from b to a; computed as (a.fX - b.fX, a.fY - b.fY).

Can also be used to subtract ivector from ivector, returning ivector.

Parameters
aSkIPoint or ivector to subtract from
bivector to subtract
Returns
ivector from b to a

Definition at line 134 of file SkPoint_impl.h.

134 {
135 return { Sk32_sat_sub(a.fX, b.fX), Sk32_sat_sub(a.fY, b.fY) };
136 }

◆ operator==

bool operator== ( const SkIPoint a,
const SkIPoint b 
)
friend

Returns true if a is equivalent to b.

Parameters
aSkIPoint to compare
bSkIPoint to compare
Returns
true if a.fX == b.fX and a.fY == b.fY

Definition at line 112 of file SkPoint_impl.h.

112 {
113 return a.fX == b.fX && a.fY == b.fY;
114 }

Member Data Documentation

◆ fX

int32_t SkIPoint::fX

x-axis value

Definition at line 29 of file SkPoint_impl.h.

◆ fY

int32_t SkIPoint::fY

y-axis value

Definition at line 30 of file SkPoint_impl.h.


The documentation for this struct was generated from the following file: