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 #include "ui/gfx/box_f.h" | 5 #include "ui/gfx/box_f.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 depth_ = max_z - min_z; | 43 depth_ = max_z - min_z; |
44 } | 44 } |
45 | 45 |
46 void BoxF::Union(const BoxF& box) { | 46 void BoxF::Union(const BoxF& box) { |
47 if (IsEmpty()) { | 47 if (IsEmpty()) { |
48 *this = box; | 48 *this = box; |
49 return; | 49 return; |
50 } | 50 } |
51 if (box.IsEmpty()) | 51 if (box.IsEmpty()) |
52 return; | 52 return; |
53 | 53 ExpandTo(box); |
54 ExpandTo(box.origin(), gfx::Point3F(box.right(), box.bottom(), box.front())); | |
55 } | 54 } |
56 | 55 |
57 void BoxF::ExpandTo(const Point3F& point) { | 56 void BoxF::ExpandTo(const Point3F& point) { |
58 ExpandTo(point, point); | 57 ExpandTo(point, point); |
59 } | 58 } |
60 | 59 |
| 60 void BoxF::ExpandTo(const BoxF& box) { |
| 61 ExpandTo(box.origin(), gfx::Point3F(box.right(), box.bottom(), box.front())); |
| 62 } |
| 63 |
61 BoxF UnionBoxes(const BoxF& a, const BoxF& b) { | 64 BoxF UnionBoxes(const BoxF& a, const BoxF& b) { |
62 BoxF result = a; | 65 BoxF result = a; |
63 result.Union(b); | 66 result.Union(b); |
64 return result; | 67 return result; |
65 } | 68 } |
66 | 69 |
67 } // namespace gfx | 70 } // namespace gfx |
OLD | NEW |