Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1660)

Unified Diff: remoting/host/capturer_win.cc

Issue 7491070: Switch over to using SkRegions to calculate dirty areas. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean up comments Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/host/capturer_win.cc
diff --git a/remoting/host/capturer_win.cc b/remoting/host/capturer_win.cc
index b5fe81e9fa468877b58a974dc1820c428d1279ef..cd7d9f2b28aa05c41d8da217962be912a32472ce 100644
--- a/remoting/host/capturer_win.cc
+++ b/remoting/host/capturer_win.cc
@@ -9,7 +9,6 @@
#include "base/memory/scoped_ptr.h"
#include "remoting/host/capturer_helper.h"
#include "remoting/host/differ.h"
-#include "ui/gfx/rect.h"
namespace remoting {
@@ -27,11 +26,12 @@ class CapturerGdi : public Capturer {
// Capturer interface.
virtual void ScreenConfigurationChanged() OVERRIDE;
virtual media::VideoFrame::Format pixel_format() const OVERRIDE;
- virtual void ClearInvalidRects() OVERRIDE;
- virtual void InvalidateRects(const InvalidRects& inval_rects) OVERRIDE;
+ virtual void ClearInvalidRegion() OVERRIDE;
+ virtual void InvalidateRegion(const SkRegion& inval_region) OVERRIDE;
virtual void InvalidateScreen(const gfx::Size& size) OVERRIDE;
virtual void InvalidateFullScreen() OVERRIDE;
- virtual void CaptureInvalidRects(CaptureCompletedCallback* callback) OVERRIDE;
+ virtual void CaptureInvalidRegion(CaptureCompletedCallback* callback)
+ OVERRIDE;
virtual const gfx::Size& size_most_recent() const OVERRIDE;
private:
@@ -60,9 +60,9 @@ class CapturerGdi : public Capturer {
// allocated for that buffer.
void ReallocateBuffer(int buffer_index, const gfx::Size& size);
- void CalculateInvalidRects();
- void CaptureRects(const InvalidRects& rects,
- CaptureCompletedCallback* callback);
+ void CalculateInvalidRegion();
+ void CaptureRegion(const SkRegion& region,
+ CaptureCompletedCallback* callback);
void ReleaseBuffers();
// Generates an image in the current buffer.
@@ -77,7 +77,7 @@ class CapturerGdi : public Capturer {
// A thread-safe list of invalid rectangles, and the size of the most
// recently captured screen.
- CapturerHelper helper;
+ CapturerHelper helper_;
// There are two buffers for the screen images, as required by Capturer.
static const int kNumBuffers = 2;
@@ -132,31 +132,31 @@ media::VideoFrame::Format CapturerGdi::pixel_format() const {
return pixel_format_;
}
-void CapturerGdi::ClearInvalidRects() {
- helper.ClearInvalidRects();
+void CapturerGdi::ClearInvalidRegion() {
+ helper_.ClearInvalidRegion();
}
-void CapturerGdi::InvalidateRects(const InvalidRects& inval_rects) {
- helper.InvalidateRects(inval_rects);
+void CapturerGdi::InvalidateRegion(const SkRegion& inval_region) {
+ helper_.InvalidateRegion(inval_region);
}
void CapturerGdi::InvalidateScreen(const gfx::Size& size) {
- helper.InvalidateScreen(size);
+ helper_.InvalidateScreen(size);
}
void CapturerGdi::InvalidateFullScreen() {
- helper.InvalidateFullScreen();
+ helper_.InvalidateFullScreen();
}
-void CapturerGdi::CaptureInvalidRects(CaptureCompletedCallback* callback) {
- CalculateInvalidRects();
- InvalidRects inval_rects;
- helper.SwapInvalidRects(inval_rects);
- CaptureRects(inval_rects, callback);
+void CapturerGdi::CaptureInvalidRegion(CaptureCompletedCallback* callback) {
+ CalculateInvalidRegion();
+ SkRegion inval_region;
+ helper_.SwapInvalidRegion(inval_region);
+ CaptureRegion(inval_region, callback);
}
const gfx::Size& CapturerGdi::size_most_recent() const {
- return helper.size_most_recent();
+ return helper_.size_most_recent();
}
void CapturerGdi::ReleaseBuffers() {
@@ -243,11 +243,11 @@ void CapturerGdi::ReallocateBuffer(int buffer_index, const gfx::Size& size) {
bmi.bmiHeader.biSizeImage / std::abs(bmi.bmiHeader.biHeight);
}
-void CapturerGdi::CalculateInvalidRects() {
+void CapturerGdi::CalculateInvalidRegion() {
CaptureImage();
const VideoFrameBuffer& current = buffers_[current_buffer_];
- if (helper.IsCaptureFullScreen(current.size))
+ if (helper_.IsCaptureFullScreen(current.size))
capture_fullscreen_ = true;
if (capture_fullscreen_) {
@@ -282,14 +282,14 @@ void CapturerGdi::CalculateInvalidRects() {
current.bytes_per_pixel, current.bytes_per_row));
}
- InvalidRects rects;
- differ_->CalcDirtyRects(prev.data, current.data, &rects);
+ SkRegion region;
+ differ_->CalcDirtyRegion(prev.data, current.data, &region);
- InvalidateRects(rects);
+ InvalidateRegion(region);
}
-void CapturerGdi::CaptureRects(const InvalidRects& rects,
- CaptureCompletedCallback* callback) {
+void CapturerGdi::CaptureRegion(const SkRegion& region,
+ CaptureCompletedCallback* callback) {
scoped_ptr<CaptureCompletedCallback> callback_deleter(callback);
const VideoFrameBuffer& buffer = buffers_[current_buffer_];
@@ -302,9 +302,9 @@ void CapturerGdi::CaptureRects(const InvalidRects& rects,
scoped_refptr<CaptureData> data(new CaptureData(planes,
buffer.size,
pixel_format_));
- data->mutable_dirty_rects() = rects;
+ data->mutable_dirty_region() = region;
- helper.set_size_most_recent(data->size());
+ helper_.set_size_most_recent(data->size());
callback->Run(data);
}

Powered by Google App Engine
This is Rietveld 408576698