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/compositor/dip_util.h" | 5 #include "ui/compositor/dip_util.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "ui/base/ui_base_switches.h" | 8 #include "ui/base/ui_base_switches.h" |
9 #include "ui/compositor/compositor.h" | 9 #include "ui/compositor/compositor.h" |
10 #include "ui/compositor/compositor_switches.h" | 10 #include "ui/compositor/compositor_switches.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 gfx::Point ConvertPointToDIP(const Layer* layer, | 26 gfx::Point ConvertPointToDIP(const Layer* layer, |
27 const gfx::Point& point_in_pixel) { | 27 const gfx::Point& point_in_pixel) { |
28 return gfx::ToFlooredPoint( | 28 return gfx::ToFlooredPoint( |
29 gfx::ScalePoint(point_in_pixel, 1.0f / GetDeviceScaleFactor(layer))); | 29 gfx::ScalePoint(point_in_pixel, 1.0f / GetDeviceScaleFactor(layer))); |
30 } | 30 } |
31 | 31 |
32 gfx::Size ConvertSizeToDIP(const Layer* layer, | 32 gfx::Size ConvertSizeToDIP(const Layer* layer, |
33 const gfx::Size& size_in_pixel) { | 33 const gfx::Size& size_in_pixel) { |
34 return gfx::ToFlooredSize( | 34 return gfx::ToFlooredSize( |
35 size_in_pixel.Scale(1.0f / GetDeviceScaleFactor(layer))); | 35 gfx::ScaleSize(size_in_pixel, 1.0f / GetDeviceScaleFactor(layer))); |
36 } | 36 } |
37 | 37 |
38 gfx::Rect ConvertRectToDIP(const Layer* layer, | 38 gfx::Rect ConvertRectToDIP(const Layer* layer, |
39 const gfx::Rect& rect_in_pixel) { | 39 const gfx::Rect& rect_in_pixel) { |
40 float scale = 1.0f / GetDeviceScaleFactor(layer); | 40 float scale = 1.0f / GetDeviceScaleFactor(layer); |
41 return gfx::ToFlooredRectDeprecated(gfx::ScaleRect(rect_in_pixel, scale)); | 41 return gfx::ToFlooredRectDeprecated(gfx::ScaleRect(rect_in_pixel, scale)); |
42 } | 42 } |
43 | 43 |
44 gfx::Point ConvertPointToPixel(const Layer* layer, | 44 gfx::Point ConvertPointToPixel(const Layer* layer, |
45 const gfx::Point& point_in_dip) { | 45 const gfx::Point& point_in_dip) { |
46 return gfx::ToFlooredPoint( | 46 return gfx::ToFlooredPoint( |
47 gfx::ScalePoint(point_in_dip, GetDeviceScaleFactor(layer))); | 47 gfx::ScalePoint(point_in_dip, GetDeviceScaleFactor(layer))); |
48 } | 48 } |
49 | 49 |
50 gfx::Size ConvertSizeToPixel(const Layer* layer, | 50 gfx::Size ConvertSizeToPixel(const Layer* layer, |
51 const gfx::Size& size_in_dip) { | 51 const gfx::Size& size_in_dip) { |
52 return gfx::ToFlooredSize(size_in_dip.Scale(GetDeviceScaleFactor(layer))); | 52 return gfx::ToFlooredSize( |
| 53 gfx::ScaleSize(size_in_dip, GetDeviceScaleFactor(layer))); |
53 } | 54 } |
54 | 55 |
55 gfx::Rect ConvertRectToPixel(const Layer* layer, | 56 gfx::Rect ConvertRectToPixel(const Layer* layer, |
56 const gfx::Rect& rect_in_dip) { | 57 const gfx::Rect& rect_in_dip) { |
57 float scale = GetDeviceScaleFactor(layer); | 58 float scale = GetDeviceScaleFactor(layer); |
58 return gfx::ToFlooredRectDeprecated(gfx::ScaleRect(rect_in_dip, scale)); | 59 return gfx::ToFlooredRectDeprecated(gfx::ScaleRect(rect_in_dip, scale)); |
59 } | 60 } |
60 } // namespace ui | 61 } // namespace ui |
OLD | NEW |