| 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 namespace remoting { | 7 namespace remoting { |
| 8 | 8 |
| 9 Capturer::Capturer() | 9 Capturer::Capturer() |
| 10 : width_(0), | 10 : width_(0), |
| 11 height_(0), | 11 height_(0), |
| 12 pixel_format_(chromotocol_pb::PixelFormatInvalid), | 12 pixel_format_(PixelFormatInvalid), |
| 13 bytes_per_pixel_(0), | 13 bytes_per_pixel_(0), |
| 14 bytes_per_row_(0), | 14 bytes_per_row_(0), |
| 15 current_buffer_(0) { | 15 current_buffer_(0) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 Capturer::~Capturer() { | 18 Capturer::~Capturer() { |
| 19 } | 19 } |
| 20 | 20 |
| 21 void Capturer::GetDirtyRects(DirtyRects* rects) const { | 21 void Capturer::GetDirtyRects(DirtyRects* rects) const { |
| 22 *rects = dirty_rects_; | 22 *rects = dirty_rects_; |
| 23 } | 23 } |
| 24 | 24 |
| 25 int Capturer::GetWidth() const { | 25 int Capturer::GetWidth() const { |
| 26 return width_; | 26 return width_; |
| 27 } | 27 } |
| 28 | 28 |
| 29 int Capturer::GetHeight() const { | 29 int Capturer::GetHeight() const { |
| 30 return height_; | 30 return height_; |
| 31 } | 31 } |
| 32 | 32 |
| 33 chromotocol_pb::PixelFormat Capturer::GetPixelFormat() const { | 33 PixelFormat Capturer::GetPixelFormat() const { |
| 34 return pixel_format_; | 34 return pixel_format_; |
| 35 } | 35 } |
| 36 | 36 |
| 37 void Capturer::InvalidateRect(gfx::Rect dirty_rect) { | 37 void Capturer::InvalidateRect(gfx::Rect dirty_rect) { |
| 38 inval_rects_.push_back(dirty_rect); | 38 inval_rects_.push_back(dirty_rect); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void Capturer::FinishCapture(Task* done_task) { | 41 void Capturer::FinishCapture(Task* done_task) { |
| 42 done_task->Run(); | 42 done_task->Run(); |
| 43 delete done_task; | 43 delete done_task; |
| 44 | 44 |
| 45 // Select the next buffer to be the current buffer. | 45 // Select the next buffer to be the current buffer. |
| 46 current_buffer_ = ++current_buffer_ % kNumBuffers; | 46 current_buffer_ = ++current_buffer_ % kNumBuffers; |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace remoting | 49 } // namespace remoting |
| OLD | NEW |