Chromium Code Reviews| Index: cc/math/int_point.h |
| diff --git a/cc/math/int_point.h b/cc/math/int_point.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4584ce1e00861a4c72e6b12cde5a4c03563d17f4 |
| --- /dev/null |
| +++ b/cc/math/int_point.h |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CC_MATH_INT_POINT_H_ |
| +#define CC_MATH_INT_POINT_H_ |
| + |
| +#include "cc/math/int_vector_2d.h" |
| + |
| +namespace ccmath { |
| + |
| +class IntPoint { |
| +public: |
|
tfarina
2012/09/28 19:39:30
if this were to follow chromium coding style, this
|
| + IntPoint() |
| + : m_x(0), |
| + m_y(0) { |
| + } |
| + IntPoint(int x, int y) |
| + : m_x(x), |
| + m_y(y) { |
| + } |
| + IntPoint(const IntPoint& point) |
| + : m_x(point.m_x), |
| + m_y(point.m_y) { |
| + } |
| + |
| + int x() const { return m_x; } |
| + int y() const { return m_y; } |
| + |
| + void set_x(int x) { m_x = x; } |
| + void set_y(int y) { m_y = y; } |
| + |
| +private: |
| + int m_x; |
|
tfarina
2012/09/28 19:39:30
and thus this would have to be |x_|
|
| + int m_y; |
| +}; |
| + |
| +inline bool operator==(const IntPoint& a, const IntPoint& b) { |
| + return a.x() == b.x() && a.y() == b.y(); |
| +} |
| + |
| +inline bool operator!=(const IntPoint& a, const IntPoint& b) { |
| + return !(a == b); |
| +} |
| + |
| +inline IntPoint operator+(const IntPoint& p, const IntVector2d& v) { |
| + return IntPoint(p.x() + v.v1(), p.y() + v.v2()); |
| +} |
| + |
| +inline IntVector2d operator-(const IntPoint& a, const IntPoint& b) { |
| + return IntVector2d(a.x() - b.x(), a.y() - b.y()); |
| +} |
| + |
| +} // namespace ccmath |
|
tfarina
2012/09/28 19:39:30
} // namespace ccmatch
^
two spaces between } a
|
| + |
| +#endif // CC_MATH_INT_POINT_H_ |