Index: media/video/capture/screen/screen_capturer_fake.cc |
diff --git a/remoting/capturer/video_frame_capturer_fake.cc b/media/video/capture/screen/screen_capturer_fake.cc |
similarity index 66% |
rename from remoting/capturer/video_frame_capturer_fake.cc |
rename to media/video/capture/screen/screen_capturer_fake.cc |
index 8cdff43cc721b5ec7602c46d050657991fb845b2..d069d5425d6e8cc5f48273370cb0784ac136fbf5 100644 |
--- a/remoting/capturer/video_frame_capturer_fake.cc |
+++ b/media/video/capture/screen/screen_capturer_fake.cc |
@@ -2,18 +2,18 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "remoting/capturer/video_frame_capturer_fake.h" |
+#include "media/video/capture/screen/screen_capturer_fake.h" |
#include "base/time.h" |
-#include "remoting/capturer/capture_data.h" |
+#include "media/video/capture/screen/screen_capture_data.h" |
-namespace remoting { |
+namespace media { |
-// VideoFrameCapturerFake generates a white picture of size kWidth x kHeight |
+// ScreenCapturerFake generates a white picture of size kWidth x kHeight |
// with a rectangle of size kBoxWidth x kBoxHeight. The rectangle moves kSpeed |
// pixels per frame along both axes, and bounces off the sides of the screen. |
-static const int kWidth = VideoFrameCapturerFake::kWidth; |
-static const int kHeight = VideoFrameCapturerFake::kHeight; |
+static const int kWidth = ScreenCapturerFake::kWidth; |
+static const int kHeight = ScreenCapturerFake::kHeight; |
static const int kBoxWidth = 140; |
static const int kBoxHeight = 140; |
static const int kSpeed = 20; |
@@ -23,7 +23,7 @@ COMPILE_ASSERT((kBoxWidth % kSpeed == 0) && (kWidth % kSpeed == 0) && |
(kBoxHeight % kSpeed == 0) && (kHeight % kSpeed == 0), |
sizes_must_be_multiple_of_kSpeed); |
-VideoFrameCapturerFake::VideoFrameCapturerFake() |
+ScreenCapturerFake::ScreenCapturerFake() |
: size_(SkISize::Make(0, 0)), |
bytes_per_row_(0), |
box_pos_x_(0), |
@@ -34,21 +34,21 @@ VideoFrameCapturerFake::VideoFrameCapturerFake() |
ScreenConfigurationChanged(); |
} |
-VideoFrameCapturerFake::~VideoFrameCapturerFake() { |
+ScreenCapturerFake::~ScreenCapturerFake() { |
} |
-void VideoFrameCapturerFake::Start(Delegate* delegate) { |
+void ScreenCapturerFake::Start(Delegate* delegate) { |
delegate_ = delegate; |
} |
-void VideoFrameCapturerFake::Stop() { |
+void ScreenCapturerFake::Stop() { |
} |
-void VideoFrameCapturerFake::InvalidateRegion(const SkRegion& invalid_region) { |
+void ScreenCapturerFake::InvalidateRegion(const SkRegion& invalid_region) { |
helper_.InvalidateRegion(invalid_region); |
} |
-void VideoFrameCapturerFake::CaptureFrame() { |
+void ScreenCapturerFake::CaptureFrame() { |
base::Time capture_start_time = base::Time::Now(); |
GenerateImage(); |
@@ -59,7 +59,7 @@ void VideoFrameCapturerFake::CaptureFrame() { |
current_buffer_ = (current_buffer_ + 1) % kNumBuffers; |
- scoped_refptr<CaptureData> capture_data(new CaptureData( |
+ scoped_refptr<ScreenCaptureData> capture_data(new ScreenCaptureData( |
buffers_[current_buffer_].get(), bytes_per_row_, size_)); |
capture_data->mutable_dirty_region() = invalid_region; |
@@ -70,12 +70,13 @@ void VideoFrameCapturerFake::CaptureFrame() { |
delegate_->OnCaptureCompleted(capture_data); |
} |
-void VideoFrameCapturerFake::GenerateImage() { |
+void ScreenCapturerFake::GenerateImage() { |
memset(buffers_[current_buffer_].get(), 0xff, |
- size_.width() * size_.height() * CaptureData::kBytesPerPixel); |
+ size_.width() * size_.height() * ScreenCaptureData::kBytesPerPixel); |
uint8* row = buffers_[current_buffer_].get() + |
- (box_pos_y_ * size_.width() + box_pos_x_) * CaptureData::kBytesPerPixel; |
+ (box_pos_y_ * size_.width() + box_pos_x_) * |
+ ScreenCaptureData::kBytesPerPixel; |
box_pos_x_ += box_speed_x_; |
if (box_pos_x_ + kBoxWidth >= size_.width() || box_pos_x_ == 0) |
@@ -94,18 +95,18 @@ void VideoFrameCapturerFake::GenerateImage() { |
int r = x * 255 / kBoxWidth; |
int g = y * 255 / kBoxHeight; |
int b = 255 - (x * 255 / kBoxWidth); |
- row[x * CaptureData::kBytesPerPixel] = r; |
- row[x * CaptureData::kBytesPerPixel + 1] = g; |
- row[x * CaptureData::kBytesPerPixel + 2] = b; |
- row[x * CaptureData::kBytesPerPixel + 3] = 0xff; |
+ row[x * ScreenCaptureData::kBytesPerPixel] = r; |
+ row[x * ScreenCaptureData::kBytesPerPixel + 1] = g; |
+ row[x * ScreenCaptureData::kBytesPerPixel + 2] = b; |
+ row[x * ScreenCaptureData::kBytesPerPixel + 3] = 0xff; |
} |
row += bytes_per_row_; |
} |
} |
-void VideoFrameCapturerFake::ScreenConfigurationChanged() { |
+void ScreenCapturerFake::ScreenConfigurationChanged() { |
size_ = SkISize::Make(kWidth, kHeight); |
- bytes_per_row_ = size_.width() * CaptureData::kBytesPerPixel; |
+ bytes_per_row_ = size_.width() * ScreenCaptureData::kBytesPerPixel; |
// Create memory for the buffers. |
int buffer_size = size_.height() * bytes_per_row_; |
@@ -114,4 +115,4 @@ void VideoFrameCapturerFake::ScreenConfigurationChanged() { |
} |
} |
-} // namespace remoting |
+} // namespace media |