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