diff options
Diffstat (limited to 'ui/gfx')
-rw-r--r-- | ui/gfx/box_f.cc | 7 | ||||
-rw-r--r-- | ui/gfx/box_f.h | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/ui/gfx/box_f.cc b/ui/gfx/box_f.cc index b4191f3..62e755b 100644 --- a/ui/gfx/box_f.cc +++ b/ui/gfx/box_f.cc @@ -50,14 +50,17 @@ void BoxF::Union(const BoxF& box) { } if (box.IsEmpty()) return; - - ExpandTo(box.origin(), gfx::Point3F(box.right(), box.bottom(), box.front())); + ExpandTo(box); } void BoxF::ExpandTo(const Point3F& point) { ExpandTo(point, point); } +void BoxF::ExpandTo(const BoxF& box) { + ExpandTo(box.origin(), gfx::Point3F(box.right(), box.bottom(), box.front())); +} + BoxF UnionBoxes(const BoxF& a, const BoxF& b) { BoxF result = a; result.Union(b); diff --git a/ui/gfx/box_f.h b/ui/gfx/box_f.h index 11770ee..73e0972 100644 --- a/ui/gfx/box_f.h +++ b/ui/gfx/box_f.h @@ -99,6 +99,11 @@ class GFX_EXPORT BoxF { // |origin_|. void ExpandTo(const Point3F& point); + // Expands |this| to contain the given box, if necessary. Please note, even + // if |this| is empty, after the function |this| will continue to contain its + // |origin_|. + void ExpandTo(const BoxF& box); + private: // Expands the box to contain the two given points. It is required that each // component of |min| is less than or equal to the corresponding component in |