| 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 #ifndef REMOTING_HOST_VIDEO_FRAME_CAPTURER_FAKE_H_ | 5 #ifndef REMOTING_HOST_VIDEO_FRAME_CAPTURER_FAKE_H_ |
| 6 #define REMOTING_HOST_VIDEO_FRAME_CAPTURER_FAKE_H_ | 6 #define REMOTING_HOST_VIDEO_FRAME_CAPTURER_FAKE_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "remoting/host/video_frame_capturer.h" | 9 #include "remoting/host/video_frame_capturer.h" |
| 10 #include "remoting/host/video_frame_capturer_helper.h" | 10 #include "remoting/host/video_frame_capturer_helper.h" |
| 11 | 11 |
| 12 namespace remoting { | 12 namespace remoting { |
| 13 | 13 |
| 14 // A VideoFrameCapturerFake generates artificial image for testing purpose. | 14 // A VideoFrameCapturerFake generates artificial image for testing purpose. |
| 15 // | 15 // |
| 16 // VideoFrameCapturerFake is double-buffered as required by VideoFrameCapturer. | 16 // VideoFrameCapturerFake is double-buffered as required by VideoFrameCapturer. |
| 17 // See remoting/host/video_frame_capturer.h. | 17 // See remoting/host/video_frame_capturer.h. |
| 18 class VideoFrameCapturerFake : public VideoFrameCapturer { | 18 class VideoFrameCapturerFake : public VideoFrameCapturer { |
| 19 public: | 19 public: |
| 20 VideoFrameCapturerFake(); | 20 VideoFrameCapturerFake(); |
| 21 virtual ~VideoFrameCapturerFake(); | 21 virtual ~VideoFrameCapturerFake(); |
| 22 | 22 |
| 23 // Overridden from VideoFrameCapturer: | 23 // Overridden from VideoFrameCapturer: |
| 24 virtual void Start( | 24 virtual void Start( |
| 25 const CursorShapeChangedCallback& callback) OVERRIDE; | 25 const CursorShapeChangedCallback& callback) OVERRIDE; |
| 26 virtual void Stop() OVERRIDE; | 26 virtual void Stop() OVERRIDE; |
| 27 virtual void ScreenConfigurationChanged() OVERRIDE; | |
| 28 virtual media::VideoFrame::Format pixel_format() const OVERRIDE; | 27 virtual media::VideoFrame::Format pixel_format() const OVERRIDE; |
| 29 virtual void ClearInvalidRegion() OVERRIDE; | |
| 30 virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; | 28 virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; |
| 31 virtual void InvalidateScreen(const SkISize& size) OVERRIDE; | |
| 32 virtual void InvalidateFullScreen() OVERRIDE; | |
| 33 virtual void CaptureInvalidRegion( | 29 virtual void CaptureInvalidRegion( |
| 34 const CaptureCompletedCallback& callback) OVERRIDE; | 30 const CaptureCompletedCallback& callback) OVERRIDE; |
| 35 virtual const SkISize& size_most_recent() const OVERRIDE; | 31 virtual const SkISize& size_most_recent() const OVERRIDE; |
| 36 | 32 |
| 37 private: | 33 private: |
| 38 // Generates an image in the front buffer. | 34 // Generates an image in the front buffer. |
| 39 void GenerateImage(); | 35 void GenerateImage(); |
| 40 | 36 |
| 37 // Called when the screen configuration is changed. |
| 38 void ScreenConfigurationChanged(); |
| 39 |
| 41 SkISize size_; | 40 SkISize size_; |
| 42 int bytes_per_row_; | 41 int bytes_per_row_; |
| 43 int box_pos_x_; | 42 int box_pos_x_; |
| 44 int box_pos_y_; | 43 int box_pos_y_; |
| 45 int box_speed_x_; | 44 int box_speed_x_; |
| 46 int box_speed_y_; | 45 int box_speed_y_; |
| 47 | 46 |
| 48 VideoFrameCapturerHelper helper_; | 47 VideoFrameCapturerHelper helper_; |
| 49 | 48 |
| 50 // We have two buffers for the screen images as required by Capturer. | 49 // We have two buffers for the screen images as required by Capturer. |
| 51 static const int kNumBuffers = 2; | 50 static const int kNumBuffers = 2; |
| 52 scoped_array<uint8> buffers_[kNumBuffers]; | 51 scoped_array<uint8> buffers_[kNumBuffers]; |
| 53 | 52 |
| 54 // The current buffer with valid data for reading. | 53 // The current buffer with valid data for reading. |
| 55 int current_buffer_; | 54 int current_buffer_; |
| 56 | 55 |
| 57 // Format of pixels returned in buffer. | 56 // Format of pixels returned in buffer. |
| 58 media::VideoFrame::Format pixel_format_; | 57 media::VideoFrame::Format pixel_format_; |
| 59 | 58 |
| 60 DISALLOW_COPY_AND_ASSIGN(VideoFrameCapturerFake); | 59 DISALLOW_COPY_AND_ASSIGN(VideoFrameCapturerFake); |
| 61 }; | 60 }; |
| 62 | 61 |
| 63 } // namespace remoting | 62 } // namespace remoting |
| 64 | 63 |
| 65 #endif // REMOTING_HOST_VIDEO_FRAME_CAPTURER_FAKE_H_ | 64 #endif // REMOTING_HOST_VIDEO_FRAME_CAPTURER_FAKE_H_ |
| OLD | NEW |