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/video_frame_capturer_fake.h" | 5 #include "remoting/host/video_frame_capturer_fake.h" |
6 | 6 |
7 #include "remoting/base/capture_data.h" | 7 #include "remoting/base/capture_data.h" |
8 | 8 |
9 namespace remoting { | 9 namespace remoting { |
10 | 10 |
11 // VideoFrameCapturerFake generates a white picture of size kWidth x kHeight | 11 // VideoFrameCapturerFake generates a white picture of size kWidth x kHeight |
12 // with a rectangle of size kBoxWidth x kBoxHeight. The rectangle moves kSpeed | 12 // with a rectangle of size kBoxWidth x kBoxHeight. The rectangle moves kSpeed |
13 // pixels per frame along both axes, and bounces off the sides of the screen. | 13 // pixels per frame along both axes, and bounces off the sides of the screen. |
14 static const int kWidth = 800; | 14 static const int kWidth = 800; |
15 static const int kHeight = 600; | 15 static const int kHeight = 600; |
16 static const int kBoxWidth = 140; | 16 static const int kBoxWidth = 140; |
17 static const int kBoxHeight = 140; | 17 static const int kBoxHeight = 140; |
18 static const int kSpeed = 20; | 18 static const int kSpeed = 20; |
19 | 19 |
20 COMPILE_ASSERT(kBoxWidth < kWidth && kBoxHeight < kHeight, bad_box_size); | 20 COMPILE_ASSERT(kBoxWidth < kWidth && kBoxHeight < kHeight, bad_box_size); |
21 COMPILE_ASSERT((kBoxWidth % kSpeed == 0) && (kWidth % kSpeed == 0) && | 21 COMPILE_ASSERT((kBoxWidth % kSpeed == 0) && (kWidth % kSpeed == 0) && |
22 (kBoxHeight % kSpeed == 0) && (kHeight % kSpeed == 0), | 22 (kBoxHeight % kSpeed == 0) && (kHeight % kSpeed == 0), |
23 sizes_must_be_multiple_of_kSpeed); | 23 sizes_must_be_multiple_of_kSpeed); |
24 | 24 |
25 static const int kBytesPerPixel = 4; // 32 bit RGB is 4 bytes per pixel. | 25 static const int kBytesPerPixel = 4; // 32 bit RGB is 4 bytes per pixel. |
26 | 26 |
27 VideoFrameCapturerFake::VideoFrameCapturerFake() | 27 VideoFrameCapturerFake::VideoFrameCapturerFake() |
28 : bytes_per_row_(0), | 28 : size_(SkISize::Make(0, 0)), |
| 29 bytes_per_row_(0), |
29 box_pos_x_(0), | 30 box_pos_x_(0), |
30 box_pos_y_(0), | 31 box_pos_y_(0), |
31 box_speed_x_(kSpeed), | 32 box_speed_x_(kSpeed), |
32 box_speed_y_(kSpeed), | 33 box_speed_y_(kSpeed), |
33 current_buffer_(0), | 34 current_buffer_(0), |
34 pixel_format_(media::VideoFrame::RGB32) { | 35 pixel_format_(media::VideoFrame::RGB32) { |
35 ScreenConfigurationChanged(); | 36 ScreenConfigurationChanged(); |
36 } | 37 } |
37 | 38 |
38 VideoFrameCapturerFake::~VideoFrameCapturerFake() { | 39 VideoFrameCapturerFake::~VideoFrameCapturerFake() { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 row[x * kBytesPerPixel] = r; | 131 row[x * kBytesPerPixel] = r; |
131 row[x * kBytesPerPixel+1] = g; | 132 row[x * kBytesPerPixel+1] = g; |
132 row[x * kBytesPerPixel+2] = b; | 133 row[x * kBytesPerPixel+2] = b; |
133 row[x * kBytesPerPixel+3] = 0xff; | 134 row[x * kBytesPerPixel+3] = 0xff; |
134 } | 135 } |
135 row += bytes_per_row_; | 136 row += bytes_per_row_; |
136 } | 137 } |
137 } | 138 } |
138 | 139 |
139 } // namespace remoting | 140 } // namespace remoting |
OLD | NEW |