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

Side by Side Diff: webrtc/modules/desktop_capture/mouse_cursor_monitor_win.cc

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 HDC desktop_dc_; 59 HDC desktop_dc_;
60 60
61 // The last CURSORINFO (converted to MouseCursor) we have sent to the client. 61 // The last CURSORINFO (converted to MouseCursor) we have sent to the client.
62 CURSORINFO last_cursor_; 62 CURSORINFO last_cursor_;
63 }; 63 };
64 64
65 MouseCursorMonitorWin::MouseCursorMonitorWin(HWND window) 65 MouseCursorMonitorWin::MouseCursorMonitorWin(HWND window)
66 : window_(window), 66 : window_(window),
67 screen_(kInvalidScreenId), 67 screen_(kInvalidScreenId),
68 callback_(NULL), 68 callback_(nullptr),
69 mode_(SHAPE_AND_POSITION), 69 mode_(SHAPE_AND_POSITION),
70 desktop_dc_(NULL) { 70 desktop_dc_(nullptr) {
71 memset(&last_cursor_, 0, sizeof(CURSORINFO)); 71 memset(&last_cursor_, 0, sizeof(CURSORINFO));
72 } 72 }
73 73
74 MouseCursorMonitorWin::MouseCursorMonitorWin(ScreenId screen) 74 MouseCursorMonitorWin::MouseCursorMonitorWin(ScreenId screen)
75 : window_(NULL), 75 : window_(nullptr),
76 screen_(screen), 76 screen_(screen),
77 callback_(NULL), 77 callback_(nullptr),
78 mode_(SHAPE_AND_POSITION), 78 mode_(SHAPE_AND_POSITION),
79 desktop_dc_(NULL) { 79 desktop_dc_(nullptr) {
80 assert(screen >= kFullDesktopScreenId); 80 assert(screen >= kFullDesktopScreenId);
81 memset(&last_cursor_, 0, sizeof(CURSORINFO)); 81 memset(&last_cursor_, 0, sizeof(CURSORINFO));
82 } 82 }
83 83
84 MouseCursorMonitorWin::~MouseCursorMonitorWin() { 84 MouseCursorMonitorWin::~MouseCursorMonitorWin() {
85 if (desktop_dc_) 85 if (desktop_dc_)
86 ReleaseDC(NULL, desktop_dc_); 86 ReleaseDC(nullptr, desktop_dc_);
87 } 87 }
88 88
89 void MouseCursorMonitorWin::Init(Callback* callback, Mode mode) { 89 void MouseCursorMonitorWin::Init(Callback* callback, Mode mode) {
90 assert(!callback_); 90 assert(!callback_);
91 assert(callback); 91 assert(callback);
92 92
93 callback_ = callback; 93 callback_ = callback;
94 mode_ = mode; 94 mode_ = mode;
95 95
96 desktop_dc_ = GetDC(NULL); 96 desktop_dc_ = GetDC(nullptr);
97 } 97 }
98 98
99 void MouseCursorMonitorWin::Capture() { 99 void MouseCursorMonitorWin::Capture() {
100 assert(callback_); 100 assert(callback_);
101 101
102 CURSORINFO cursor_info; 102 CURSORINFO cursor_info;
103 cursor_info.cbSize = sizeof(CURSORINFO); 103 cursor_info.cbSize = sizeof(CURSORINFO);
104 if (!GetCursorInfo(&cursor_info)) { 104 if (!GetCursorInfo(&cursor_info)) {
105 LOG_F(LS_ERROR) << "Unable to get cursor info. Error = " << GetLastError(); 105 LOG_F(LS_ERROR) << "Unable to get cursor info. Error = " << GetLastError();
106 return; 106 return;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 assert(screen_ != kInvalidScreenId); 168 assert(screen_ != kInvalidScreenId);
169 if (screen_ == kFullDesktopScreenId) { 169 if (screen_ == kFullDesktopScreenId) {
170 return DesktopRect::MakeXYWH( 170 return DesktopRect::MakeXYWH(
171 GetSystemMetrics(SM_XVIRTUALSCREEN), 171 GetSystemMetrics(SM_XVIRTUALSCREEN),
172 GetSystemMetrics(SM_YVIRTUALSCREEN), 172 GetSystemMetrics(SM_YVIRTUALSCREEN),
173 GetSystemMetrics(SM_CXVIRTUALSCREEN), 173 GetSystemMetrics(SM_CXVIRTUALSCREEN),
174 GetSystemMetrics(SM_CYVIRTUALSCREEN)); 174 GetSystemMetrics(SM_CYVIRTUALSCREEN));
175 } 175 }
176 DISPLAY_DEVICE device; 176 DISPLAY_DEVICE device;
177 device.cb = sizeof(device); 177 device.cb = sizeof(device);
178 BOOL result = EnumDisplayDevices(NULL, screen_, &device, 0); 178 BOOL result = EnumDisplayDevices(nullptr, screen_, &device, 0);
179 if (!result) 179 if (!result)
180 return DesktopRect(); 180 return DesktopRect();
181 181
182 DEVMODE device_mode; 182 DEVMODE device_mode;
183 device_mode.dmSize = sizeof(device_mode); 183 device_mode.dmSize = sizeof(device_mode);
184 device_mode.dmDriverExtra = 0; 184 device_mode.dmDriverExtra = 0;
185 result = EnumDisplaySettingsEx( 185 result = EnumDisplaySettingsEx(
186 device.DeviceName, ENUM_CURRENT_SETTINGS, &device_mode, 0); 186 device.DeviceName, ENUM_CURRENT_SETTINGS, &device_mode, 0);
187 if (!result) 187 if (!result)
188 return DesktopRect(); 188 return DesktopRect();
189 189
190 return DesktopRect::MakeXYWH(device_mode.dmPosition.x, 190 return DesktopRect::MakeXYWH(device_mode.dmPosition.x,
191 device_mode.dmPosition.y, 191 device_mode.dmPosition.y,
192 device_mode.dmPelsWidth, 192 device_mode.dmPelsWidth,
193 device_mode.dmPelsHeight); 193 device_mode.dmPelsHeight);
194 } 194 }
195 195
196 MouseCursorMonitor* MouseCursorMonitor::CreateForWindow( 196 MouseCursorMonitor* MouseCursorMonitor::CreateForWindow(
197 const DesktopCaptureOptions& options, WindowId window) { 197 const DesktopCaptureOptions& options, WindowId window) {
198 return new MouseCursorMonitorWin(reinterpret_cast<HWND>(window)); 198 return new MouseCursorMonitorWin(reinterpret_cast<HWND>(window));
199 } 199 }
200 200
201 MouseCursorMonitor* MouseCursorMonitor::CreateForScreen( 201 MouseCursorMonitor* MouseCursorMonitor::CreateForScreen(
202 const DesktopCaptureOptions& options, 202 const DesktopCaptureOptions& options,
203 ScreenId screen) { 203 ScreenId screen) {
204 return new MouseCursorMonitorWin(screen); 204 return new MouseCursorMonitorWin(screen);
205 } 205 }
206 206
207 } // namespace webrtc 207 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698