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