Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
gfx::Point Class Reference

#include <point.h>

Public Member Functions

constexpr Point ()
 
constexpr Point (int x, int y)
 
constexpr int x () const
 
constexpr int y () const
 
void set_x (int x)
 
void set_y (int y)
 
void SetPoint (int x, int y)
 
void Offset (int delta_x, int delta_y)
 
void operator+= (const Vector2d &vector)
 
void operator-= (const Vector2d &vector)
 
void SetToMin (const Point &other)
 
void SetToMax (const Point &other)
 
bool IsOrigin () const
 
Vector2d OffsetFromOrigin () const
 
bool operator< (const Point &rhs) const
 
std::string ToString () const
 

Detailed Description

Definition at line 27 of file point.h.

Constructor & Destructor Documentation

◆ Point() [1/2]

constexpr gfx::Point::Point ( )
inlineconstexpr

Definition at line 29 of file point.h.

29: x_(0), y_(0) {}

◆ Point() [2/2]

constexpr gfx::Point::Point ( int  x,
int  y 
)
inlineconstexpr

Definition at line 30 of file point.h.

30: x_(x), y_(y) {}
constexpr int y() const
Definition: point.h:49
constexpr int x() const
Definition: point.h:48

Member Function Documentation

◆ IsOrigin()

bool gfx::Point::IsOrigin ( ) const
inline

Definition at line 76 of file point.h.

76{ return x_ == 0 && y_ == 0; }

◆ Offset()

void gfx::Point::Offset ( int  delta_x,
int  delta_y 
)
inline

Definition at line 58 of file point.h.

58 {
59 x_ = base::ClampAdd(x_, delta_x);
60 y_ = base::ClampAdd(y_, delta_y);
61 }

◆ OffsetFromOrigin()

Vector2d gfx::Point::OffsetFromOrigin ( ) const
inline

Definition at line 78 of file point.h.

78{ return Vector2d(x_, y_); }

◆ operator+=()

void gfx::Point::operator+= ( const Vector2d vector)
inline

Definition at line 63 of file point.h.

63 {
64 x_ = base::ClampAdd(x_, vector.x());
65 y_ = base::ClampAdd(y_, vector.y());
66 }

◆ operator-=()

void gfx::Point::operator-= ( const Vector2d vector)
inline

Definition at line 68 of file point.h.

68 {
69 x_ = base::ClampSub(x_, vector.x());
70 y_ = base::ClampSub(y_, vector.y());
71 }

◆ operator<()

bool gfx::Point::operator< ( const Point rhs) const
inline

Definition at line 86 of file point.h.

86{ return std::tie(y_, x_) < std::tie(rhs.y_, rhs.x_); }

◆ set_x()

void gfx::Point::set_x ( int  x)
inline

Definition at line 50 of file point.h.

50{ x_ = x; }

◆ set_y()

void gfx::Point::set_y ( int  y)
inline

Definition at line 51 of file point.h.

51{ y_ = y; }

◆ SetPoint()

void gfx::Point::SetPoint ( int  x,
int  y 
)
inline

Definition at line 53 of file point.h.

53 {
54 x_ = x;
55 y_ = y;
56 }

◆ SetToMax()

void gfx::Point::SetToMax ( const Point other)

Definition at line 58 of file point.cc.

58 {
59 x_ = x_ >= other.x_ ? x_ : other.x_;
60 y_ = y_ >= other.y_ ? y_ : other.y_;
61}

◆ SetToMin()

void gfx::Point::SetToMin ( const Point other)

Definition at line 53 of file point.cc.

53 {
54 x_ = x_ <= other.x_ ? x_ : other.x_;
55 y_ = y_ <= other.y_ ? y_ : other.y_;
56}

◆ ToString()

std::string gfx::Point::ToString ( ) const

Definition at line 63 of file point.cc.

63 {
64 return base::StringPrintf("%d,%d", x(), y());
65}
std::string StringPrintf(const std::string &format, Args... args)
Definition: string_utils.h:18

◆ x()

constexpr int gfx::Point::x ( ) const
inlineconstexpr

Definition at line 48 of file point.h.

48{ return x_; }

◆ y()

constexpr int gfx::Point::y ( ) const
inlineconstexpr

Definition at line 49 of file point.h.

49{ return y_; }

The documentation for this class was generated from the following files: