5 #ifndef PPAPI_CPP_POINT_H_
6 #define PPAPI_CPP_POINT_H_
10 #include "ppapi/c/pp_point.h"
33 Point(int32_t in_x, int32_t in_y) {
53 operator PP_Point()
const {
74 int32_t
x()
const {
return point_.x; }
86 int32_t
y()
const {
return point_.y; }
102 return Point(
x() + other.
x(),
y() + other.
y());
112 return Point(
x() - other.
x(),
y() - other.
y());
122 point_.x += other.
x();
123 point_.y += other.
y();
134 point_.x -= other.
x();
135 point_.y -= other.
y();
143 int32_t
x = point_.x;
144 int32_t
y = point_.y;
145 point_.x = other.point_.x;
146 point_.y = other.point_.y;
161 float_point_.x = 0.0f;
162 float_point_.y = 0.0f;
174 float_point_.x = in_x;
175 float_point_.y = in_y;
183 float_point_.x = point.x;
184 float_point_.y = point.y;
192 operator PP_FloatPoint()
const {
213 float x()
const {
return float_point_.x; }
219 float_point_.x = in_x;
225 float y()
const {
return float_point_.y; }
231 float_point_.y = in_y;
261 float_point_.x += other.
x();
262 float_point_.y += other.
y();
273 float_point_.x -= other.
x();
274 float_point_.y -= other.
y();
282 float x = float_point_.x;
283 float y = float_point_.y;
284 float_point_.x = other.float_point_.x;
285 float_point_.y = other.float_point_.y;
286 other.float_point_.x =
x;
287 other.float_point_.y =
y;
291 PP_FloatPoint float_point_;
303 return lhs.
x() == rhs.
x() && lhs.
y() == rhs.
y();
314 return !(lhs == rhs);
324 return lhs.
x() == rhs.
x() && lhs.
y() == rhs.
y();
335 return !(lhs == rhs);
338 #endif // PPAPI_CPP_POINT_H_
void swap(FloatPoint &other)
Definition: point.h:281
Point(const PP_Point &point)
Definition: point.h:42
const PP_Point & pp_point() const
Definition: point.h:60
A 2 dimensional point with 0,0 being the upper-left starting coordinate.
Definition: point.h:18
FloatPoint & operator+=(const FloatPoint &other)
Definition: point.h:260
const PP_FloatPoint & pp_float_point() const
Definition: point.h:199
int32_t y() const
Definition: point.h:86
void swap(Point &other)
Definition: point.h:142
PP_FloatPoint & pp_float_point()
Definition: point.h:206
~Point()
Destructor.
Definition: point.h:48
void set_y(int32_t in_y)
Definition: point.h:91
Point operator+(const Point &other) const
Definition: point.h:101
void set_x(int32_t in_x)
Definition: point.h:79
float y() const
Definition: point.h:225
void set_y(float in_y)
Definition: point.h:230
Point & operator-=(const Point &other)
Definition: point.h:133
FloatPoint & operator-=(const FloatPoint &other)
Definition: point.h:272
Point()
The default constructor for a point at 0,0.
Definition: point.h:21
int32_t x() const
Definition: point.h:74
float x() const
Definition: point.h:213
~FloatPoint()
Destructor.
Definition: point.h:187
void set_x(float in_x)
Definition: point.h:218
Point & operator+=(const Point &other)
Definition: point.h:121
FloatPoint()
A constructor for a point at 0,0.
Definition: point.h:160
PP_Point & pp_point()
Definition: point.h:67
Point operator-(const Point &other) const
Definition: point.h:111
FloatPoint(float in_x, float in_y)
Definition: point.h:173
FloatPoint(const PP_FloatPoint &point)
Definition: point.h:182
bool operator!=(const pp::Point &lhs, const pp::Point &rhs)
Definition: point.h:313
FloatPoint operator-(const FloatPoint &other) const
Definition: point.h:250
FloatPoint operator+(const FloatPoint &other) const
Definition: point.h:240
bool operator==(const pp::Point &lhs, const pp::Point &rhs)
Definition: point.h:302
Point(int32_t in_x, int32_t in_y)
Definition: point.h:33