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.h" | 5 #include "ui/gfx/rect.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #elif defined(TOOLKIT_GTK) | 9 #elif defined(TOOLKIT_GTK) |
10 #include <gdk/gdk.h> | 10 #include <gdk/gdk.h> |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 return r; | 81 return r; |
82 } | 82 } |
83 #endif | 83 #endif |
84 | 84 |
85 std::string Rect::ToString() const { | 85 std::string Rect::ToString() const { |
86 return base::StringPrintf("%s %s", | 86 return base::StringPrintf("%s %s", |
87 origin().ToString().c_str(), | 87 origin().ToString().c_str(), |
88 size().ToString().c_str()); | 88 size().ToString().c_str()); |
89 } | 89 } |
90 | 90 |
| 91 Rect IntersectRects(const Rect& a, const Rect& b) { |
| 92 Rect result = a; |
| 93 result.Intersect(b); |
| 94 return result; |
| 95 } |
| 96 |
| 97 Rect UnionRects(const Rect& a, const Rect& b) { |
| 98 Rect result = a; |
| 99 result.Union(b); |
| 100 return result; |
| 101 } |
| 102 |
| 103 Rect SubtractRects(const Rect& a, const Rect& b) { |
| 104 Rect result = a; |
| 105 result.Subtract(b); |
| 106 return result; |
| 107 } |
| 108 |
91 } // namespace gfx | 109 } // namespace gfx |
OLD | NEW |