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

Unified Diff: ui/gfx/geometry/quad_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_f.h ('k') | ui/gfx/geometry/rect.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/geometry/quad_f.h
diff --git a/ui/gfx/geometry/quad_f.h b/ui/gfx/geometry/quad_f.h
index f9eb3bc662b2c88f635f49f18af228e90886cf8b..18328c9c0c3858989473a7d68ebb640be67e4ef9 100644
--- a/ui/gfx/geometry/quad_f.h
+++ b/ui/gfx/geometry/quad_f.h
@@ -23,14 +23,14 @@ namespace gfx {
// axis-aligned, unlike a Rect.
class GFX_EXPORT QuadF {
public:
- QuadF() {}
- QuadF(const PointF& p1, const PointF& p2, const PointF& p3, const PointF& p4)
- : p1_(p1),
- p2_(p2),
- p3_(p3),
- p4_(p4) {}
-
- explicit QuadF(const RectF& rect)
+ constexpr QuadF() = default;
+ constexpr QuadF(const PointF& p1,
+ const PointF& p2,
+ const PointF& p3,
+ const PointF& p4)
+ : p1_(p1), p2_(p2), p3_(p3), p4_(p4) {}
+
+ constexpr explicit QuadF(const RectF& rect)
: p1_(rect.x(), rect.y()),
p2_(rect.right(), rect.y()),
p3_(rect.right(), rect.bottom()),
@@ -43,10 +43,10 @@ class GFX_EXPORT QuadF {
void set_p3(const PointF& p) { p3_ = p; }
void set_p4(const PointF& p) { p4_ = p; }
- const PointF& p1() const { return p1_; }
- const PointF& p2() const { return p2_; }
- const PointF& p3() const { return p3_; }
- const PointF& p4() const { return p4_; }
+ constexpr const PointF& p1() const { return p1_; }
+ constexpr const PointF& p2() const { return p2_; }
+ constexpr const PointF& p3() const { return p3_; }
+ constexpr const PointF& p4() const { return p4_; }
// Returns true if the quad is an axis-aligned rectangle.
bool IsRectilinear() const;
« no previous file with comments | « ui/gfx/geometry/point_f.h ('k') | ui/gfx/geometry/rect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698