Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: ui/gfx/win/dpi.h

Issue 23498059: Remove last dependencies on ui/base from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "ui/gfx/size.h" 11 #include "ui/gfx/size.h"
12 12
13 namespace gfx { 13 namespace gfx {
14 14
15 UI_EXPORT Size GetDPI(); 15 GFX_EXPORT void InitDeviceScaleFactor(float scale);
sky 2013/09/25 19:28:15 Add a description, and should this be SetDeviceSca
16
17 GFX_EXPORT Size GetDPI();
16 18
17 // Gets the scale factor of the display. For example, if the display DPI is 19 // Gets the scale factor of the display. For example, if the display DPI is
18 // 96 then the scale factor is 1.0. 20 // 96 then the scale factor is 1.0.
19 UI_EXPORT float GetDPIScale(); 21 GFX_EXPORT float GetDPIScale();
20 22
21 UI_EXPORT bool IsInHighDPIMode(); 23 // Tests to see if the command line flag "--high-dpi-support" is set.
24 GFX_EXPORT bool IsHighDPIEnabled();
22 25
23 UI_EXPORT void EnableHighDPISupport(); 26 GFX_EXPORT bool IsInHighDPIMode();
27
28 GFX_EXPORT void EnableHighDPISupport();
24 29
25 // TODO(kevers|girard): Move above methods into win namespace. 30 // TODO(kevers|girard): Move above methods into win namespace.
26 31
27 namespace win { 32 namespace win {
28 33
29 UI_EXPORT float GetDeviceScaleFactor(); 34 GFX_EXPORT float GetDeviceScaleFactor();
30 35
31 UI_EXPORT Point ScreenToDIPPoint(const Point& pixel_point); 36 GFX_EXPORT Point ScreenToDIPPoint(const Point& pixel_point);
32 37
33 UI_EXPORT Point DIPToScreenPoint(const Point& dip_point); 38 GFX_EXPORT Point DIPToScreenPoint(const Point& dip_point);
34 39
35 UI_EXPORT Rect ScreenToDIPRect(const Rect& pixel_bounds); 40 GFX_EXPORT Rect ScreenToDIPRect(const Rect& pixel_bounds);
36 41
37 UI_EXPORT Rect DIPToScreenRect(const Rect& dip_bounds); 42 GFX_EXPORT Rect DIPToScreenRect(const Rect& dip_bounds);
38 43
39 UI_EXPORT Size ScreenToDIPSize(const Size& size_in_pixels); 44 GFX_EXPORT Size ScreenToDIPSize(const Size& size_in_pixels);
40 45
41 UI_EXPORT Size DIPToScreenSize(const Size& dip_size); 46 GFX_EXPORT Size DIPToScreenSize(const Size& dip_size);
42 47
43 // Win32's GetSystemMetrics uses pixel measures. This function calls 48 // Win32's GetSystemMetrics uses pixel measures. This function calls
44 // GetSystemMetrics for the given |metric|, then converts the result to DIP. 49 // GetSystemMetrics for the given |metric|, then converts the result to DIP.
45 UI_EXPORT int GetSystemMetricsInDIP(int metric); 50 GFX_EXPORT int GetSystemMetricsInDIP(int metric);
46 51
47 // Sometimes the OS secretly scales apps that are not DPIAware. This is not 52 // Sometimes the OS secretly scales apps that are not DPIAware. This is not
48 // visible through standard OS calls like GetWindowPos(), or through 53 // visible through standard OS calls like GetWindowPos(), or through
49 // GetDPIScale(). 54 // GetDPIScale().
50 // Returns the scale factor of the display, where 96 DPI is 1.0. 55 // Returns the scale factor of the display, where 96 DPI is 1.0.
51 // (Avoid this function... use GetDPIScale() instead.) 56 // (Avoid this function... use GetDPIScale() instead.)
52 // TODO(girard): Remove this once DPIAware is enabled - http://crbug.com/149881 57 // TODO(girard): Remove this once DPIAware is enabled - http://crbug.com/149881
53 UI_EXPORT double GetUndocumentedDPIScale(); 58 GFX_EXPORT double GetUndocumentedDPIScale();
54 59
55 // Win7 and Win8 send touch events scaled according to the current DPI 60 // 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. 61 // scaling. Win8.1 corrects this, and sends touch events in DPI units.
57 // This function returns the appropriate scaling factor for touch events. 62 // This function returns the appropriate scaling factor for touch events.
58 UI_EXPORT double GetUndocumentedDPITouchScale(); 63 GFX_EXPORT double GetUndocumentedDPITouchScale();
59 64
60 } // namespace win 65 } // namespace win
61 } // namespace gfx 66 } // namespace gfx
62 67
63 #endif // UI_GFX_DPI_WIN_H_ 68 #endif // UI_GFX_DPI_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698