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/rect_f.h" | 5 #include "ui/gfx/rect_f.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "ui/gfx/insets_f.h" | 9 #include "ui/gfx/insets_f.h" |
10 #include "ui/gfx/rect_base_impl.h" | 10 #include "ui/gfx/rect_base_impl.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 } | 35 } |
36 | 36 |
37 RectF::~RectF() {} | 37 RectF::~RectF() {} |
38 | 38 |
39 std::string RectF::ToString() const { | 39 std::string RectF::ToString() const { |
40 return base::StringPrintf("%s %s", | 40 return base::StringPrintf("%s %s", |
41 origin().ToString().c_str(), | 41 origin().ToString().c_str(), |
42 size().ToString().c_str()); | 42 size().ToString().c_str()); |
43 } | 43 } |
44 | 44 |
| 45 RectF IntersectRects(const RectF& a, const RectF& b) { |
| 46 RectF result = a; |
| 47 result.Intersect(b); |
| 48 return result; |
| 49 } |
| 50 |
| 51 RectF UnionRects(const RectF& a, const RectF& b) { |
| 52 RectF result = a; |
| 53 result.Union(b); |
| 54 return result; |
| 55 } |
| 56 |
| 57 RectF SubtractRects(const RectF& a, const RectF& b) { |
| 58 RectF result = a; |
| 59 result.Subtract(b); |
| 60 return result; |
| 61 } |
| 62 |
| 63 RectF ScaleRect(const RectF& r, float x_scale, float y_scale) { |
| 64 RectF result = r; |
| 65 result.Scale(x_scale, y_scale); |
| 66 return result; |
| 67 } |
| 68 |
45 } // namespace gfx | 69 } // namespace gfx |
OLD | NEW |