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 DoubleSize_h | 5 #ifndef DoubleSize_h |
6 #define DoubleSize_h | 6 #define DoubleSize_h |
7 | 7 |
8 #include "platform/geometry/FloatSize.h" | 8 #include "platform/geometry/FloatSize.h" |
9 #include "platform/geometry/IntSize.h" | 9 #include "platform/geometry/IntSize.h" |
10 #include "wtf/MathExtras.h" | 10 #include "wtf/MathExtras.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 return a.width() == b.width() && a.height() == b.height(); | 53 return a.width() == b.width() && a.height() == b.height(); |
54 } | 54 } |
55 | 55 |
56 inline bool operator!=(const DoubleSize& a, const DoubleSize& b) | 56 inline bool operator!=(const DoubleSize& a, const DoubleSize& b) |
57 { | 57 { |
58 return a.width() != b.width() || a.height() != b.height(); | 58 return a.width() != b.width() || a.height() != b.height(); |
59 } | 59 } |
60 | 60 |
61 inline IntSize flooredIntSize(const DoubleSize& p) | 61 inline IntSize flooredIntSize(const DoubleSize& p) |
62 { | 62 { |
63 return IntSize(clampToInteger(floor(p.width())), clampToInteger(floor(p.heig
ht()))); | 63 return IntSize(clampTo<int>(floor(p.width())), clampTo<int>(floor(p.height()
))); |
64 } | 64 } |
65 | 65 |
66 inline FloatSize toFloatSize(const DoubleSize& p) | 66 inline FloatSize toFloatSize(const DoubleSize& p) |
67 { | 67 { |
68 return FloatSize(p.width(), p.height()); | 68 return FloatSize(p.width(), p.height()); |
69 } | 69 } |
70 | 70 |
71 } // namespace blink | 71 } // namespace blink |
72 | 72 |
73 #endif // DoubleSize_h | 73 #endif // DoubleSize_h |
OLD | NEW |