| OLD | NEW |
| 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 |
| 11 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h" | 11 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h" |
| 12 | 12 |
| 13 #include <assert.h> | 13 #include <assert.h> |
| 14 | 14 |
| 15 #include <utility> | 15 #include <utility> |
| 16 | 16 |
| 17 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" | 17 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" |
| 18 #include "webrtc/modules/desktop_capture/desktop_frame.h" | 18 #include "webrtc/modules/desktop_capture/desktop_frame.h" |
| 19 #include "webrtc/modules/desktop_capture/desktop_frame_win.h" | 19 #include "webrtc/modules/desktop_capture/desktop_frame_win.h" |
| 20 #include "webrtc/modules/desktop_capture/desktop_region.h" | 20 #include "webrtc/modules/desktop_capture/desktop_region.h" |
| 21 #include "webrtc/modules/desktop_capture/differ.h" | 21 #include "webrtc/modules/desktop_capture/differ.h" |
| 22 #include "webrtc/modules/desktop_capture/mouse_cursor.h" | 22 #include "webrtc/modules/desktop_capture/mouse_cursor.h" |
| 23 #include "webrtc/modules/desktop_capture/win/callback_shared_memory_factory.h" |
| 23 #include "webrtc/modules/desktop_capture/win/cursor.h" | 24 #include "webrtc/modules/desktop_capture/win/cursor.h" |
| 24 #include "webrtc/modules/desktop_capture/win/desktop.h" | 25 #include "webrtc/modules/desktop_capture/win/desktop.h" |
| 25 #include "webrtc/modules/desktop_capture/win/screen_capture_utils.h" | 26 #include "webrtc/modules/desktop_capture/win/screen_capture_utils.h" |
| 26 #include "webrtc/system_wrappers/include/logging.h" | 27 #include "webrtc/system_wrappers/include/logging.h" |
| 27 #include "webrtc/system_wrappers/include/tick_util.h" | 28 #include "webrtc/system_wrappers/include/tick_util.h" |
| 28 | 29 |
| 29 namespace webrtc { | 30 namespace webrtc { |
| 30 | 31 |
| 31 namespace { | 32 namespace { |
| 32 | 33 |
| 33 // Constants from dwmapi.h. | 34 // Constants from dwmapi.h. |
| 34 const UINT DWM_EC_DISABLECOMPOSITION = 0; | 35 const UINT DWM_EC_DISABLECOMPOSITION = 0; |
| 35 const UINT DWM_EC_ENABLECOMPOSITION = 1; | 36 const UINT DWM_EC_ENABLECOMPOSITION = 1; |
| 36 | 37 |
| 37 const wchar_t kDwmapiLibraryName[] = L"dwmapi.dll"; | 38 const wchar_t kDwmapiLibraryName[] = L"dwmapi.dll"; |
| 38 | 39 |
| 39 // SharedMemoryFactory that creates SharedMemory using the deprecated | |
| 40 // DesktopCapturer::Callback::CreateSharedMemory(). | |
| 41 class CallbackSharedMemoryFactory : public SharedMemoryFactory { | |
| 42 public: | |
| 43 CallbackSharedMemoryFactory(DesktopCapturer::Callback* callback) | |
| 44 : callback_(callback) {} | |
| 45 ~CallbackSharedMemoryFactory() override {} | |
| 46 | |
| 47 rtc::scoped_ptr<SharedMemory> CreateSharedMemory(size_t size) override { | |
| 48 return rtc::scoped_ptr<SharedMemory>(callback_->CreateSharedMemory(size)); | |
| 49 } | |
| 50 | |
| 51 private: | |
| 52 DesktopCapturer::Callback* callback_; | |
| 53 }; | |
| 54 | |
| 55 } // namespace | 40 } // namespace |
| 56 | 41 |
| 57 ScreenCapturerWinGdi::ScreenCapturerWinGdi(const DesktopCaptureOptions& options) | 42 ScreenCapturerWinGdi::ScreenCapturerWinGdi(const DesktopCaptureOptions& options) |
| 58 : callback_(NULL), | 43 : callback_(NULL), |
| 59 current_screen_id_(kFullDesktopScreenId), | 44 current_screen_id_(kFullDesktopScreenId), |
| 60 desktop_dc_(NULL), | 45 desktop_dc_(NULL), |
| 61 memory_dc_(NULL), | 46 memory_dc_(NULL), |
| 62 dwmapi_library_(NULL), | 47 dwmapi_library_(NULL), |
| 63 composition_func_(NULL), | 48 composition_func_(NULL), |
| 64 set_thread_execution_state_failed_(false) { | 49 set_thread_execution_state_failed_(false) { |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 SRCCOPY | CAPTUREBLT); | 268 SRCCOPY | CAPTUREBLT); |
| 284 | 269 |
| 285 // Select back the previously selected object to that the device contect | 270 // Select back the previously selected object to that the device contect |
| 286 // could be destroyed independently of the bitmap if needed. | 271 // could be destroyed independently of the bitmap if needed. |
| 287 SelectObject(memory_dc_, previous_object); | 272 SelectObject(memory_dc_, previous_object); |
| 288 } | 273 } |
| 289 return true; | 274 return true; |
| 290 } | 275 } |
| 291 | 276 |
| 292 } // namespace webrtc | 277 } // namespace webrtc |
| OLD | NEW |