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 void QuadF::operator=(const QuadF& quad) { | |
15 p1_ = quad.p1_; | |
16 p2_ = quad.p2_; | |
17 p3_ = quad.p3_; | |
18 p4_ = quad.p4_; | |
19 } | |
20 | |
21 void QuadF::operator=(const RectF& rect) { | 14 void QuadF::operator=(const RectF& rect) { |
22 p1_ = PointF(rect.x(), rect.y()); | 15 p1_ = PointF(rect.x(), rect.y()); |
23 p2_ = PointF(rect.right(), rect.y()); | 16 p2_ = PointF(rect.right(), rect.y()); |
24 p3_ = PointF(rect.right(), rect.bottom()); | 17 p3_ = PointF(rect.right(), rect.bottom()); |
25 p4_ = PointF(rect.x(), rect.bottom()); | 18 p4_ = PointF(rect.x(), rect.bottom()); |
26 } | 19 } |
27 | 20 |
28 std::string QuadF::ToString() const { | 21 std::string QuadF::ToString() const { |
29 return base::StringPrintf("%s;%s;%s;%s", | 22 return base::StringPrintf("%s;%s;%s;%s", |
30 p1_.ToString().c_str(), | 23 p1_.ToString().c_str(), |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 return result; | 127 return result; |
135 } | 128 } |
136 | 129 |
137 QuadF operator-(const QuadF& lhs, const Vector2dF& rhs) { | 130 QuadF operator-(const QuadF& lhs, const Vector2dF& rhs) { |
138 QuadF result = lhs; | 131 QuadF result = lhs; |
139 result -= rhs; | 132 result -= rhs; |
140 return result; | 133 return result; |
141 } | 134 } |
142 | 135 |
143 } // namespace gfx | 136 } // namespace gfx |
OLD | NEW |