diff options
author | dmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-01 15:02:53 +0000 |
---|---|---|
committer | dmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-01 15:02:53 +0000 |
commit | 804c99625cc375da683a6c1a681178b0014e02fe (patch) | |
tree | 444c6deffd05f7744f0d2b50077aeabde0cc7170 /remoting/host/capturer_fake_ascii.cc | |
parent | 9da1cedf45ee5bb54cc5558ca044dc24b999b8d9 (diff) | |
download | chromium_src-804c99625cc375da683a6c1a681178b0014e02fe.zip chromium_src-804c99625cc375da683a6c1a681178b0014e02fe.tar.gz chromium_src-804c99625cc375da683a6c1a681178b0014e02fe.tar.bz2 |
Revamp capturer to clean up the interface, and to keep data as atomic as possible when making calls across threads.
TEST=build remoting
BUG=none
Review URL: http://codereview.chromium.org/2805025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51363 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/capturer_fake_ascii.cc')
-rw-r--r-- | remoting/host/capturer_fake_ascii.cc | 68 |
1 files changed, 20 insertions, 48 deletions
diff --git a/remoting/host/capturer_fake_ascii.cc b/remoting/host/capturer_fake_ascii.cc index 00f8529..d0d7479 100644 --- a/remoting/host/capturer_fake_ascii.cc +++ b/remoting/host/capturer_fake_ascii.cc @@ -13,63 +13,35 @@ static const int kHeight = 20; static const int kBytesPerPixel = 1; CapturerFakeAscii::CapturerFakeAscii() { - // Dimensions of screen. - width_ = kWidth; - height_ = kHeight; - pixel_format_ = PixelFormatAscii; - bytes_per_pixel_ = kBytesPerPixel; - bytes_per_row_ = width_ * bytes_per_pixel_; - - // Create memory for the buffers. - int buffer_size = height_ * bytes_per_row_; - for (int i = 0; i < kNumBuffers; i++) { - buffers_[i].reset(new uint8[buffer_size]); - } } CapturerFakeAscii::~CapturerFakeAscii() { } -void CapturerFakeAscii::CaptureFullScreen(Task* done_task) { - dirty_rects_.clear(); - +void CapturerFakeAscii::CaptureRects(const RectVector& rects, + CaptureCompletedCallback* callback) { GenerateImage(); - - // Return a single dirty rect that includes the entire screen. - dirty_rects_.push_back(gfx::Rect(width_, height_)); - - FinishCapture(done_task); + Capturer::DataPlanes planes; + planes.data[0] = buffers_[current_buffer_].get(); + planes.strides[0] = bytes_per_row_; + scoped_refptr<CaptureData> capture_data(new CaptureData(planes, + width_, + height_, + pixel_format_)); + FinishCapture(capture_data, callback); } -void CapturerFakeAscii::CaptureDirtyRects(Task* done_task) { - dirty_rects_.clear(); - - GenerateImage(); - // TODO(garykac): Diff old/new screen. - // Currently, this just marks the entire screen as dirty. - dirty_rects_.push_back(gfx::Rect(width_, height_)); - - FinishCapture(done_task); -} - -void CapturerFakeAscii::CaptureRect(const gfx::Rect& rect, Task* done_task) { - dirty_rects_.clear(); - - GenerateImage(); - dirty_rects_.push_back(rect); - - FinishCapture(done_task); -} - -void CapturerFakeAscii::GetData(const uint8* planes[]) const { - planes[0] = buffers_[current_buffer_].get(); - planes[1] = planes[2] = NULL; -} +void CapturerFakeAscii::ScreenConfigurationChanged() { + width_ = kWidth; + height_ = kHeight; + pixel_format_ = PixelFormatAscii; + bytes_per_row_ = width_ * kBytesPerPixel; -void CapturerFakeAscii::GetDataStride(int strides[]) const { - // Only the first plane has data. - strides[0] = bytes_per_row_; - strides[1] = strides[2] = 0; + // Create memory for the buffers. + int buffer_size = height_ * bytes_per_row_; + for (int i = 0; i < kNumBuffers; i++) { + buffers_[i].reset(new uint8[buffer_size]); + } } void CapturerFakeAscii::GenerateImage() { |