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

Unified Diff: ui/gfx/geometry/point3_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/point.h ('k') | ui/gfx/geometry/point_f.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/geometry/point3_f.h
diff --git a/ui/gfx/geometry/point3_f.h b/ui/gfx/geometry/point3_f.h
index 262e3555d31849f0e41b6a4569fddde8f1e6880c..8304636c82ea5bb15319a9828cbf9044ed06d5dd 100644
--- a/ui/gfx/geometry/point3_f.h
+++ b/ui/gfx/geometry/point3_f.h
@@ -17,13 +17,11 @@ namespace gfx {
// A point has an x, y and z coordinate.
class GFX_EXPORT Point3F {
public:
- Point3F() : x_(0), y_(0), z_(0) {}
+ constexpr Point3F() : x_(0), y_(0), z_(0) {}
+ constexpr Point3F(float x, float y, float z) : x_(x), y_(y), z_(z) {}
- Point3F(float x, float y, float z) : x_(x), y_(y), z_(z) {}
-
- explicit Point3F(const PointF& point) : x_(point.x()), y_(point.y()), z_(0) {}
-
- ~Point3F() {}
+ constexpr explicit Point3F(const PointF& point)
+ : x_(point.x()), y_(point.y()), z_(0) {}
void Scale(float scale) {
Scale(scale, scale, scale);
@@ -33,9 +31,9 @@ class GFX_EXPORT Point3F {
SetPoint(x() * x_scale, y() * y_scale, z() * z_scale);
}
- float x() const { return x_; }
- float y() const { return y_; }
- float z() const { return z_; }
+ constexpr float x() const { return x_; }
+ constexpr float y() const { return y_; }
+ constexpr float z() const { return z_; }
void set_x(float x) { x_ = x; }
void set_y(float y) { y_ = y; }
« no previous file with comments | « ui/gfx/geometry/point.h ('k') | ui/gfx/geometry/point_f.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698