| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "gfx/rect.h" | 5 #include "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(OS_MACOSX) | 9 #elif defined(OS_MACOSX) |
| 10 #include <CoreGraphics/CGGeometry.h> | 10 #include <CoreGraphics/CGGeometry.h> |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 | 87 |
| 88 Rect& Rect::operator=(const GdkRectangle& r) { | 88 Rect& Rect::operator=(const GdkRectangle& r) { |
| 89 origin_.SetPoint(r.x, r.y); | 89 origin_.SetPoint(r.x, r.y); |
| 90 set_width(r.width); | 90 set_width(r.width); |
| 91 set_height(r.height); | 91 set_height(r.height); |
| 92 return *this; | 92 return *this; |
| 93 } | 93 } |
| 94 #endif | 94 #endif |
| 95 | 95 |
| 96 void Rect::set_width(int width) { | |
| 97 size_.set_width(width); | |
| 98 } | |
| 99 void Rect::set_height(int height) { | |
| 100 size_.set_height(height); | |
| 101 } | |
| 102 | |
| 103 void Rect::SetRect(int x, int y, int width, int height) { | 96 void Rect::SetRect(int x, int y, int width, int height) { |
| 104 origin_.SetPoint(x, y); | 97 origin_.SetPoint(x, y); |
| 105 set_width(width); | 98 set_width(width); |
| 106 set_height(height); | 99 set_height(height); |
| 107 } | 100 } |
| 108 | 101 |
| 109 void Rect::Inset(const gfx::Insets& insets) { | 102 void Rect::Inset(const gfx::Insets& insets) { |
| 110 Inset(insets.left(), insets.top(), insets.right(), insets.bottom()); | 103 Inset(insets.left(), insets.top(), insets.right(), insets.bottom()); |
| 111 } | 104 } |
| 112 | 105 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 (x() == rect.right() || right() == rect.x())) || | 228 (x() == rect.right() || right() == rect.x())) || |
| 236 (x() == rect.x() && width() == rect.width() && | 229 (x() == rect.x() && width() == rect.width() && |
| 237 (y() == rect.bottom() || bottom() == rect.y())); | 230 (y() == rect.bottom() || bottom() == rect.y())); |
| 238 } | 231 } |
| 239 | 232 |
| 240 } // namespace gfx | 233 } // namespace gfx |
| 241 | 234 |
| 242 std::ostream& operator<<(std::ostream& out, const gfx::Rect& r) { | 235 std::ostream& operator<<(std::ostream& out, const gfx::Rect& r) { |
| 243 return out << r.origin() << " " << r.size(); | 236 return out << r.origin() << " " << r.size(); |
| 244 } | 237 } |
| OLD | NEW |