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

Unified Diff: ui/gfx/geometry/vector3d_f.h

Issue 2051343002: Make various gfx classes more amenable to use as compile-time constants. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Delete destructor Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/geometry/vector2d_f.h ('k') | ui/gfx/geometry/vector3d_f.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/geometry/vector3d_f.h
diff --git a/ui/gfx/geometry/vector3d_f.h b/ui/gfx/geometry/vector3d_f.h
index 4e0eaa412492205b14e8ddb63a1d60c9cee4c15b..f6c23044d5a41b571e2d9329a27db8f4a12ef11e 100644
--- a/ui/gfx/geometry/vector3d_f.h
+++ b/ui/gfx/geometry/vector3d_f.h
@@ -20,18 +20,19 @@ namespace gfx {
class GFX_EXPORT Vector3dF {
public:
- Vector3dF();
- Vector3dF(float x, float y, float z);
+ constexpr Vector3dF() : x_(0), y_(0), z_(0) {}
+ constexpr Vector3dF(float x, float y, float z) : x_(x), y_(y), z_(z) {}
- explicit Vector3dF(const Vector2dF& other);
+ constexpr explicit Vector3dF(const Vector2dF& other)
+ : x_(other.x()), y_(other.y()), z_(0) {}
- float x() const { return x_; }
+ constexpr float x() const { return x_; }
void set_x(float x) { x_ = x; }
- float y() const { return y_; }
+ constexpr float y() const { return y_; }
void set_y(float y) { y_ = y; }
- float z() const { return z_; }
+ constexpr float z() const { return z_; }
void set_z(float z) { z_ = z; }
// True if all components of the vector are 0.
« no previous file with comments | « ui/gfx/geometry/vector2d_f.h ('k') | ui/gfx/geometry/vector3d_f.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698