OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 DoublePoint_h | 5 #ifndef DoublePoint_h |
6 #define DoublePoint_h | 6 #define DoublePoint_h |
7 | 7 |
8 #include "platform/geometry/DoubleSize.h" | 8 #include "platform/geometry/DoubleSize.h" |
9 #include "platform/geometry/FloatPoint.h" | 9 #include "platform/geometry/FloatPoint.h" |
10 #include "platform/geometry/IntPoint.h" | 10 #include "platform/geometry/IntPoint.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 return DoubleSize(a.x() - b.x(), a.y() - b.y()); | 76 return DoubleSize(a.x() - b.x(), a.y() - b.y()); |
77 } | 77 } |
78 | 78 |
79 inline DoublePoint operator-(const DoublePoint& a) | 79 inline DoublePoint operator-(const DoublePoint& a) |
80 { | 80 { |
81 return DoublePoint(-a.x(), -a.y()); | 81 return DoublePoint(-a.x(), -a.y()); |
82 } | 82 } |
83 | 83 |
84 inline IntPoint flooredIntPoint(const DoublePoint& p) | 84 inline IntPoint flooredIntPoint(const DoublePoint& p) |
85 { | 85 { |
86 return IntPoint(clampToInteger(floor(p.x())), clampToInteger(floor(p.y()))); | 86 return IntPoint(clampTo<int>(floor(p.x())), clampTo<int>(floor(p.y()))); |
87 } | 87 } |
88 | 88 |
89 inline FloatPoint toFloatPoint(const DoublePoint& a) | 89 inline FloatPoint toFloatPoint(const DoublePoint& a) |
90 { | 90 { |
91 return FloatPoint(a.x(), a.y()); | 91 return FloatPoint(a.x(), a.y()); |
92 } | 92 } |
93 | 93 |
94 inline DoubleSize toDoubleSize(const DoublePoint& a) | 94 inline DoubleSize toDoubleSize(const DoublePoint& a) |
95 { | 95 { |
96 return DoubleSize(a.x(), a.y()); | 96 return DoubleSize(a.x(), a.y()); |
97 } | 97 } |
98 | 98 |
99 } | 99 } |
100 | 100 |
101 #endif | 101 #endif |
OLD | NEW |