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

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

Powered by Google App Engine
This is Rietveld 408576698