| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_GFX_DPI_WIN_H_ | |
| 6 #define UI_GFX_DPI_WIN_H_ | |
| 7 | |
| 8 #include "ui/gfx/gfx_export.h" | |
| 9 #include "ui/gfx/point.h" | |
| 10 #include "ui/gfx/rect.h" | |
| 11 #include "ui/gfx/size.h" | |
| 12 | |
| 13 namespace gfx { | |
| 14 | |
| 15 UI_EXPORT Size GetDPI(); | |
| 16 | |
| 17 // Gets the scale factor of the display. For example, if the display DPI is | |
| 18 // 96 then the scale factor is 1.0. | |
| 19 UI_EXPORT float GetDPIScale(); | |
| 20 | |
| 21 UI_EXPORT bool IsInHighDPIMode(); | |
| 22 | |
| 23 UI_EXPORT void EnableHighDPISupport(); | |
| 24 | |
| 25 // TODO(kevers|girard): Move above methods into win namespace. | |
| 26 | |
| 27 namespace win { | |
| 28 | |
| 29 UI_EXPORT float GetDeviceScaleFactor(); | |
| 30 | |
| 31 UI_EXPORT Point ScreenToDIPPoint(const Point& pixel_point); | |
| 32 | |
| 33 UI_EXPORT Point DIPToScreenPoint(const Point& dip_point); | |
| 34 | |
| 35 UI_EXPORT Rect ScreenToDIPRect(const Rect& pixel_bounds); | |
| 36 | |
| 37 UI_EXPORT Rect DIPToScreenRect(const Rect& dip_bounds); | |
| 38 | |
| 39 UI_EXPORT Size ScreenToDIPSize(const Size& size_in_pixels); | |
| 40 | |
| 41 UI_EXPORT Size DIPToScreenSize(const Size& dip_size); | |
| 42 | |
| 43 // Win32's GetSystemMetrics uses pixel measures. This function calls | |
| 44 // GetSystemMetrics for the given |metric|, then converts the result to DIP. | |
| 45 UI_EXPORT int GetSystemMetricsInDIP(int metric); | |
| 46 | |
| 47 // Sometimes the OS secretly scales apps that are not DPIAware. This is not | |
| 48 // visible through standard OS calls like GetWindowPos(), or through | |
| 49 // GetDPIScale(). | |
| 50 // Returns the scale factor of the display, where 96 DPI is 1.0. | |
| 51 // (Avoid this function... use GetDPIScale() instead.) | |
| 52 // TODO(girard): Remove this once DPIAware is enabled - http://crbug.com/149881 | |
| 53 UI_EXPORT double GetUndocumentedDPIScale(); | |
| 54 | |
| 55 // Win7 and Win8 send touch events scaled according to the current DPI | |
| 56 // scaling. Win8.1 corrects this, and sends touch events in DPI units. | |
| 57 // This function returns the appropriate scaling factor for touch events. | |
| 58 UI_EXPORT double GetUndocumentedDPITouchScale(); | |
| 59 | |
| 60 } // namespace win | |
| 61 } // namespace gfx | |
| 62 | |
| 63 #endif // UI_GFX_DPI_WIN_H_ | |
| OLD | NEW |