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 static const int kWidth = 320; | 11 static const int kWidth = 320; |
12 static const int kHeight = 240; | 12 static const int kHeight = 240; |
13 static const int kBytesPerPixel = 4; // 32 bit RGB is 4 bytes per pixel. | 13 static const int kBytesPerPixel = 4; // 32 bit RGB is 4 bytes per pixel. |
14 static const int kMaxColorChannelValue = 255; | 14 static const int kMaxColorChannelValue = 255; |
15 | 15 |
16 CapturerFake::CapturerFake() | 16 CapturerFake::CapturerFake() |
17 : seed_(0) { | 17 : seed_(0) { |
18 } | 18 } |
19 | 19 |
20 CapturerFake::~CapturerFake() { | 20 CapturerFake::~CapturerFake() { |
21 } | 21 } |
22 | 22 |
23 void CapturerFake::CaptureRects(const RectVector& rects, | 23 void CapturerFake::CaptureRects(const RectVector& rects, |
24 CaptureCompletedCallback* callback) { | 24 CaptureCompletedCallback* callback) { |
25 GenerateImage(); | 25 GenerateImage(); |
26 Capturer::DataPlanes planes; | 26 DataPlanes planes; |
27 planes.data[0] = buffers_[current_buffer_].get(); | 27 planes.data[0] = buffers_[current_buffer_].get(); |
28 planes.strides[0] = bytes_per_row_; | 28 planes.strides[0] = bytes_per_row_; |
29 | 29 |
30 scoped_refptr<CaptureData> capture_data(new CaptureData(planes, | 30 scoped_refptr<CaptureData> capture_data(new CaptureData(planes, |
31 width_, | 31 width_, |
32 height_, | 32 height_, |
33 pixel_format_)); | 33 pixel_format_)); |
34 capture_data->mutable_dirty_rects() = rects; | 34 capture_data->mutable_dirty_rects() = rects; |
35 FinishCapture(capture_data, callback); | 35 FinishCapture(capture_data, callback); |
36 } | 36 } |
(...skipping 18 matching lines...) Expand all Loading... |
55 for (int x = 0; x < width_; ++x) { | 55 for (int x = 0; x < width_; ++x) { |
56 row[x * kBytesPerPixel + offset] = seed_++; | 56 row[x * kBytesPerPixel + offset] = seed_++; |
57 seed_ &= kMaxColorChannelValue; | 57 seed_ &= kMaxColorChannelValue; |
58 } | 58 } |
59 row += bytes_per_row_; | 59 row += bytes_per_row_; |
60 } | 60 } |
61 ++seed_; | 61 ++seed_; |
62 } | 62 } |
63 | 63 |
64 } // namespace remoting | 64 } // namespace remoting |
OLD | NEW |