| 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/geometry/point.h" | 8 #include "ui/gfx/geometry/point.h" | 
| 9 #include "ui/gfx/geometry/rect.h" | 9 #include "ui/gfx/geometry/rect.h" | 
| 10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" | 
| 11 #include "ui/gfx/gfx_export.h" | 11 #include "ui/gfx/gfx_export.h" | 
|  | 12 #include "ui/gfx/native_widget_types.h" | 
| 12 | 13 | 
| 13 namespace gfx { | 14 namespace gfx { | 
| 14 | 15 | 
| 15 // Initialization of the scale factor that should be applied for rendering | 16 // Initialization of the scale factor that should be applied for rendering | 
| 16 // in this process. Must be called before attempts to call any of the getter | 17 // in this process. Must be called before attempts to call any of the getter | 
| 17 // methods below in this file, e.g. in the early toolkit/resource bundle setup. | 18 // methods below in this file, e.g. in the early toolkit/resource bundle setup. | 
| 18 // This can be called multiple times during various tests, but subsequent calls | 19 // This can be called multiple times during various tests, but subsequent calls | 
| 19 // have no effect. | 20 // have no effect. | 
| 20 GFX_EXPORT void InitDeviceScaleFactor(float scale); | 21 GFX_EXPORT void InitDeviceScaleFactor(float scale); | 
| 21 | 22 | 
| 22 GFX_EXPORT Size GetDPI(); | 23 GFX_EXPORT int GetDPIFromScalingFactor(float device_scaling_factor); | 
| 23 | 24 | 
| 24 // Gets the scale factor of the display. For example, if the display DPI is | 25 // Gets the scale factor of the display. For example, if the display DPI is | 
| 25 // 96 then the scale factor is 1.0. | 26 // 96 then the scale factor is 1.0. | 
| 26 GFX_EXPORT float GetDPIScale(); | 27 GFX_EXPORT float GetDPIScale(); | 
| 27 | 28 | 
| 28 namespace win { | 29 namespace win { | 
| 29 | 30 | 
| 30 GFX_EXPORT Point ScreenToDIPPoint(const Point& pixel_point); |  | 
| 31 |  | 
| 32 GFX_EXPORT Point DIPToScreenPoint(const Point& dip_point); |  | 
| 33 |  | 
| 34 // WARNING: there is no right way to scale sizes and rects. The implementation |  | 
| 35 // of these strives to maintain a constant size by scaling the size independent |  | 
| 36 // of the origin. An alternative is to get the enclosing rect, which is the |  | 
| 37 // right way for some situations. Understand which you need before blindly |  | 
| 38 // assuming this is the right way. |  | 
| 39 GFX_EXPORT Rect ScreenToDIPRect(const Rect& pixel_bounds); |  | 
| 40 GFX_EXPORT Rect DIPToScreenRect(const Rect& dip_bounds); |  | 
| 41 GFX_EXPORT Size ScreenToDIPSize(const Size& size_in_pixels); |  | 
| 42 GFX_EXPORT Size DIPToScreenSize(const Size& dip_size); |  | 
| 43 |  | 
| 44 // Win32's GetSystemMetrics uses pixel measures. This function calls | 31 // Win32's GetSystemMetrics uses pixel measures. This function calls | 
| 45 // GetSystemMetrics for the given |metric|, then converts the result to DIP. | 32 // GetSystemMetrics for the given |metric|, then converts the result to DIP. | 
| 46 GFX_EXPORT int GetSystemMetricsInDIP(int metric); | 33 GFX_EXPORT int GetSystemMetricsInDIP(int metric); | 
| 47 | 34 | 
| 48 }  // namespace win | 35 }  // namespace win | 
| 49 }  // namespace gfx | 36 }  // namespace gfx | 
| 50 | 37 | 
| 51 #endif  // UI_GFX_DPI_WIN_H_ | 38 #endif  // UI_GFX_DPI_WIN_H_ | 
| OLD | NEW | 
|---|