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

Unified Diff: remoting/capturer/video_frame_capturer_win.cc

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
« no previous file with comments | « remoting/capturer/video_frame_capturer_unittest.cc ('k') | remoting/capturer/video_frame_queue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/capturer/video_frame_capturer_win.cc
diff --git a/remoting/host/video_frame_capturer_win.cc b/remoting/capturer/video_frame_capturer_win.cc
similarity index 93%
rename from remoting/host/video_frame_capturer_win.cc
rename to remoting/capturer/video_frame_capturer_win.cc
index 65a3c196792a84f9397f879cac75fb3496900663..e9f5ab144e253ec78f0b0956728092c405549432 100644
--- a/remoting/host/video_frame_capturer_win.cc
+++ b/remoting/capturer/video_frame_capturer_win.cc
@@ -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 <windows.h>
@@ -12,19 +12,20 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/scoped_native_library.h"
+#include "base/stl_util.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/win/scoped_gdi_object.h"
#include "base/win/scoped_hdc.h"
-#include "remoting/base/capture_data.h"
-#include "remoting/base/shared_buffer_factory.h"
-#include "remoting/host/differ.h"
-#include "remoting/host/video_frame.h"
-#include "remoting/host/video_frame_capturer_helper.h"
-#include "remoting/host/video_frame_queue.h"
-#include "remoting/host/win/desktop.h"
-#include "remoting/host/win/scoped_thread_desktop.h"
-#include "remoting/proto/control.pb.h"
+#include "remoting/capturer/capture_data.h"
+#include "remoting/capturer/differ.h"
+#include "remoting/capturer/mouse_cursor_shape.h"
+#include "remoting/capturer/shared_buffer_factory.h"
+#include "remoting/capturer/video_frame.h"
+#include "remoting/capturer/video_frame_capturer_helper.h"
+#include "remoting/capturer/video_frame_queue.h"
+#include "remoting/capturer/win/desktop.h"
+#include "remoting/capturer/win/scoped_thread_desktop.h"
#include "third_party/skia/include/core/SkColorPriv.h"
namespace remoting {
@@ -119,8 +120,7 @@ class VideoFrameCapturerWin : public VideoFrameCapturer {
// Snapshot of the last cursor bitmap we sent to the client. This is used
// to diff against the current cursor so we only send a cursor-change
// message when the shape has changed.
- scoped_array<uint8> last_cursor_;
- SkISize last_cursor_size_;
+ MouseCursorShape last_cursor_;
ScopedThreadDesktop desktop_;
@@ -214,7 +214,6 @@ void VideoFrameWin::AllocateBitmap(HDC desktop_dc, const SkISize& size) {
VideoFrameCapturerWin::VideoFrameCapturerWin()
: shared_buffer_factory_(NULL),
delegate_(NULL),
- last_cursor_size_(SkISize::Make(0, 0)),
desktop_dc_rect_(SkIRect::MakeEmpty()),
pixel_format_(media::VideoFrame::RGB32),
composition_func_(NULL) {
@@ -224,7 +223,6 @@ VideoFrameCapturerWin::VideoFrameCapturerWin(
SharedBufferFactory* shared_buffer_factory)
: shared_buffer_factory_(shared_buffer_factory),
delegate_(NULL),
- last_cursor_size_(SkISize::Make(0, 0)),
desktop_dc_rect_(SkIRect::MakeEmpty()),
pixel_format_(media::VideoFrame::RGB32),
composition_func_(NULL) {
@@ -505,11 +503,10 @@ void VideoFrameCapturerWin::CaptureCursor() {
}
int data_size = height * width * kBytesPerPixel;
- scoped_ptr<protocol::CursorShapeInfo> cursor_proto(
- new protocol::CursorShapeInfo());
- cursor_proto->mutable_data()->resize(data_size);
- uint8* cursor_dst_data = const_cast<uint8*>(reinterpret_cast<const uint8*>(
- cursor_proto->mutable_data()->data()));
+ scoped_ptr<MouseCursorShape> cursor(new MouseCursorShape());
+ cursor->data.resize(data_size);
+ uint8* cursor_dst_data =
+ reinterpret_cast<uint8*>(string_as_array(&cursor->data));
// Copy/convert cursor bitmap into format needed by chromotocol.
int row_bytes = bitmap.bmWidthBytes;
@@ -520,7 +517,7 @@ void VideoFrameCapturerWin::CaptureCursor() {
}
// Copy across colour cursor imagery.
- // CursorShapeInfo stores imagery top-down, and premultiplied
+ // MouseCursorShape stores imagery top-down, and premultiplied
// by the alpha channel, whereas windows stores them bottom-up
// and not premultiplied.
uint8* cursor_src_data = reinterpret_cast<uint8*>(bitmap.bmBits);
@@ -587,26 +584,23 @@ void VideoFrameCapturerWin::CaptureCursor() {
}
}
+ cursor->size.set(width, height);
+ cursor->hotspot.set(hotspot_x, hotspot_y);
+
// Compare the current cursor with the last one we sent to the client. If
// they're the same, then don't bother sending the cursor again.
- if (last_cursor_size_.equals(width, height) &&
- memcmp(last_cursor_.get(), cursor_dst_data, data_size) == 0) {
+ if (last_cursor_.size == cursor->size &&
+ last_cursor_.hotspot == cursor->hotspot &&
+ last_cursor_.data == cursor->data) {
return;
}
VLOG(3) << "Sending updated cursor: " << width << "x" << height;
- cursor_proto->set_width(width);
- cursor_proto->set_height(height);
- cursor_proto->set_hotspot_x(hotspot_x);
- cursor_proto->set_hotspot_y(hotspot_y);
-
// Record the last cursor image that we sent to the client.
- last_cursor_.reset(new uint8[data_size]);
- memcpy(last_cursor_.get(), cursor_dst_data, data_size);
- last_cursor_size_ = SkISize::Make(width, height);
+ last_cursor_ = *cursor;
- delegate_->OnCursorShapeChanged(cursor_proto.Pass());
+ delegate_->OnCursorShapeChanged(cursor.Pass());
}
} // namespace
« no previous file with comments | « remoting/capturer/video_frame_capturer_unittest.cc ('k') | remoting/capturer/video_frame_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698