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

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: 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
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..c726186350c3ad0dbd583776f73ecbd75235caf8 100644
--- a/ui/gfx/geometry/quad_f.h
+++ b/ui/gfx/geometry/quad_f.h
@@ -23,14 +23,17 @@ 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)
+ constexpr QuadF() {}
danakj 2016/06/10 00:36:48 nit: = default?
Peter Kasting 2016/06/10 05:50:06 Fine with me, I have no preference. Done in all t
+ constexpr 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 explicit QuadF(const RectF& rect)
: p1_(rect.x(), rect.y()),
p2_(rect.right(), rect.y()),
p3_(rect.right(), rect.bottom()),
@@ -43,10 +46,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;

Powered by Google App Engine
This is Rietveld 408576698