Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: ui/gfx/box_f.h

Issue 25518002: Add BoxF::ExpandTo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/gfx/box_f.cc » ('j') | ui/gfx/box_f.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 void set_size(float width, float height, float depth) { 88 void set_size(float width, float height, float depth) {
89 width_ = width < 0 ? 0 : width; 89 width_ = width < 0 ? 0 : width;
90 height_ = height < 0 ? 0 : height; 90 height_ = height < 0 ? 0 : height;
91 depth_ = depth < 0 ? 0 : depth; 91 depth_ = depth < 0 ? 0 : depth;
92 } 92 }
93 93
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 // Expands the box to contain the given point, if necessary.
danakj 2013/10/01 15:09:15 Comment on what happens if |this| is empty? I see
98 void ExpandTo(const Point3F& point);
99
97 private: 100 private:
101 // Expands the box to contain the two given points. It is required that each
102 // component of |min| is less than or equal to the corresponding component in
103 // |max|. Precisely, what this function does is ensure that after the function
104 // completes, |this| contains origin_, min, max, and origin_ + (width_,
105 // height_, depth_), even if the box is empty. Emptiness checks are handled in
106 // the public function Union.
107 void ExpandTo(const Point3F& min, const Point3F& max);
108
98 Point3F origin_; 109 Point3F origin_;
99 float width_; 110 float width_;
100 float height_; 111 float height_;
101 float depth_; 112 float depth_;
102 }; 113 };
103 114
104 GFX_EXPORT BoxF UnionBoxes(const BoxF& a, const BoxF& b); 115 GFX_EXPORT BoxF UnionBoxes(const BoxF& a, const BoxF& b);
105 116
106 inline BoxF ScaleBox(const BoxF& b, 117 inline BoxF ScaleBox(const BoxF& b,
107 float x_scale, 118 float x_scale,
(...skipping 25 matching lines...) Expand all
133 b.y() + v.y(), 144 b.y() + v.y(),
134 b.z() + v.z(), 145 b.z() + v.z(),
135 b.width(), 146 b.width(),
136 b.height(), 147 b.height(),
137 b.depth()); 148 b.depth());
138 } 149 }
139 150
140 } // namespace gfx 151 } // namespace gfx
141 152
142 #endif // UI_GFX_BOX_F_H_ 153 #endif // UI_GFX_BOX_F_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/box_f.cc » ('j') | ui/gfx/box_f.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698