| 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/mouse_clamping_filter.h" | 5 #include "remoting/host/mouse_clamping_filter.h" |
| 6 | 6 |
| 7 #include "remoting/capturer/video_frame_capturer.h" |
| 7 #include "remoting/proto/event.pb.h" | 8 #include "remoting/proto/event.pb.h" |
| 8 #include "remoting/proto/video.pb.h" | |
| 9 | 9 |
| 10 namespace remoting { | 10 namespace remoting { |
| 11 | 11 |
| 12 MouseClampingFilter::MouseClampingFilter( | 12 MouseClampingFilter::MouseClampingFilter(VideoFrameCapturer* capturer, |
| 13 protocol::InputStub* input_stub, | 13 protocol::InputStub* input_stub) |
| 14 protocol::VideoStub* video_stub) | 14 : MouseInputFilter(input_stub), capturer_(capturer) { |
| 15 : input_filter_(input_stub), | |
| 16 video_stub_(video_stub) { | |
| 17 } | 15 } |
| 18 | 16 |
| 19 MouseClampingFilter::~MouseClampingFilter() { | 17 MouseClampingFilter::~MouseClampingFilter() { |
| 20 } | 18 } |
| 21 | 19 |
| 22 void MouseClampingFilter::ProcessVideoPacket( | 20 void MouseClampingFilter::InjectMouseEvent(const protocol::MouseEvent& event) { |
| 23 scoped_ptr<VideoPacket> video_packet, | 21 // Ensure that the MouseInputFilter is clamping to the current dimensions. |
| 24 const base::Closure& done) { | 22 set_output_size(capturer_->size_most_recent()); |
| 25 // Configure the MouseInputFilter to clamp to the video dimensions. | 23 set_input_size(capturer_->size_most_recent()); |
| 26 if (video_packet->format().has_screen_width() && | 24 MouseInputFilter::InjectMouseEvent(event); |
| 27 video_packet->format().has_screen_height()) { | |
| 28 SkISize screen_size = SkISize::Make(video_packet->format().screen_width(), | |
| 29 video_packet->format().screen_height()); | |
| 30 input_filter_.set_input_size(screen_size); | |
| 31 input_filter_.set_output_size(screen_size); | |
| 32 } | |
| 33 | |
| 34 video_stub_->ProcessVideoPacket(video_packet.Pass(), done); | |
| 35 } | 25 } |
| 36 | 26 |
| 37 } // namespace remoting | 27 } // namespace remoting |
| OLD | NEW |