OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/video_frame_capturer.h" | 5 #include "remoting/host/video_frame_capturer.h" |
6 | 6 |
7 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
8 #include <Cocoa/Cocoa.h> | 8 #include <Cocoa/Cocoa.h> |
9 #include <dlfcn.h> | 9 #include <dlfcn.h> |
10 #include <IOKit/pwr_mgt/IOPMLib.h> | 10 #include <IOKit/pwr_mgt/IOPMLib.h> |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 (*cgl_set_full_screen_)(cgl_context_); | 740 (*cgl_set_full_screen_)(cgl_context_); |
741 CGLSetCurrentContext(cgl_context_); | 741 CGLSetCurrentContext(cgl_context_); |
742 | 742 |
743 size_t buffer_size = desktop_bounds_.width() * desktop_bounds_.height() * | 743 size_t buffer_size = desktop_bounds_.width() * desktop_bounds_.height() * |
744 sizeof(uint32_t); | 744 sizeof(uint32_t); |
745 pixel_buffer_object_.Init(cgl_context_, buffer_size); | 745 pixel_buffer_object_.Init(cgl_context_, buffer_size); |
746 } | 746 } |
747 | 747 |
748 void VideoFrameCapturerMac::ScreenRefresh(CGRectCount count, | 748 void VideoFrameCapturerMac::ScreenRefresh(CGRectCount count, |
749 const CGRect* rect_array) { | 749 const CGRect* rect_array) { |
750 DCHECK(!desktop_bounds_.isEmpty()); | 750 if (desktop_bounds_.isEmpty()) { |
| 751 return; |
| 752 } |
751 SkIRect skirect_array[count]; | 753 SkIRect skirect_array[count]; |
752 for (CGRectCount i = 0; i < count; ++i) { | 754 for (CGRectCount i = 0; i < count; ++i) { |
753 skirect_array[i] = CGRectToSkIRect(rect_array[i]); | 755 skirect_array[i] = CGRectToSkIRect(rect_array[i]); |
754 skirect_array[i].offset(-desktop_bounds_.left(), -desktop_bounds_.top()); | 756 skirect_array[i].offset(-desktop_bounds_.left(), -desktop_bounds_.top()); |
755 } | 757 } |
756 SkRegion region; | 758 SkRegion region; |
757 region.setRects(skirect_array, count); | 759 region.setRects(skirect_array, count); |
758 InvalidateRegion(region); | 760 InvalidateRegion(region); |
759 } | 761 } |
760 | 762 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 VideoFrameCapturer* VideoFrameCapturer::Create() { | 830 VideoFrameCapturer* VideoFrameCapturer::Create() { |
829 VideoFrameCapturerMac* capturer = new VideoFrameCapturerMac(); | 831 VideoFrameCapturerMac* capturer = new VideoFrameCapturerMac(); |
830 if (!capturer->Init()) { | 832 if (!capturer->Init()) { |
831 delete capturer; | 833 delete capturer; |
832 capturer = NULL; | 834 capturer = NULL; |
833 } | 835 } |
834 return capturer; | 836 return capturer; |
835 } | 837 } |
836 | 838 |
837 } // namespace remoting | 839 } // namespace remoting |
OLD | NEW |