OLD | NEW |
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 #include "ui/gfx/quad_f.h" | 5 #include "ui/gfx/quad_f.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
11 | 11 |
12 namespace gfx { | 12 namespace gfx { |
13 | 13 |
14 QuadF::QuadF() { | |
15 } | |
16 | |
17 QuadF::QuadF(const PointF& p1, | |
18 const PointF& p2, | |
19 const PointF& p3, | |
20 const PointF& p4) | |
21 : p1_(p1), | |
22 p2_(p2), | |
23 p3_(p3), | |
24 p4_(p4) { | |
25 } | |
26 | |
27 QuadF::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()) { | |
32 } | |
33 | |
34 QuadF::~QuadF() { | |
35 } | |
36 | |
37 void QuadF::operator=(const QuadF& quad) { | 14 void QuadF::operator=(const QuadF& quad) { |
38 p1_ = quad.p1_; | 15 p1_ = quad.p1_; |
39 p2_ = quad.p2_; | 16 p2_ = quad.p2_; |
40 p3_ = quad.p3_; | 17 p3_ = quad.p3_; |
41 p4_ = quad.p4_; | 18 p4_ = quad.p4_; |
42 } | 19 } |
43 | 20 |
44 void QuadF::operator=(const RectF& rect) { | 21 void QuadF::operator=(const RectF& rect) { |
45 p1_ = PointF(rect.x(), rect.y()); | 22 p1_ = PointF(rect.x(), rect.y()); |
46 p2_ = PointF(rect.right(), rect.y()); | 23 p2_ = PointF(rect.right(), rect.y()); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 return result; | 134 return result; |
158 } | 135 } |
159 | 136 |
160 QuadF operator-(const QuadF& lhs, const Vector2dF& rhs) { | 137 QuadF operator-(const QuadF& lhs, const Vector2dF& rhs) { |
161 QuadF result = lhs; | 138 QuadF result = lhs; |
162 result -= rhs; | 139 result -= rhs; |
163 return result; | 140 return result; |
164 } | 141 } |
165 | 142 |
166 } // namespace gfx | 143 } // namespace gfx |
OLD | NEW |