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

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

Issue 11299290: Inline gfx::QuadF and gfx::Transform ctor/dtors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased (QuadF only) Created 7 years, 11 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/quad_f.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_QUAD_F_H_ 5 #ifndef UI_GFX_QUAD_F_H_
6 #define UI_GFX_QUAD_F_H_ 6 #define UI_GFX_QUAD_F_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "ui/base/ui_export.h" 10 #include "ui/base/ui_export.h"
11 #include "ui/gfx/point_f.h" 11 #include "ui/gfx/point_f.h"
12 #include "ui/gfx/rect_f.h" 12 #include "ui/gfx/rect_f.h"
13 13
14 namespace gfx { 14 namespace gfx {
15 15
16 // A Quad is defined by four corners, allowing it to have edges that are not 16 // A Quad is defined by four corners, allowing it to have edges that are not
17 // axis-aligned, unlike a Rect. 17 // axis-aligned, unlike a Rect.
18 class UI_EXPORT QuadF { 18 class UI_EXPORT QuadF {
19 public: 19 public:
20 QuadF(); 20 QuadF() {}
21 QuadF(const PointF& p1, const PointF& p2, const PointF& p3, const PointF& p4); 21 QuadF(const PointF& p1, const PointF& p2, const PointF& p3, const PointF& p4)
22 explicit QuadF(const RectF& rect); 22 : p1_(p1),
23 ~QuadF(); 23 p2_(p2),
24 p3_(p3),
25 p4_(p4) {}
26
27 explicit QuadF(const RectF& rect)
28 : p1_(rect.x(), rect.y()),
29 p2_(rect.right(), rect.y()),
30 p3_(rect.right(), rect.bottom()),
31 p4_(rect.x(), rect.bottom()) {}
24 32
25 void operator=(const QuadF& quad); 33 void operator=(const QuadF& quad);
26 void operator=(const RectF& rect); 34 void operator=(const RectF& rect);
27 35
28 void set_p1(const PointF& p) { p1_ = p; } 36 void set_p1(const PointF& p) { p1_ = p; }
29 void set_p2(const PointF& p) { p2_ = p; } 37 void set_p2(const PointF& p) { p2_ = p; }
30 void set_p3(const PointF& p) { p3_ = p; } 38 void set_p3(const PointF& p) { p3_ = p; }
31 void set_p4(const PointF& p) { p4_ = p; } 39 void set_p4(const PointF& p) { p4_ = p; }
32 40
33 const PointF& p1() const { return p1_; } 41 const PointF& p1() const { return p1_; }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 93
86 // Add a vector to a quad, offseting each point in the quad by the vector. 94 // Add a vector to a quad, offseting each point in the quad by the vector.
87 UI_EXPORT QuadF operator+(const QuadF& lhs, const Vector2dF& rhs); 95 UI_EXPORT QuadF operator+(const QuadF& lhs, const Vector2dF& rhs);
88 // Subtract a vector from a quad, offseting each point in the quad by the 96 // Subtract a vector from a quad, offseting each point in the quad by the
89 // inverse of the vector. 97 // inverse of the vector.
90 UI_EXPORT QuadF operator-(const QuadF& lhs, const Vector2dF& rhs); 98 UI_EXPORT QuadF operator-(const QuadF& lhs, const Vector2dF& rhs);
91 99
92 } // namespace gfx 100 } // namespace gfx
93 101
94 #endif // UI_GFX_QUAD_F_H_ 102 #endif // UI_GFX_QUAD_F_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/quad_f.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698