Chromium Code Reviews| Index: Source/platform/geometry/DoubleSize.h |
| diff --git a/Source/platform/geometry/DoubleSize.h b/Source/platform/geometry/DoubleSize.h |
| index cb68834563d26ce5a6e9288cbc3d6710b0595dec..0d96115ba5e31a9a5b02fa431b99c33df0d8d3d8 100644 |
| --- a/Source/platform/geometry/DoubleSize.h |
| +++ b/Source/platform/geometry/DoubleSize.h |
| @@ -15,6 +15,7 @@ class PLATFORM_EXPORT DoubleSize { |
| public: |
| DoubleSize() : m_width(0), m_height(0) { } |
| DoubleSize(double width, double height) : m_width(width), m_height(height) { } |
| + DoubleSize(const IntSize& p) : m_width(p.width()), m_height(p.height()) { } |
| double width() const { return m_width; } |
| double height() const { return m_height; } |
| @@ -37,6 +38,21 @@ inline DoubleSize& operator+=(DoubleSize& a, const DoubleSize& b) |
| return a; |
| } |
| +inline DoubleSize operator+(const DoubleSize& a, const IntSize& b) |
|
Rick Byers
2014/10/02 21:44:06
are these still necessary if you have the implicit
Yufeng Shen (Slow to review)
2014/10/02 23:34:35
removed.
|
| +{ |
| + return DoubleSize(a.width() + b.width(), a.height() + b.height()); |
| +} |
| + |
| +inline DoubleSize operator+(const IntSize& a, const DoubleSize& b) |
| +{ |
| + return DoubleSize(a.width() + b.width(), a.height() + b.height()); |
| +} |
| + |
| +inline DoubleSize operator+(const DoubleSize& a, const DoubleSize& b) |
| +{ |
| + return DoubleSize(a.width() + b.width(), a.height() + b.height()); |
| +} |
| + |
| inline DoubleSize operator-(const DoubleSize& a, const DoubleSize& b) |
| { |
| return DoubleSize(a.width() - b.width(), a.height() - b.height()); |
| @@ -47,6 +63,11 @@ inline bool operator==(const DoubleSize& a, const DoubleSize& b) |
| return a.width() == b.width() && a.height() == b.height(); |
| } |
| +inline bool operator!=(const DoubleSize& a, const DoubleSize& b) |
| +{ |
| + return a.width() != b.width() || a.height() != b.height(); |
| +} |
| + |
| inline IntSize flooredIntSize(const DoubleSize& p) |
| { |
| return IntSize(clampToInteger(floor(p.width())), clampToInteger(floor(p.height()))); |