5 #ifndef PPAPI_CPP_POINT_H_
6 #define PPAPI_CPP_POINT_H_
8 #include "ppapi/c/pp_point.h"
31 Point(int32_t in_x, int32_t in_y) {
51 operator PP_Point()
const {
72 int32_t
x()
const {
return point_.x; }
84 int32_t
y()
const {
return point_.y; }
100 return Point(
x() + other.
x(),
y() + other.
y());
110 return Point(
x() - other.
x(),
y() - other.
y());
120 point_.x += other.
x();
121 point_.y += other.
y();
132 point_.x -= other.
x();
133 point_.y -= other.
y();
141 int32_t
x = point_.x;
142 int32_t
y = point_.y;
143 point_.x = other.point_.x;
144 point_.y = other.point_.y;
159 float_point_.x = 0.0f;
160 float_point_.y = 0.0f;
172 float_point_.x = in_x;
173 float_point_.y = in_y;
181 float_point_.x = point.x;
182 float_point_.y = point.y;
190 operator PP_FloatPoint()
const {
211 float x()
const {
return float_point_.x; }
217 float_point_.x = in_x;
223 float y()
const {
return float_point_.y; }
229 float_point_.y = in_y;
259 float_point_.x += other.
x();
260 float_point_.y += other.
y();
271 float_point_.x -= other.
x();
272 float_point_.y -= other.
y();
280 float x = float_point_.x;
281 float y = float_point_.y;
282 float_point_.x = other.float_point_.x;
283 float_point_.y = other.float_point_.y;
284 other.float_point_.x =
x;
285 other.float_point_.y =
y;
289 PP_FloatPoint float_point_;
301 return lhs.
x() == rhs.
x() && lhs.
y() == rhs.
y();
312 return !(lhs == rhs);
322 return lhs.
x() == rhs.
x() && lhs.
y() == rhs.
y();
333 return !(lhs == rhs);
336 #endif // PPAPI_CPP_POINT_H_
void swap(FloatPoint &other)
Point(const PP_Point &point)
const PP_Point & pp_point() const
A 2 dimensional point with 0,0 being the upper-left starting coordinate.
FloatPoint & operator+=(const FloatPoint &other)
const PP_FloatPoint & pp_float_point() const
PP_FloatPoint & pp_float_point()
Point operator+(const Point &other) const
Point & operator-=(const Point &other)
FloatPoint & operator-=(const FloatPoint &other)
Point()
The default constructor for a point at 0,0.
Point & operator+=(const Point &other)
FloatPoint()
A constructor for a point at 0,0.
Point operator-(const Point &other) const
FloatPoint(float in_x, float in_y)
FloatPoint(const PP_FloatPoint &point)
bool operator!=(const pp::Point &lhs, const pp::Point &rhs)
FloatPoint operator-(const FloatPoint &other) const
FloatPoint operator+(const FloatPoint &other) const
bool operator==(const pp::Point &lhs, const pp::Point &rhs)
Point(int32_t in_x, int32_t in_y)