OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/capturer_fake.h" | 5 #include "remoting/host/capturer_fake.h" |
6 | 6 |
7 #include "gfx/rect.h" | 7 #include "gfx/rect.h" |
8 | 8 |
9 namespace remoting { | 9 namespace remoting { |
10 | 10 |
11 // CapturerFake generates a white picture of size kWidth x kHeight with a | 11 // CapturerFake generates a white picture of size kWidth x kHeight with a |
12 // rectangle of size kBoxWidth x kBoxHeight. The rectangle moves kSpeed pixels | 12 // rectangle of size kBoxWidth x kBoxHeight. The rectangle moves kSpeed pixels |
13 // per frame along both axes, and bounces off the sides of the screen. | 13 // 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 CapturerFake::CapturerFake() | 27 CapturerFake::CapturerFake(MessageLoop* message_loop) |
28 : box_pos_x_(0), | 28 : Capturer(message_loop), |
| 29 box_pos_x_(0), |
29 box_pos_y_(0), | 30 box_pos_y_(0), |
30 box_speed_x_(kSpeed), | 31 box_speed_x_(kSpeed), |
31 box_speed_y_(kSpeed) { | 32 box_speed_y_(kSpeed) { |
32 ScreenConfigurationChanged(); | 33 ScreenConfigurationChanged(); |
33 } | 34 } |
34 | 35 |
35 CapturerFake::~CapturerFake() { | 36 CapturerFake::~CapturerFake() { |
36 } | 37 } |
37 | 38 |
38 void CapturerFake::ScreenConfigurationChanged() { | 39 void CapturerFake::ScreenConfigurationChanged() { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 row[x * kBytesPerPixel] = r; | 95 row[x * kBytesPerPixel] = r; |
95 row[x * kBytesPerPixel+1] = g; | 96 row[x * kBytesPerPixel+1] = g; |
96 row[x * kBytesPerPixel+2] = b; | 97 row[x * kBytesPerPixel+2] = b; |
97 row[x * kBytesPerPixel+3] = 0xff; | 98 row[x * kBytesPerPixel+3] = 0xff; |
98 } | 99 } |
99 row += bytes_per_row_; | 100 row += bytes_per_row_; |
100 } | 101 } |
101 } | 102 } |
102 | 103 |
103 } // namespace remoting | 104 } // namespace remoting |
OLD | NEW |