| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014, Google Inc. All rights reserved. | 2 * Copyright (c) 2014, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 #ifndef FloatBox_h | 30 #ifndef FloatBox_h |
| 31 #define FloatBox_h | 31 #define FloatBox_h |
| 32 | 32 |
| 33 #include "platform/PlatformExport.h" |
| 33 #include "platform/geometry/FloatPoint3D.h" | 34 #include "platform/geometry/FloatPoint3D.h" |
| 34 #include "wtf/Allocator.h" | 35 #include "wtf/Allocator.h" |
| 35 #include <algorithm> | 36 #include <algorithm> |
| 36 #include <cmath> | 37 #include <cmath> |
| 37 #include <iosfwd> | 38 #include <iosfwd> |
| 38 | 39 |
| 39 namespace blink { | 40 namespace blink { |
| 40 | 41 |
| 41 class FloatBox { | 42 class PLATFORM_EXPORT FloatBox { |
| 42 DISALLOW_NEW(); | 43 DISALLOW_NEW(); |
| 43 public: | 44 public: |
| 44 FloatBox() | 45 FloatBox() |
| 45 : m_x(0) | 46 : m_x(0) |
| 46 , m_y(0) | 47 , m_y(0) |
| 47 , m_z(0) | 48 , m_z(0) |
| 48 , m_width(0) | 49 , m_width(0) |
| 49 , m_height(0) | 50 , m_height(0) |
| 50 , m_depth(0) | 51 , m_depth(0) |
| 51 { | 52 { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 153 |
| 153 float right() const { return m_x + m_width; } | 154 float right() const { return m_x + m_width; } |
| 154 float bottom() const { return m_y + m_height; } | 155 float bottom() const { return m_y + m_height; } |
| 155 float front() const { return m_z + m_depth; } | 156 float front() const { return m_z + m_depth; } |
| 156 float x() const { return m_x; } | 157 float x() const { return m_x; } |
| 157 float y() const { return m_y; } | 158 float y() const { return m_y; } |
| 158 float z() const { return m_z; } | 159 float z() const { return m_z; } |
| 159 float width() const { return m_width; } | 160 float width() const { return m_width; } |
| 160 float height() const { return m_height; } | 161 float height() const { return m_height; } |
| 161 float depth() const { return m_depth; } | 162 float depth() const { return m_depth; } |
| 163 |
| 164 String toString() const; |
| 165 |
| 162 private: | 166 private: |
| 163 float m_x; | 167 float m_x; |
| 164 float m_y; | 168 float m_y; |
| 165 float m_z; | 169 float m_z; |
| 166 float m_width; | 170 float m_width; |
| 167 float m_height; | 171 float m_height; |
| 168 float m_depth; | 172 float m_depth; |
| 169 }; | 173 }; |
| 170 | 174 |
| 171 inline bool operator==(const FloatBox& a, const FloatBox& b) | 175 inline bool operator==(const FloatBox& a, const FloatBox& b) |
| 172 { | 176 { |
| 173 return a.x() == b.x() && a.y() == b.y() && a.z() == b.z() && a.width() == b.
width() | 177 return a.x() == b.x() && a.y() == b.y() && a.z() == b.z() && a.width() == b.
width() |
| 174 && a.height() == b.height() && a.depth() == b.depth(); | 178 && a.height() == b.height() && a.depth() == b.depth(); |
| 175 } | 179 } |
| 176 | 180 |
| 177 inline bool operator!=(const FloatBox& a, const FloatBox& b) | 181 inline bool operator!=(const FloatBox& a, const FloatBox& b) |
| 178 { | 182 { |
| 179 return !(a == b); | 183 return !(a == b); |
| 180 } | 184 } |
| 181 | 185 |
| 182 // Redeclared here to avoid ODR issues. | 186 // Redeclared here to avoid ODR issues. |
| 183 // See platform/testing/GeometryPrinters.h. | 187 // See platform/testing/GeometryPrinters.h. |
| 184 void PrintTo(const FloatBox&, std::ostream*); | 188 void PrintTo(const FloatBox&, std::ostream*); |
| 185 | 189 |
| 186 } // namespace blink | 190 } // namespace blink |
| 187 | 191 |
| 188 #endif | 192 #endif |
| OLD | NEW |