| 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_conversions.h" | 5 #include "ui/gfx/geometry/rect_conversions.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "ui/gfx/safe_integer_conversions.h" | 11 #include "ui/gfx/geometry/safe_integer_conversions.h" |
| 12 | 12 |
| 13 namespace gfx { | 13 namespace gfx { |
| 14 | 14 |
| 15 Rect ToEnclosingRect(const RectF& rect) { | 15 Rect ToEnclosingRect(const RectF& rect) { |
| 16 int min_x = ToFlooredInt(rect.x()); | 16 int min_x = ToFlooredInt(rect.x()); |
| 17 int min_y = ToFlooredInt(rect.y()); | 17 int min_y = ToFlooredInt(rect.y()); |
| 18 float max_x = rect.right(); | 18 float max_x = rect.right(); |
| 19 float max_y = rect.bottom(); | 19 float max_y = rect.bottom(); |
| 20 int width = rect.width() == 0 ? 0 : std::max(ToCeiledInt(max_x) - min_x, 0); | 20 int width = rect.width() == 0 ? 0 : std::max(ToCeiledInt(max_x) - min_x, 0); |
| 21 int height = rect.height() == 0 ? 0 : std::max(ToCeiledInt(max_y) - min_y, 0); | 21 int height = rect.height() == 0 ? 0 : std::max(ToCeiledInt(max_y) - min_y, 0); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 Rect ToFlooredRectDeprecated(const RectF& rect) { | 74 Rect ToFlooredRectDeprecated(const RectF& rect) { |
| 75 return Rect(ToFlooredInt(rect.x()), | 75 return Rect(ToFlooredInt(rect.x()), |
| 76 ToFlooredInt(rect.y()), | 76 ToFlooredInt(rect.y()), |
| 77 ToFlooredInt(rect.width()), | 77 ToFlooredInt(rect.width()), |
| 78 ToFlooredInt(rect.height())); | 78 ToFlooredInt(rect.height())); |
| 79 } | 79 } |
| 80 | 80 |
| 81 } // namespace gfx | 81 } // namespace gfx |
| 82 | 82 |
| OLD | NEW |