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.h" | 5 #include "remoting/host/capturer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "remoting/base/tracer.h" | 9 #include "remoting/base/tracer.h" |
10 | 10 |
11 namespace remoting { | 11 namespace remoting { |
12 | 12 |
13 Capturer::Capturer() | 13 Capturer::Capturer() |
14 : width_(0), | 14 : width_(0), |
15 height_(0), | 15 height_(0), |
16 pixel_format_(PIXEL_FORMAT_INVALID), | 16 pixel_format_(media::VideoFrame::INVALID), |
17 bytes_per_row_(0), | 17 bytes_per_row_(0), |
18 current_buffer_(0) { | 18 current_buffer_(0) { |
19 } | 19 } |
20 | 20 |
21 Capturer::~Capturer() { | 21 Capturer::~Capturer() { |
22 } | 22 } |
23 | 23 |
| 24 // Return the width of the screen. |
| 25 int Capturer::width() const { |
| 26 return width_; |
| 27 } |
| 28 |
| 29 // Return the height of the screen. |
| 30 int Capturer::height() const { |
| 31 return height_; |
| 32 } |
| 33 |
| 34 // Return the pixel format of the screen. |
| 35 media::VideoFrame::Format Capturer::pixel_format() const { |
| 36 return pixel_format_; |
| 37 } |
| 38 |
24 void Capturer::ClearInvalidRects() { | 39 void Capturer::ClearInvalidRects() { |
25 AutoLock auto_inval_rects_lock(inval_rects_lock_); | 40 AutoLock auto_inval_rects_lock(inval_rects_lock_); |
26 inval_rects_.clear(); | 41 inval_rects_.clear(); |
27 } | 42 } |
28 | 43 |
29 void Capturer::InvalidateRects(const InvalidRects& inval_rects) { | 44 void Capturer::InvalidateRects(const InvalidRects& inval_rects) { |
30 InvalidRects temp_rects; | 45 InvalidRects temp_rects; |
31 std::set_union(inval_rects_.begin(), inval_rects_.end(), | 46 std::set_union(inval_rects_.begin(), inval_rects_.end(), |
32 inval_rects.begin(), inval_rects.end(), | 47 inval_rects.begin(), inval_rects.end(), |
33 std::inserter(temp_rects, temp_rects.begin())); | 48 std::inserter(temp_rects, temp_rects.begin())); |
(...skipping 29 matching lines...) Expand all Loading... |
63 void Capturer::FinishCapture(scoped_refptr<CaptureData> data, | 78 void Capturer::FinishCapture(scoped_refptr<CaptureData> data, |
64 CaptureCompletedCallback* callback) { | 79 CaptureCompletedCallback* callback) { |
65 // Select the next buffer to be the current buffer. | 80 // Select the next buffer to be the current buffer. |
66 current_buffer_ = (current_buffer_ + 1) % kNumBuffers; | 81 current_buffer_ = (current_buffer_ + 1) % kNumBuffers; |
67 | 82 |
68 callback->Run(data); | 83 callback->Run(data); |
69 delete callback; | 84 delete callback; |
70 } | 85 } |
71 | 86 |
72 } // namespace remoting | 87 } // namespace remoting |
OLD | NEW |