| 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_ASCII_H_ | 5 #ifndef REMOTING_HOST_CAPTURER_FAKE_ASCII_H_ |
| 6 #define REMOTING_HOST_CAPTURER_FAKE_ASCII_H_ | 6 #define REMOTING_HOST_CAPTURER_FAKE_ASCII_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 CapturerFakeAscii always outputs an image of 64x48 ASCII characters. | 14 // A CapturerFakeAscii always outputs an image of 64x48 ASCII characters. |
| 15 // This image is artificially generated for testing purpose. | 15 // This image is artificially generated for testing purpose. |
| 16 // | 16 // |
| 17 // CapturerFakeAscii is doubled buffered as required by Capturer. See | 17 // CapturerFakeAscii is doubled buffered as required by Capturer. See |
| 18 // remoting/host/capturer.h. | 18 // remoting/host/capturer.h. |
| 19 class CapturerFakeAscii : public Capturer { | 19 class CapturerFakeAscii : public Capturer { |
| 20 public: | 20 public: |
| 21 CapturerFakeAscii(); | 21 CapturerFakeAscii(); |
| 22 virtual ~CapturerFakeAscii(); | 22 virtual ~CapturerFakeAscii(); |
| 23 | 23 |
| 24 // Capturer interface. | 24 // Capturer interface. |
| 25 virtual void ScreenConfigurationChanged() OVERRIDE; | 25 virtual void ScreenConfigurationChanged() OVERRIDE; |
| 26 virtual media::VideoFrame::Format pixel_format() const OVERRIDE; | 26 virtual media::VideoFrame::Format pixel_format() const OVERRIDE; |
| 27 virtual void ClearInvalidRegion() OVERRIDE; | 27 virtual void ClearInvalidRegion() OVERRIDE; |
| 28 virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; | 28 virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; |
| 29 virtual void InvalidateScreen(const gfx::Size& size) OVERRIDE; | 29 virtual void InvalidateScreen(const SkISize& size) OVERRIDE; |
| 30 virtual void InvalidateFullScreen() OVERRIDE; | 30 virtual void InvalidateFullScreen() OVERRIDE; |
| 31 virtual void CaptureInvalidRegion(CaptureCompletedCallback* callback) | 31 virtual void CaptureInvalidRegion(CaptureCompletedCallback* callback) |
| 32 OVERRIDE; | 32 OVERRIDE; |
| 33 virtual const gfx::Size& size_most_recent() const; | 33 virtual const SkISize& size_most_recent() const; |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 // Generates an image in the front buffer. | 36 // Generates an image in the front buffer. |
| 37 void GenerateImage(); | 37 void GenerateImage(); |
| 38 | 38 |
| 39 // The screen dimensions. | 39 // The screen dimensions. |
| 40 int width_; | 40 int width_; |
| 41 int height_; | 41 int height_; |
| 42 int bytes_per_row_; | 42 int bytes_per_row_; |
| 43 | 43 |
| 44 CapturerHelper helper_; | 44 CapturerHelper helper_; |
| 45 | 45 |
| 46 // We have two buffers for the screen images as required by Capturer. | 46 // We have two buffers for the screen images as required by Capturer. |
| 47 static const int kNumBuffers = 2; | 47 static const int kNumBuffers = 2; |
| 48 scoped_array<uint8> buffers_[kNumBuffers]; | 48 scoped_array<uint8> buffers_[kNumBuffers]; |
| 49 | 49 |
| 50 // The current buffer with valid data for reading. | 50 // The current buffer with valid data for reading. |
| 51 int current_buffer_; | 51 int current_buffer_; |
| 52 | 52 |
| 53 // Format of pixels returned in buffer. | 53 // Format of pixels returned in buffer. |
| 54 media::VideoFrame::Format pixel_format_; | 54 media::VideoFrame::Format pixel_format_; |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(CapturerFakeAscii); | 56 DISALLOW_COPY_AND_ASSIGN(CapturerFakeAscii); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace remoting | 59 } // namespace remoting |
| 60 | 60 |
| 61 #endif // REMOTING_HOST_CAPTURER_FAKE_ASCII_H_ | 61 #endif // REMOTING_HOST_CAPTURER_FAKE_ASCII_H_ |
| OLD | NEW |