OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/geometry/dip_util.h" | 5 #include "ui/gfx/geometry/dip_util.h" |
6 | 6 |
| 7 #include "ui/gfx/geometry/point.h" |
| 8 #include "ui/gfx/geometry/point_conversions.h" |
7 #include "ui/gfx/geometry/point_f.h" | 9 #include "ui/gfx/geometry/point_f.h" |
8 #include "ui/gfx/point.h" | |
9 #include "ui/gfx/point_conversions.h" | |
10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
11 #include "ui/gfx/rect_conversions.h" | 11 #include "ui/gfx/rect_conversions.h" |
12 #include "ui/gfx/size.h" | 12 #include "ui/gfx/size.h" |
13 #include "ui/gfx/size_conversions.h" | 13 #include "ui/gfx/size_conversions.h" |
14 | 14 |
15 namespace gfx { | 15 namespace gfx { |
16 | 16 |
17 gfx::Point ConvertPointToDIP(float scale_factor, | 17 gfx::Point ConvertPointToDIP(float scale_factor, |
18 const gfx::Point& point_in_pixel) { | 18 const gfx::Point& point_in_pixel) { |
19 return gfx::ToFlooredPoint( | 19 return gfx::ToFlooredPoint( |
(...skipping 28 matching lines...) Expand all Loading... |
48 // touched. ToEnclosingRect() floors the origin, and ceils the max | 48 // touched. ToEnclosingRect() floors the origin, and ceils the max |
49 // coordinate. To do otherwise (such as flooring the size) potentially | 49 // coordinate. To do otherwise (such as flooring the size) potentially |
50 // results in rounding down and not drawing all the pixels that are | 50 // results in rounding down and not drawing all the pixels that are |
51 // touched. | 51 // touched. |
52 return gfx::ToEnclosingRect( | 52 return gfx::ToEnclosingRect( |
53 gfx::RectF(gfx::ScalePoint(rect_in_dip.origin(), scale_factor), | 53 gfx::RectF(gfx::ScalePoint(rect_in_dip.origin(), scale_factor), |
54 gfx::ScaleSize(rect_in_dip.size(), scale_factor))); | 54 gfx::ScaleSize(rect_in_dip.size(), scale_factor))); |
55 } | 55 } |
56 | 56 |
57 } // namespace gfx | 57 } // namespace gfx |
OLD | NEW |