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

Side by Side Diff: webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 if (host_window_) 45 if (host_window_)
46 DestroyWindow(host_window_); 46 DestroyWindow(host_window_);
47 47
48 if (magnifier_initialized_) 48 if (magnifier_initialized_)
49 mag_uninitialize_func_(); 49 mag_uninitialize_func_();
50 50
51 if (mag_lib_handle_) 51 if (mag_lib_handle_)
52 FreeLibrary(mag_lib_handle_); 52 FreeLibrary(mag_lib_handle_);
53 53
54 if (desktop_dc_) 54 if (desktop_dc_)
55 ReleaseDC(NULL, desktop_dc_); 55 ReleaseDC(nullptr, desktop_dc_);
56 } 56 }
57 57
58 void ScreenCapturerWinMagnifier::Start(Callback* callback) { 58 void ScreenCapturerWinMagnifier::Start(Callback* callback) {
59 RTC_DCHECK(!callback_); 59 RTC_DCHECK(!callback_);
60 RTC_DCHECK(callback); 60 RTC_DCHECK(callback);
61 callback_ = callback; 61 callback_ = callback;
62 62
63 if (!InitializeMagnifier()) { 63 if (!InitializeMagnifier()) {
64 LOG_F(LS_WARNING) << "Switching to fallback screen capturer becuase " 64 LOG_F(LS_WARNING) << "Switching to fallback screen capturer becuase "
65 "magnifier initialization failed."; 65 "magnifier initialization failed.";
(...skipping 18 matching lines...) Expand all
84 StartFallbackCapturer(); 84 StartFallbackCapturer();
85 fallback_capturer_->CaptureFrame(); 85 fallback_capturer_->CaptureFrame();
86 return; 86 return;
87 } 87 }
88 88
89 int64_t capture_start_time_nanos = rtc::TimeNanos(); 89 int64_t capture_start_time_nanos = rtc::TimeNanos();
90 90
91 // Switch to the desktop receiving user input if different from the current 91 // Switch to the desktop receiving user input if different from the current
92 // one. 92 // one.
93 std::unique_ptr<Desktop> input_desktop(Desktop::GetInputDesktop()); 93 std::unique_ptr<Desktop> input_desktop(Desktop::GetInputDesktop());
94 if (input_desktop.get() != NULL && !desktop_.IsSame(*input_desktop)) { 94 if (input_desktop.get() != nullptr && !desktop_.IsSame(*input_desktop)) {
95 // Release GDI resources otherwise SetThreadDesktop will fail. 95 // Release GDI resources otherwise SetThreadDesktop will fail.
96 if (desktop_dc_) { 96 if (desktop_dc_) {
97 ReleaseDC(NULL, desktop_dc_); 97 ReleaseDC(nullptr, desktop_dc_);
98 desktop_dc_ = NULL; 98 desktop_dc_ = nullptr;
99 } 99 }
100 // If SetThreadDesktop() fails, the thread is still assigned a desktop. 100 // If SetThreadDesktop() fails, the thread is still assigned a desktop.
101 // So we can continue capture screen bits, just from the wrong desktop. 101 // So we can continue capture screen bits, just from the wrong desktop.
102 desktop_.SetThreadDesktop(input_desktop.release()); 102 desktop_.SetThreadDesktop(input_desktop.release());
103 } 103 }
104 104
105 DesktopRect rect = GetScreenRect(current_screen_id_, current_device_key_); 105 DesktopRect rect = GetScreenRect(current_screen_id_, current_device_key_);
106 queue_.MoveToNextFrame(); 106 queue_.MoveToNextFrame();
107 CreateCurrentFrameIfNecessary(rect.size()); 107 CreateCurrentFrameIfNecessary(rect.size());
108 // CaptureImage may fail in some situations, e.g. windows8 metro mode. So 108 // CaptureImage may fail in some situations, e.g. windows8 metro mode. So
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 set_window_filter_list_func_( 150 set_window_filter_list_func_(
151 magnifier_window_, MW_FILTERMODE_EXCLUDE, 1, &excluded_window_); 151 magnifier_window_, MW_FILTERMODE_EXCLUDE, 1, &excluded_window_);
152 } 152 }
153 } 153 }
154 154
155 bool ScreenCapturerWinMagnifier::CaptureImage(const DesktopRect& rect) { 155 bool ScreenCapturerWinMagnifier::CaptureImage(const DesktopRect& rect) {
156 RTC_DCHECK(magnifier_initialized_); 156 RTC_DCHECK(magnifier_initialized_);
157 157
158 // Set the magnifier control to cover the captured rect. The content of the 158 // Set the magnifier control to cover the captured rect. The content of the
159 // magnifier control will be the captured image. 159 // magnifier control will be the captured image.
160 BOOL result = SetWindowPos(magnifier_window_, NULL, rect.left(), rect.top(), 160 BOOL result = SetWindowPos(magnifier_window_, nullptr, rect.left(),
161 rect.width(), rect.height(), 0); 161 rect.top(), rect.width(), rect.height(), 0);
162 if (!result) { 162 if (!result) {
163 LOG_F(LS_WARNING) << "Failed to call SetWindowPos: " << GetLastError() 163 LOG_F(LS_WARNING) << "Failed to call SetWindowPos: " << GetLastError()
164 << ". Rect = {" << rect.left() << ", " << rect.top() 164 << ". Rect = {" << rect.left() << ", " << rect.top()
165 << ", " << rect.right() << ", " << rect.bottom() << "}"; 165 << ", " << rect.right() << ", " << rect.bottom() << "}";
166 return false; 166 return false;
167 } 167 }
168 168
169 magnifier_capture_succeeded_ = false; 169 magnifier_capture_succeeded_ = false;
170 170
171 RECT native_rect = {rect.left(), rect.top(), rect.right(), rect.bottom()}; 171 RECT native_rect = {rect.left(), rect.top(), rect.right(), rect.bottom()};
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 RTC_DCHECK(fallback_capturer_); 380 RTC_DCHECK(fallback_capturer_);
381 if (!fallback_capturer_started_) { 381 if (!fallback_capturer_started_) {
382 fallback_capturer_started_ = true; 382 fallback_capturer_started_ = true;
383 383
384 fallback_capturer_->Start(callback_); 384 fallback_capturer_->Start(callback_);
385 fallback_capturer_->SelectSource(current_screen_id_); 385 fallback_capturer_->SelectSource(current_screen_id_);
386 } 386 }
387 } 387 }
388 388
389 } // namespace webrtc 389 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698