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 #ifndef UI_GFX_DPI_WIN_H_ | 5 #ifndef UI_GFX_DPI_WIN_H_ |
6 #define UI_GFX_DPI_WIN_H_ | 6 #define UI_GFX_DPI_WIN_H_ |
7 | 7 |
8 #include "ui/gfx/gfx_export.h" | 8 #include "ui/gfx/gfx_export.h" |
9 #include "ui/gfx/point.h" | 9 #include "ui/gfx/point.h" |
10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 GFX_EXPORT bool IsHighDPIEnabled(); | 29 GFX_EXPORT bool IsHighDPIEnabled(); |
30 | 30 |
31 GFX_EXPORT void EnableHighDPISupport(); | 31 GFX_EXPORT void EnableHighDPISupport(); |
32 | 32 |
33 GFX_EXPORT void ForceHighDPISupportForTesting(float scale); | 33 GFX_EXPORT void ForceHighDPISupportForTesting(float scale); |
34 | 34 |
35 // TODO(kevers|girard): Move above methods into win namespace. | 35 // TODO(kevers|girard): Move above methods into win namespace. |
36 | 36 |
37 namespace win { | 37 namespace win { |
38 | 38 |
39 GFX_EXPORT float GetDeviceScaleFactor(); | |
40 | |
41 GFX_EXPORT Point ScreenToDIPPoint(const Point& pixel_point); | 39 GFX_EXPORT Point ScreenToDIPPoint(const Point& pixel_point); |
42 | 40 |
43 GFX_EXPORT Point DIPToScreenPoint(const Point& dip_point); | 41 GFX_EXPORT Point DIPToScreenPoint(const Point& dip_point); |
44 | 42 |
45 // WARNING: there is no right way to scale sizes and rects. The implementation | 43 // WARNING: there is no right way to scale sizes and rects. The implementation |
46 // of these strives to maintain a constant size by scaling the size independent | 44 // of these strives to maintain a constant size by scaling the size independent |
47 // of the origin. An alternative is to get the enclosing rect, which is the | 45 // of the origin. An alternative is to get the enclosing rect, which is the |
48 // right way for some situations. Understand which you need before blindly | 46 // right way for some situations. Understand which you need before blindly |
49 // assuming this is the right way. | 47 // assuming this is the right way. |
50 GFX_EXPORT Rect ScreenToDIPRect(const Rect& pixel_bounds); | 48 GFX_EXPORT Rect ScreenToDIPRect(const Rect& pixel_bounds); |
51 GFX_EXPORT Rect DIPToScreenRect(const Rect& dip_bounds); | 49 GFX_EXPORT Rect DIPToScreenRect(const Rect& dip_bounds); |
52 GFX_EXPORT Size ScreenToDIPSize(const Size& size_in_pixels); | 50 GFX_EXPORT Size ScreenToDIPSize(const Size& size_in_pixels); |
53 GFX_EXPORT Size DIPToScreenSize(const Size& dip_size); | 51 GFX_EXPORT Size DIPToScreenSize(const Size& dip_size); |
54 | 52 |
55 // Win32's GetSystemMetrics uses pixel measures. This function calls | 53 // Win32's GetSystemMetrics uses pixel measures. This function calls |
56 // GetSystemMetrics for the given |metric|, then converts the result to DIP. | 54 // GetSystemMetrics for the given |metric|, then converts the result to DIP. |
57 GFX_EXPORT int GetSystemMetricsInDIP(int metric); | 55 GFX_EXPORT int GetSystemMetricsInDIP(int metric); |
58 | 56 |
59 // Returns true if the global device scale factor has been explicitly set for | 57 // Returns true if the global device scale factor has been explicitly set for |
60 // the process. | 58 // the process. |
61 GFX_EXPORT bool IsDeviceScaleFactorSet(); | 59 GFX_EXPORT bool IsDeviceScaleFactorSet(); |
62 | 60 |
63 GFX_EXPORT extern const wchar_t kRegistryProfilePath[]; | 61 GFX_EXPORT extern const wchar_t kRegistryProfilePath[]; |
64 GFX_EXPORT extern const wchar_t kHighDPISupportW[]; | 62 GFX_EXPORT extern const wchar_t kHighDPISupportW[]; |
65 | 63 |
66 } // namespace win | 64 } // namespace win |
67 } // namespace gfx | 65 } // namespace gfx |
68 | 66 |
69 #endif // UI_GFX_DPI_WIN_H_ | 67 #endif // UI_GFX_DPI_WIN_H_ |
OLD | NEW |