Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_MATH_INT_POINT_H_ | |
| 6 #define CC_MATH_INT_POINT_H_ | |
| 7 | |
| 8 #include "cc/math/int_vector_2d.h" | |
| 9 | |
| 10 namespace ccmath { | |
| 11 | |
| 12 class IntPoint { | |
| 13 public: | |
|
tfarina
2012/09/28 19:39:30
if this were to follow chromium coding style, this
| |
| 14 IntPoint() | |
| 15 : m_x(0), | |
| 16 m_y(0) { | |
| 17 } | |
| 18 IntPoint(int x, int y) | |
| 19 : m_x(x), | |
| 20 m_y(y) { | |
| 21 } | |
| 22 IntPoint(const IntPoint& point) | |
| 23 : m_x(point.m_x), | |
| 24 m_y(point.m_y) { | |
| 25 } | |
| 26 | |
| 27 int x() const { return m_x; } | |
| 28 int y() const { return m_y; } | |
| 29 | |
| 30 void set_x(int x) { m_x = x; } | |
| 31 void set_y(int y) { m_y = y; } | |
| 32 | |
| 33 private: | |
| 34 int m_x; | |
|
tfarina
2012/09/28 19:39:30
and thus this would have to be |x_|
| |
| 35 int m_y; | |
| 36 }; | |
| 37 | |
| 38 inline bool operator==(const IntPoint& a, const IntPoint& b) { | |
| 39 return a.x() == b.x() && a.y() == b.y(); | |
| 40 } | |
| 41 | |
| 42 inline bool operator!=(const IntPoint& a, const IntPoint& b) { | |
| 43 return !(a == b); | |
| 44 } | |
| 45 | |
| 46 inline IntPoint operator+(const IntPoint& p, const IntVector2d& v) { | |
| 47 return IntPoint(p.x() + v.v1(), p.y() + v.v2()); | |
| 48 } | |
| 49 | |
| 50 inline IntVector2d operator-(const IntPoint& a, const IntPoint& b) { | |
| 51 return IntVector2d(a.x() - b.x(), a.y() - b.y()); | |
| 52 } | |
| 53 | |
| 54 } // namespace ccmath | |
|
tfarina
2012/09/28 19:39:30
} // namespace ccmatch
^
two spaces between } a
| |
| 55 | |
| 56 #endif // CC_MATH_INT_POINT_H_ | |
| OLD | NEW |