Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(996)

Unified Diff: remoting/capturer/video_frame_capturer_mac.mm

Issue 11470028: Move screen capturers to remoting/capturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..cdeccdacd689863dd7863eca55d6b239751d929e 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,
+ 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,20 @@ 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());
+ MouseCursorShape cursor;
+ cursor.width = size.width;
+ cursor.height = size.height;
+ cursor.hotspot_x = hotspot.x;
+ cursor.hotspot_y = hotspot.y;
+ cursor.data.assign(cursor_src_data, cursor_src_data + data_size);
+
+ delegate_->OnCursorShapeChanged(cursor);
// Record the last cursor image that we sent.
current_cursor_.reset(CGImageCreateCopy(image));

Powered by Google App Engine
This is Rietveld 408576698