OLD | NEW |
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 972 matching lines...) Loading... |
983 void ScreenCapturerMac::UnregisterRefreshAndMoveHandlers() { | 983 void ScreenCapturerMac::UnregisterRefreshAndMoveHandlers() { |
984 display_stream_manager_->UnregisterActiveStreams(); | 984 display_stream_manager_->UnregisterActiveStreams(); |
985 } | 985 } |
986 | 986 |
987 void ScreenCapturerMac::ScreenRefresh(CGRectCount count, | 987 void ScreenCapturerMac::ScreenRefresh(CGRectCount count, |
988 const CGRect* rect_array) { | 988 const CGRect* rect_array) { |
989 if (screen_pixel_bounds_.is_empty()) | 989 if (screen_pixel_bounds_.is_empty()) |
990 ScreenConfigurationChanged(); | 990 ScreenConfigurationChanged(); |
991 | 991 |
992 DesktopRegion region; | 992 DesktopRegion region; |
993 DesktopVector translate_vector = | |
994 DesktopVector().subtract(screen_pixel_bounds_.top_left()); | |
995 for (CGRectCount i = 0; i < count; ++i) { | 993 for (CGRectCount i = 0; i < count; ++i) { |
996 // Convert from Density-Independent Pixel to physical pixel coordinates. | 994 // Convert from Density-Independent Pixel to physical pixel coordinates. |
997 DesktopRect rect = ScaleAndRoundCGRect(rect_array[i], dip_to_pixel_scale_); | 995 DesktopRect rect = ScaleAndRoundCGRect(rect_array[i], dip_to_pixel_scale_); |
998 // Translate from local desktop to capturer framebuffer coordinates. | |
999 rect.Translate(translate_vector); | |
1000 region.AddRect(rect); | 996 region.AddRect(rect); |
1001 } | 997 } |
1002 | 998 |
1003 helper_.InvalidateRegion(region); | 999 helper_.InvalidateRegion(region); |
1004 } | 1000 } |
1005 | 1001 |
1006 std::unique_ptr<DesktopFrame> ScreenCapturerMac::CreateFrame() { | 1002 std::unique_ptr<DesktopFrame> ScreenCapturerMac::CreateFrame() { |
1007 std::unique_ptr<DesktopFrame> frame( | 1003 std::unique_ptr<DesktopFrame> frame( |
1008 new BasicDesktopFrame(screen_pixel_bounds_.size())); | 1004 new BasicDesktopFrame(screen_pixel_bounds_.size())); |
1009 frame->set_dpi(DesktopVector(kStandardDPI * dip_to_pixel_scale_, | 1005 frame->set_dpi(DesktopVector(kStandardDPI * dip_to_pixel_scale_, |
(...skipping 12 matching lines...) Loading... |
1022 std::unique_ptr<ScreenCapturerMac> capturer( | 1018 std::unique_ptr<ScreenCapturerMac> capturer( |
1023 new ScreenCapturerMac(options.configuration_monitor())); | 1019 new ScreenCapturerMac(options.configuration_monitor())); |
1024 if (!capturer.get()->Init()) { | 1020 if (!capturer.get()->Init()) { |
1025 return nullptr; | 1021 return nullptr; |
1026 } | 1022 } |
1027 | 1023 |
1028 return capturer; | 1024 return capturer; |
1029 } | 1025 } |
1030 | 1026 |
1031 } // namespace webrtc | 1027 } // namespace webrtc |
OLD | NEW |