Chromium Code Reviews| Index: remoting/capturer/video_frame_capturer_mac.mm |
| diff --git a/remoting/host/video_frame_capturer_mac.mm b/remoting/capturer/video_frame_capturer_mac.mm |
| similarity index 95% |
| rename from remoting/host/video_frame_capturer_mac.mm |
| rename to remoting/capturer/video_frame_capturer_mac.mm |
| index 3d0d62490ae8314d592de669ca13c29f6b94e707..9843bf3151200eeaaf35c640b7ece90a39148743 100644 |
| --- a/remoting/host/video_frame_capturer_mac.mm |
| +++ b/remoting/capturer/video_frame_capturer_mac.mm |
| @@ -2,7 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "remoting/host/video_frame_capturer.h" |
| +#include "remoting/capturer/video_frame_capturer.h" |
| #include <ApplicationServices/ApplicationServices.h> |
| #include <Cocoa/Cocoa.h> |
| @@ -21,12 +21,12 @@ |
| #include "base/scoped_native_library.h" |
| #include "base/synchronization/waitable_event.h" |
| #include "base/time.h" |
| -#include "remoting/base/capture_data.h" |
| -#include "remoting/base/util.h" |
| -#include "remoting/host/mac/scoped_pixel_buffer_object.h" |
| -#include "remoting/host/video_frame.h" |
| -#include "remoting/host/video_frame_capturer_helper.h" |
| -#include "remoting/host/video_frame_queue.h" |
| +#include "remoting/capturer/capture_data.h" |
| +#include "remoting/capturer/mac/scoped_pixel_buffer_object.h" |
| +#include "remoting/capturer/mouse_cursor_shape.h" |
| +#include "remoting/capturer/video_frame.h" |
| +#include "remoting/capturer/video_frame_capturer_helper.h" |
| +#include "remoting/capturer/video_frame_queue.h" |
| #include "remoting/proto/control.pb.h" |
| namespace remoting { |
| @@ -55,6 +55,29 @@ SkIRect CGRectToSkIRect(const CGRect& rect) { |
| return sk_rect; |
| } |
| +void CopyRect(const uint8* src_plane, |
|
alexeypa (please no reviews)
2012/12/12 19:53:10
nit: Add a comment explaining what this function d
alexeypa (please no reviews)
2012/12/12 19:53:10
Did you forget to delete CopyRect from base/util.h
Sergey Ulanov
2012/12/13 02:57:23
Done.
Sergey Ulanov
2012/12/13 02:57:23
Done.
|
| + int src_plane_stride, |
| + uint8* dest_plane, |
| + int dest_plane_stride, |
| + int bytes_per_pixel, |
| + const SkIRect& rect) { |
| + // Get the address of the starting point. |
| + const int src_y_offset = src_plane_stride * rect.top(); |
| + const int dest_y_offset = dest_plane_stride * rect.top(); |
| + const int x_offset = bytes_per_pixel * rect.left(); |
| + src_plane += src_y_offset + x_offset; |
| + dest_plane += dest_y_offset + x_offset; |
| + |
| + // Copy pixels in the rectangle line by line. |
| + const int bytes_per_line = bytes_per_pixel * rect.width(); |
| + const int height = rect.height(); |
| + for (int i = 0 ; i < height; ++i) { |
| + memcpy(dest_plane, src_plane, bytes_per_line); |
| + src_plane += src_plane_stride; |
| + dest_plane += dest_plane_stride; |
| + } |
| +} |
| + |
| // The amount of time allowed for displays to reconfigure. |
| const int64 kDisplayConfigurationEventTimeoutInSeconds = 10; |
| @@ -429,24 +452,18 @@ void VideoFrameCapturerMac::CaptureCursor() { |
| if (image_data_ref.get() == NULL) { |
| return; |
| } |
| - const uint8* cursor_src_data = CFDataGetBytePtr(image_data_ref); |
| + const char* cursor_src_data = |
| + reinterpret_cast<char*>(CFDataGetBytePtr(image_data_ref)); |
| int data_size = CFDataGetLength(image_data_ref); |
| - // Create a CursorShapeInfo proto that describes the cursor and pass it to |
| + // Create a MouseCursorShape that describes the cursor and pass it to |
| // the client. |
| - scoped_ptr<protocol::CursorShapeInfo> cursor_proto( |
| - new protocol::CursorShapeInfo()); |
| - cursor_proto->mutable_data()->resize(data_size); |
| - uint8* cursor_tgt_data = const_cast<uint8*>(reinterpret_cast<const uint8*>( |
| - cursor_proto->mutable_data()->data())); |
| - |
| - memcpy(cursor_tgt_data, cursor_src_data, data_size); |
| - |
| - cursor_proto->set_width(size.width); |
| - cursor_proto->set_height(size.height); |
| - cursor_proto->set_hotspot_x(hotspot.x); |
| - cursor_proto->set_hotspot_y(hotspot.y); |
| - delegate_->OnCursorShapeChanged(cursor_proto.Pass()); |
| + scoped_ptr<MouseCursorShape> cursor; |
| + cursor->size.set(size.width, size.height); |
| + cursor->hotspot.set(hotspot.x, hotspot.y); |
| + cursor->data.assign(cursor_src_data, cursor_src_data + data_size); |
| + |
| + delegate_->OnCursorShapeChanged(cursor.Pass()); |
| // Record the last cursor image that we sent. |
| current_cursor_.reset(CGImageCreateCopy(image)); |