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

Unified Diff: remoting/host/capturer_helper.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_helper.cc
diff --git a/remoting/host/capturer_helper.cc b/remoting/host/capturer_helper.cc
index eba7c1260821c6ff0e0b5d7ba38f0c0492780a5c..d5ce75f8369205d7183aa1def0f4192f42e78f23 100644
--- a/remoting/host/capturer_helper.cc
+++ b/remoting/host/capturer_helper.cc
@@ -4,9 +4,6 @@
#include "remoting/host/capturer_helper.h"
-#include <algorithm>
-#include <iterator>
-
namespace remoting {
CapturerHelper::CapturerHelper() : size_most_recent_(0, 0) {
@@ -15,24 +12,19 @@ CapturerHelper::CapturerHelper() : size_most_recent_(0, 0) {
CapturerHelper::~CapturerHelper() {
}
-void CapturerHelper::ClearInvalidRects() {
- base::AutoLock auto_inval_rects_lock(inval_rects_lock_);
- inval_rects_.clear();
+void CapturerHelper::ClearInvalidRegion() {
+ base::AutoLock auto_inval_region_lock(inval_region_lock_);
+ inval_region_.setEmpty();
}
-void CapturerHelper::InvalidateRects(const InvalidRects& inval_rects) {
- base::AutoLock auto_inval_rects_lock(inval_rects_lock_);
- InvalidRects temp_rects;
- std::set_union(inval_rects_.begin(), inval_rects_.end(),
- inval_rects.begin(), inval_rects.end(),
- std::inserter(temp_rects, temp_rects.begin()));
- inval_rects_.swap(temp_rects);
+void CapturerHelper::InvalidateRegion(const SkRegion& inval_region) {
+ base::AutoLock auto_inval_region_lock(inval_region_lock_);
+ inval_region_.op(inval_region, SkRegion::kUnion_Op);
}
void CapturerHelper::InvalidateScreen(const gfx::Size& size) {
- base::AutoLock auto_inval_rects_lock(inval_rects_lock_);
- inval_rects_.clear();
- inval_rects_.insert(gfx::Rect(0, 0, size.width(), size.height()));
+ base::AutoLock auto_inval_region_lock(inval_region_lock_);
+ inval_region_.setRect(SkIRect::MakeWH(size.width(), size.height()));
Wez 2011/08/08 20:49:34 nit: Technically this should be a union operation.
dmac 2011/08/10 20:30:36 Done.
}
void CapturerHelper::InvalidateFullScreen() {
@@ -41,16 +33,15 @@ void CapturerHelper::InvalidateFullScreen() {
}
bool CapturerHelper::IsCaptureFullScreen(const gfx::Size& size) {
- base::AutoLock auto_inval_rects_lock(inval_rects_lock_);
- return inval_rects_.size() == 1u &&
- inval_rects_.begin()->x() == 0 && inval_rects_.begin()->y() == 0 &&
- inval_rects_.begin()->width() == size.width() &&
- inval_rects_.begin()->height() == size.height();
+ base::AutoLock auto_inval_region_lock(inval_region_lock_);
+ const SkIRect& bounds = inval_region_.getBounds();
+ return bounds.fLeft == 0 && bounds.fTop == 0 &&
+ bounds.width() == size.width() && bounds.height() == size.height();
Wez 2011/08/08 20:49:34 This will return true if the capture consists of t
Wez 2011/08/08 20:49:34 See above.
dmac 2011/08/10 20:30:36 Added bug and comment.
}
-void CapturerHelper::SwapInvalidRects(InvalidRects& inval_rects) {
- base::AutoLock auto_inval_rects_lock(inval_rects_lock_);
- inval_rects.swap(inval_rects_);
+void CapturerHelper::SwapInvalidRegion(SkRegion& inval_region) {
+ base::AutoLock auto_inval_region_lock(inval_region_lock_);
+ inval_region.swap(inval_region_);
}
const gfx::Size& CapturerHelper::size_most_recent() const {

Powered by Google App Engine
This is Rietveld 408576698