| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BOX_F_H_ | 5 #ifndef UI_GFX_BOX_F_H_ |
| 6 #define UI_GFX_BOX_F_H_ | 6 #define UI_GFX_BOX_F_H_ |
| 7 | 7 |
| 8 #include "ui/gfx/point3_f.h" | 8 #include "ui/gfx/point3_f.h" |
| 9 #include "ui/gfx/vector3d_f.h" | 9 #include "ui/gfx/vector3d_f.h" |
| 10 | 10 |
| 11 namespace gfx { | 11 namespace gfx { |
| 12 | 12 |
| 13 // A 3d version of gfx::RectF, with the positive z-axis pointed towards | 13 // A 3d version of gfx::RectF, with the positive z-axis pointed towards |
| 14 // the camera. | 14 // the camera. |
| 15 class UI_EXPORT BoxF { | 15 class GFX_EXPORT BoxF { |
| 16 public: | 16 public: |
| 17 BoxF() | 17 BoxF() |
| 18 : width_(0.f), | 18 : width_(0.f), |
| 19 height_(0.f), | 19 height_(0.f), |
| 20 depth_(0.f) {} | 20 depth_(0.f) {} |
| 21 | 21 |
| 22 BoxF(float width, float height, float depth) | 22 BoxF(float width, float height, float depth) |
| 23 : width_(width < 0 ? 0 : width), | 23 : width_(width < 0 ? 0 : width), |
| 24 height_(height < 0 ? 0 : height), | 24 height_(height < 0 ? 0 : height), |
| 25 depth_(depth < 0 ? 0 : depth) {} | 25 depth_(depth < 0 ? 0 : depth) {} |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 const Point3F& origin() const { return origin_; } | 94 const Point3F& origin() const { return origin_; } |
| 95 void set_origin(const Point3F& origin) { origin_ = origin; } | 95 void set_origin(const Point3F& origin) { origin_ = origin; } |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 Point3F origin_; | 98 Point3F origin_; |
| 99 float width_; | 99 float width_; |
| 100 float height_; | 100 float height_; |
| 101 float depth_; | 101 float depth_; |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 UI_EXPORT BoxF UnionBoxes(const BoxF& a, const BoxF& b); | 104 GFX_EXPORT BoxF UnionBoxes(const BoxF& a, const BoxF& b); |
| 105 | 105 |
| 106 inline BoxF ScaleBox(const BoxF& b, | 106 inline BoxF ScaleBox(const BoxF& b, |
| 107 float x_scale, | 107 float x_scale, |
| 108 float y_scale, | 108 float y_scale, |
| 109 float z_scale) { | 109 float z_scale) { |
| 110 return BoxF(b.x() * x_scale, | 110 return BoxF(b.x() * x_scale, |
| 111 b.y() * y_scale, | 111 b.y() * y_scale, |
| 112 b.z() * z_scale, | 112 b.z() * z_scale, |
| 113 b.width() * x_scale, | 113 b.width() * x_scale, |
| 114 b.height() * y_scale, | 114 b.height() * y_scale, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 133 b.y() + v.y(), | 133 b.y() + v.y(), |
| 134 b.z() + v.z(), | 134 b.z() + v.z(), |
| 135 b.width(), | 135 b.width(), |
| 136 b.height(), | 136 b.height(), |
| 137 b.depth()); | 137 b.depth()); |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace gfx | 140 } // namespace gfx |
| 141 | 141 |
| 142 #endif // UI_GFX_BOX_F_H_ | 142 #endif // UI_GFX_BOX_F_H_ |
| OLD | NEW |