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

Side by Side Diff: ui/display/win/screen_win.h

Issue 2186163002: Create ScreenWin::GetSystemMetricsInDIP and Correctly Deprecate display::win::GetSystemMetricsInDIP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a comment Created 4 years, 4 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
« no previous file with comments | « ui/display/win/dpi.h ('k') | ui/display/win/screen_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_DISPLAY_WIN_SCREEN_WIN_H_ 5 #ifndef UI_DISPLAY_WIN_SCREEN_WIN_H_
6 #define UI_DISPLAY_WIN_SCREEN_WIN_H_ 6 #define UI_DISPLAY_WIN_SCREEN_WIN_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 // Converts a physical size to a DIP size. 84 // Converts a physical size to a DIP size.
85 // The DPI scale is performed relative to the display nearest to |hwnd|. 85 // The DPI scale is performed relative to the display nearest to |hwnd|.
86 static gfx::Size ScreenToDIPSize(HWND hwnd, const gfx::Size& size_in_pixels); 86 static gfx::Size ScreenToDIPSize(HWND hwnd, const gfx::Size& size_in_pixels);
87 87
88 // Converts a DIP size to a physical size. 88 // Converts a DIP size to a physical size.
89 // The DPI scale is performed relative to the display nearest to |hwnd|. 89 // The DPI scale is performed relative to the display nearest to |hwnd|.
90 static gfx::Size DIPToScreenSize(HWND hwnd, const gfx::Size& dip_size); 90 static gfx::Size DIPToScreenSize(HWND hwnd, const gfx::Size& dip_size);
91 91
92 // Returns the result of GetSystemMetrics for |metric| scaled to |hwnd|'s DPI. 92 // Returns the result of GetSystemMetrics for |metric| scaled to |hwnd|'s DPI.
93 // Use this function if you're already working with screen pixels, as this
94 // helps reduce any cascading rounding errors from DIP to the |hwnd|'s DPI.
93 static int GetSystemMetricsForHwnd(HWND hwnd, int metric); 95 static int GetSystemMetricsForHwnd(HWND hwnd, int metric);
94 96
97 // Returns the result of GetSystemMetrics for |metric| in DIP.
98 // Use this function if you need to work in DIP and can tolerate cascading
99 // rounding errors towards screen pixels.
100 static int GetSystemMetricsInDIP(int metric);
101
95 // Returns |hwnd|'s scale factor. 102 // Returns |hwnd|'s scale factor.
96 static float GetScaleFactorForHWND(HWND hwnd); 103 static float GetScaleFactorForHWND(HWND hwnd);
97 104
98 // Returns the HWND associated with the NativeView. 105 // Returns the HWND associated with the NativeView.
99 virtual HWND GetHWNDFromNativeView(gfx::NativeView window) const; 106 virtual HWND GetHWNDFromNativeView(gfx::NativeView window) const;
100 107
101 // Returns the NativeView associated with the HWND. 108 // Returns the NativeView associated with the HWND.
102 virtual gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const; 109 virtual gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const;
103 110
104 protected: 111 protected:
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // Current list of ScreenWinDisplays. 185 // Current list of ScreenWinDisplays.
179 std::vector<ScreenWinDisplay> screen_win_displays_; 186 std::vector<ScreenWinDisplay> screen_win_displays_;
180 187
181 DISALLOW_COPY_AND_ASSIGN(ScreenWin); 188 DISALLOW_COPY_AND_ASSIGN(ScreenWin);
182 }; 189 };
183 190
184 } // namespace win 191 } // namespace win
185 } // namespace display 192 } // namespace display
186 193
187 #endif // UI_DISPLAY_WIN_SCREEN_WIN_H_ 194 #endif // UI_DISPLAY_WIN_SCREEN_WIN_H_
OLDNEW
« no previous file with comments | « ui/display/win/dpi.h ('k') | ui/display/win/screen_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698