Index: webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc |
diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc b/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc |
index 7fdc8eb43fcbde80e735ae1bce3b03fb0fd0dae9..6b4308bb7a3917fdda197a7623541339faab7f76 100644 |
--- a/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc |
+++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc |
@@ -39,7 +39,23 @@ |
ScreenCapturerWinMagnifier::ScreenCapturerWinMagnifier( |
std::unique_ptr<ScreenCapturer> fallback_capturer) |
- : fallback_capturer_(std::move(fallback_capturer)) {} |
+ : fallback_capturer_(std::move(fallback_capturer)), |
+ fallback_capturer_started_(false), |
+ callback_(NULL), |
+ current_screen_id_(kFullDesktopScreenId), |
+ excluded_window_(NULL), |
+ set_thread_execution_state_failed_(false), |
+ desktop_dc_(NULL), |
+ mag_lib_handle_(NULL), |
+ mag_initialize_func_(NULL), |
+ mag_uninitialize_func_(NULL), |
+ set_window_source_func_(NULL), |
+ set_window_filter_list_func_(NULL), |
+ set_image_scaling_callback_func_(NULL), |
+ host_window_(NULL), |
+ magnifier_window_(NULL), |
+ magnifier_initialized_(false), |
+ magnifier_capture_succeeded_(true) {} |
ScreenCapturerWinMagnifier::~ScreenCapturerWinMagnifier() { |
// DestroyWindow must be called before MagUninitialize. magnifier_window_ is |
@@ -146,14 +162,15 @@ |
helper_.set_size_most_recent(current_frame->size()); |
// Emit the current frame. |
- std::unique_ptr<DesktopFrame> frame = queue_.current_frame()->Share(); |
+ DesktopFrame* frame = queue_.current_frame()->Share(); |
frame->set_dpi(DesktopVector(GetDeviceCaps(desktop_dc_, LOGPIXELSX), |
GetDeviceCaps(desktop_dc_, LOGPIXELSY))); |
frame->mutable_updated_region()->Clear(); |
helper_.TakeInvalidRegion(frame->mutable_updated_region()); |
- frame->set_capture_time_ms((rtc::TimeNanos() - capture_start_time_nanos) / |
- rtc::kNumNanosecsPerMillisec); |
- callback_->OnCaptureResult(Result::SUCCESS, std::move(frame)); |
+ frame->set_capture_time_ms( |
+ (rtc::TimeNanos() - capture_start_time_nanos) / |
+ rtc::kNumNanosecsPerMillisec); |
+ callback_->OnCaptureCompleted(frame); |
} |
bool ScreenCapturerWinMagnifier::GetScreenList(ScreenList* screens) { |
@@ -187,8 +204,11 @@ |
// Set the magnifier control to cover the captured rect. The content of the |
// magnifier control will be the captured image. |
- BOOL result = SetWindowPos(magnifier_window_, NULL, rect.left(), rect.top(), |
- rect.width(), rect.height(), 0); |
+ BOOL result = SetWindowPos(magnifier_window_, |
+ NULL, |
+ rect.left(), rect.top(), |
+ rect.width(), rect.height(), |
+ 0); |
if (!result) { |
LOG_F(LS_WARNING) << "Failed to call SetWindowPos: " << GetLastError() |
<< ". Rect = {" << rect.left() << ", " << rect.top() |
@@ -237,7 +257,7 @@ |
bool ScreenCapturerWinMagnifier::InitializeMagnifier() { |
assert(!magnifier_initialized_); |
- desktop_dc_ = GetDC(nullptr); |
+ desktop_dc_ = GetDC(NULL); |
mag_lib_handle_ = LoadLibrary(L"Magnification.dll"); |
if (!mag_lib_handle_) |
@@ -271,7 +291,7 @@ |
return false; |
} |
- HMODULE hInstance = nullptr; |
+ HMODULE hInstance = NULL; |
result = GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, |
reinterpret_cast<char*>(&DefWindowProc), |
@@ -289,16 +309,22 @@ |
wcex.cbSize = sizeof(WNDCLASSEX); |
wcex.lpfnWndProc = &DefWindowProc; |
wcex.hInstance = hInstance; |
- wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); |
+ wcex.hCursor = LoadCursor(NULL, IDC_ARROW); |
wcex.lpszClassName = kMagnifierHostClass; |
// Ignore the error which may happen when the class is already registered. |
RegisterClassEx(&wcex); |
// Create the host window. |
- host_window_ = |
- CreateWindowEx(WS_EX_LAYERED, kMagnifierHostClass, kHostWindowName, 0, 0, |
- 0, 0, 0, nullptr, nullptr, hInstance, nullptr); |
+ host_window_ = CreateWindowEx(WS_EX_LAYERED, |
+ kMagnifierHostClass, |
+ kHostWindowName, |
+ 0, |
+ 0, 0, 0, 0, |
+ NULL, |
+ NULL, |
+ hInstance, |
+ NULL); |
if (!host_window_) { |
mag_uninitialize_func_(); |
LOG_F(LS_WARNING) << "Failed to initialize ScreenCapturerWinMagnifier: " |
@@ -307,9 +333,14 @@ |
} |
// Create the magnifier control. |
- magnifier_window_ = CreateWindow(kMagnifierWindowClass, kMagnifierWindowName, |
- WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, |
- host_window_, nullptr, hInstance, nullptr); |
+ magnifier_window_ = CreateWindow(kMagnifierWindowClass, |
+ kMagnifierWindowName, |
+ WS_CHILD | WS_VISIBLE, |
+ 0, 0, 0, 0, |
+ host_window_, |
+ NULL, |
+ hInstance, |
+ NULL); |
if (!magnifier_window_) { |
mag_uninitialize_func_(); |
LOG_F(LS_WARNING) << "Failed to initialize ScreenCapturerWinMagnifier: " |
@@ -402,7 +433,7 @@ |
? SharedMemoryDesktopFrame::Create(size, |
shared_memory_factory_.get()) |
: std::unique_ptr<DesktopFrame>(new BasicDesktopFrame(size)); |
- queue_.ReplaceCurrentFrame(SharedDesktopFrame::Wrap(std::move(frame))); |
+ queue_.ReplaceCurrentFrame(SharedDesktopFrame::Wrap(frame.release())); |
} |
} |