OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_GFX_POINT_H__ | 5 #ifndef BASE_GFX_POINT_H__ |
6 #define BASE_GFX_POINT_H__ | 6 #define BASE_GFX_POINT_H__ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #ifdef UNIT_TEST | 10 #ifdef UNIT_TEST |
(...skipping 27 matching lines...) Expand all Loading... |
38 int y() const { return y_; } | 38 int y() const { return y_; } |
39 | 39 |
40 void SetPoint(int x, int y) { | 40 void SetPoint(int x, int y) { |
41 x_ = x; | 41 x_ = x; |
42 y_ = y; | 42 y_ = y; |
43 } | 43 } |
44 | 44 |
45 void set_x(int x) { x_ = x; } | 45 void set_x(int x) { x_ = x; } |
46 void set_y(int y) { y_ = y; } | 46 void set_y(int y) { y_ = y; } |
47 | 47 |
| 48 void Offset(int delta_x, int delta_y) { |
| 49 x_ += delta_x; |
| 50 y_ += delta_y; |
| 51 } |
| 52 |
48 bool operator==(const Point& rhs) const { | 53 bool operator==(const Point& rhs) const { |
49 return x_ == rhs.x_ && y_ == rhs.y_; | 54 return x_ == rhs.x_ && y_ == rhs.y_; |
50 } | 55 } |
51 | 56 |
52 bool operator!=(const Point& rhs) const { | 57 bool operator!=(const Point& rhs) const { |
53 return !(*this == rhs); | 58 return !(*this == rhs); |
54 } | 59 } |
55 | 60 |
56 #if defined(OS_WIN) | 61 #if defined(OS_WIN) |
57 POINT ToPOINT() const; | 62 POINT ToPOINT() const; |
(...skipping 11 matching lines...) Expand all Loading... |
69 #ifdef UNIT_TEST | 74 #ifdef UNIT_TEST |
70 | 75 |
71 inline std::ostream& operator<<(std::ostream& out, const gfx::Point& p) { | 76 inline std::ostream& operator<<(std::ostream& out, const gfx::Point& p) { |
72 return out << p.x() << "," << p.y(); | 77 return out << p.x() << "," << p.y(); |
73 } | 78 } |
74 | 79 |
75 #endif // #ifdef UNIT_TEST | 80 #endif // #ifdef UNIT_TEST |
76 | 81 |
77 #endif // BASE_GFX_POINT_H__ | 82 #endif // BASE_GFX_POINT_H__ |
78 | 83 |
OLD | NEW |