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

Side by Side Diff: ui/gfx/screen_win.cc

Issue 1543183002: Switch to standard integer types in ui/gfx/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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/gfx/screen_win.h ('k') | ui/gfx/screen_win_unittest.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 #include "ui/gfx/screen_win.h" 5 #include "ui/gfx/screen_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <stdint.h>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
11 #include "base/hash.h" 12 #include "base/hash.h"
12 #include "base/logging.h" 13 #include "base/logging.h"
13 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
14 #include "base/win/win_util.h" 15 #include "base/win/win_util.h"
15 #include "ui/gfx/display.h" 16 #include "ui/gfx/display.h"
16 #include "ui/gfx/win/dpi.h" 17 #include "ui/gfx/win/dpi.h"
17 18
18 namespace { 19 namespace {
19 20
20 MONITORINFOEX GetMonitorInfoForMonitor(HMONITOR monitor) { 21 MONITORINFOEX GetMonitorInfoForMonitor(HMONITOR monitor) {
21 MONITORINFOEX monitor_info; 22 MONITORINFOEX monitor_info;
22 ZeroMemory(&monitor_info, sizeof(MONITORINFOEX)); 23 ZeroMemory(&monitor_info, sizeof(MONITORINFOEX));
23 monitor_info.cbSize = sizeof(monitor_info); 24 monitor_info.cbSize = sizeof(monitor_info);
24 GetMonitorInfo(monitor, &monitor_info); 25 GetMonitorInfo(monitor, &monitor_info);
25 return monitor_info; 26 return monitor_info;
26 } 27 }
27 28
28 gfx::Display GetDisplay(const MONITORINFOEX& monitor_info) { 29 gfx::Display GetDisplay(const MONITORINFOEX& monitor_info) {
29 int64 id = static_cast<int64>( 30 int64_t id =
30 base::Hash(base::WideToUTF8(monitor_info.szDevice))); 31 static_cast<int64_t>(base::Hash(base::WideToUTF8(monitor_info.szDevice)));
31 gfx::Rect bounds = gfx::Rect(monitor_info.rcMonitor); 32 gfx::Rect bounds = gfx::Rect(monitor_info.rcMonitor);
32 gfx::Display display(id); 33 gfx::Display display(id);
33 display.set_bounds(gfx::win::ScreenToDIPRect(bounds)); 34 display.set_bounds(gfx::win::ScreenToDIPRect(bounds));
34 display.set_work_area( 35 display.set_work_area(
35 gfx::win::ScreenToDIPRect(gfx::Rect(monitor_info.rcWork))); 36 gfx::win::ScreenToDIPRect(gfx::Rect(monitor_info.rcWork)));
36 display.SetScaleAndBounds(gfx::GetDPIScale(), bounds); 37 display.SetScaleAndBounds(gfx::GetDPIScale(), bounds);
37 38
38 DEVMODE mode; 39 DEVMODE mode;
39 memset(&mode, 0, sizeof(DEVMODE)); 40 memset(&mode, 0, sizeof(DEVMODE));
40 mode.dmSize = sizeof(DEVMODE); 41 mode.dmSize = sizeof(DEVMODE);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 std::vector<gfx::Display> ScreenWin::GetDisplaysForMonitorInfos( 207 std::vector<gfx::Display> ScreenWin::GetDisplaysForMonitorInfos(
207 const std::vector<MONITORINFOEX>& monitor_infos) { 208 const std::vector<MONITORINFOEX>& monitor_infos) {
208 std::vector<gfx::Display> displays; 209 std::vector<gfx::Display> displays;
209 for (const MONITORINFOEX& monitor_info : monitor_infos) 210 for (const MONITORINFOEX& monitor_info : monitor_infos)
210 displays.push_back(GetDisplay(monitor_info)); 211 displays.push_back(GetDisplay(monitor_info));
211 212
212 return displays; 213 return displays;
213 } 214 }
214 215
215 } // namespace gfx 216 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/screen_win.h ('k') | ui/gfx/screen_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698