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/rect_conversions.h" |
6 | 6 |
7 #include "ui/gfx/safe_integer_conversions.h" | 7 #include "ui/gfx/safe_integer_conversions.h" |
8 | 8 |
9 namespace gfx { | 9 namespace gfx { |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 Rect ToEnclosedRect(const RectF& rect) { | 21 Rect ToEnclosedRect(const RectF& rect) { |
22 int min_x = ToCeiledInt(rect.origin().x()); | 22 int min_x = ToCeiledInt(rect.origin().x()); |
23 int min_y = ToCeiledInt(rect.origin().y()); | 23 int min_y = ToCeiledInt(rect.origin().y()); |
24 float max_x = rect.origin().x() + rect.size().width(); | 24 float max_x = rect.origin().x() + rect.size().width(); |
25 float max_y = rect.origin().y() + rect.size().height(); | 25 float max_y = rect.origin().y() + rect.size().height(); |
26 int width = std::max(ToFlooredInt(max_x) - min_x, 0); | 26 int width = std::max(ToFlooredInt(max_x) - min_x, 0); |
27 int height = std::max(ToFlooredInt(max_y) - min_y, 0); | 27 int height = std::max(ToFlooredInt(max_y) - min_y, 0); |
28 return Rect(min_x, min_y, width, height); | 28 return Rect(min_x, min_y, width, height); |
29 } | 29 } |
30 | 30 |
| 31 Rect ToFlooredRectDeprecated(const RectF& rect) { |
| 32 return Rect(ToFlooredInt(rect.origin().x()), |
| 33 ToFlooredInt(rect.origin().y()), |
| 34 ToFlooredInt(rect.size().width()), |
| 35 ToFlooredInt(rect.size().height())); |
| 36 } |
| 37 |
31 } // namespace gfx | 38 } // namespace gfx |
32 | 39 |
OLD | NEW |