summaryrefslogtreecommitdiffstats
path: root/remoting/host/capturer_fake.cc
diff options
context:
space:
mode:
authordmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-01 15:02:53 +0000
committerdmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-01 15:02:53 +0000
commit804c99625cc375da683a6c1a681178b0014e02fe (patch)
tree444c6deffd05f7744f0d2b50077aeabde0cc7170 /remoting/host/capturer_fake.cc
parent9da1cedf45ee5bb54cc5558ca044dc24b999b8d9 (diff)
downloadchromium_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.cc')
-rw-r--r--remoting/host/capturer_fake.cc65
1 files changed, 20 insertions, 45 deletions
diff --git a/remoting/host/capturer_fake.cc b/remoting/host/capturer_fake.cc
index f1a8135..32121d2 100644
--- a/remoting/host/capturer_fake.cc
+++ b/remoting/host/capturer_fake.cc
@@ -15,61 +15,36 @@ static const int kMaxColorChannelValue = 255;
CapturerFake::CapturerFake()
: seed_(0) {
- // Dimensions of screen.
- width_ = kWidth;
- height_ = kHeight;
- pixel_format_ = PixelFormatRgb32;
- 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]);
- }
}
CapturerFake::~CapturerFake() {
}
-void CapturerFake::CaptureFullScreen(Task* done_task) {
- dirty_rects_.clear();
-
- GenerateImage();
- dirty_rects_.push_back(gfx::Rect(width_, height_));
-
- FinishCapture(done_task);
-}
-
-void CapturerFake::CaptureDirtyRects(Task* done_task) {
- dirty_rects_.clear();
-
+void CapturerFake::CaptureRects(const RectVector& rects,
+ CaptureCompletedCallback* callback) {
GenerateImage();
- // TODO(garykac): Diff old/new images and generate |dirty_rects_|.
- // Currently, this just marks the entire screen as dirty.
- dirty_rects_.push_back(gfx::Rect(width_, height_));
+ Capturer::DataPlanes planes;
+ planes.data[0] = buffers_[current_buffer_].get();
+ planes.strides[0] = bytes_per_row_;
- FinishCapture(done_task);
+ scoped_refptr<CaptureData> capture_data(new CaptureData(planes,
+ width_,
+ height_,
+ pixel_format_));
+ FinishCapture(capture_data, callback);
}
-void CapturerFake::CaptureRect(const gfx::Rect& rect, Task* done_task) {
- dirty_rects_.clear();
-
- GenerateImage();
- dirty_rects_.push_back(rect);
-
- FinishCapture(done_task);
-}
-
-void CapturerFake::GetData(const uint8* planes[]) const {
- planes[0] = buffers_[current_buffer_].get();
- planes[1] = planes[2] = NULL;
-}
+void CapturerFake::ScreenConfigurationChanged() {
+ width_ = kWidth;
+ height_ = kHeight;
+ pixel_format_ = PixelFormatRgb32;
+ bytes_per_row_ = width_ * kBytesPerPixel;
-void CapturerFake::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 CapturerFake::GenerateImage() {