OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_GFX_POINT_BASE_H_ | 5 #ifndef UI_GFX_POINT_BASE_H_ |
6 #define UI_GFX_POINT_BASE_H_ | 6 #define UI_GFX_POINT_BASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 25 matching lines...) Expand all Loading... | |
36 void operator+=(const VectorClass& vector) { | 36 void operator+=(const VectorClass& vector) { |
37 x_ += vector.x(); | 37 x_ += vector.x(); |
38 y_ += vector.y(); | 38 y_ += vector.y(); |
39 } | 39 } |
40 | 40 |
41 void operator-=(const VectorClass& vector) { | 41 void operator-=(const VectorClass& vector) { |
42 x_ -= vector.x(); | 42 x_ -= vector.x(); |
43 y_ -= vector.y(); | 43 y_ -= vector.y(); |
44 } | 44 } |
45 | 45 |
46 void ClampToMax(const Class& max) { | 46 void ClampToUpperBound(const Class& max) { |
sky
2013/04/22 16:44:18
I agree the names are confusing, but I'm not sure
| |
47 x_ = x_ <= max.x_ ? x_ : max.x_; | 47 x_ = x_ <= max.x_ ? x_ : max.x_; |
48 y_ = y_ <= max.y_ ? y_ : max.y_; | 48 y_ = y_ <= max.y_ ? y_ : max.y_; |
49 } | 49 } |
50 | 50 |
51 void ClampToMin(const Class& min) { | 51 void ClampToLowerBound(const Class& min) { |
52 x_ = x_ >= min.x_ ? x_ : min.x_; | 52 x_ = x_ >= min.x_ ? x_ : min.x_; |
53 y_ = y_ >= min.y_ ? y_ : min.y_; | 53 y_ = y_ >= min.y_ ? y_ : min.y_; |
54 } | 54 } |
55 | 55 |
56 bool IsOrigin() const { | 56 bool IsOrigin() const { |
57 return x_ == 0 && y_ == 0; | 57 return x_ == 0 && y_ == 0; |
58 } | 58 } |
59 | 59 |
60 VectorClass OffsetFromOrigin() const { | 60 VectorClass OffsetFromOrigin() const { |
61 return VectorClass(x_, y_); | 61 return VectorClass(x_, y_); |
(...skipping 16 matching lines...) Expand all Loading... | |
78 ~PointBase() {} | 78 ~PointBase() {} |
79 | 79 |
80 private: | 80 private: |
81 Type x_; | 81 Type x_; |
82 Type y_; | 82 Type y_; |
83 }; | 83 }; |
84 | 84 |
85 } // namespace gfx | 85 } // namespace gfx |
86 | 86 |
87 #endif // UI_GFX_POINT_BASE_H_ | 87 #endif // UI_GFX_POINT_BASE_H_ |
OLD | NEW |