Index: remoting/host/capturer_helper.cc |
diff --git a/remoting/host/capturer_helper.cc b/remoting/host/capturer_helper.cc |
index eba7c1260821c6ff0e0b5d7ba38f0c0492780a5c..34e7dc27a217641ca947005d0b2233108a023341 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,20 @@ 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(invalid_region_lock_); |
+ invalid_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& invalid_region) { |
+ base::AutoLock auto_invalid_region_lock(invalid_region_lock_); |
+ invalid_region_.op(invalid_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_invalid_region_lock(invalid_region_lock_); |
+ invalid_region_.op(SkIRect::MakeWH(size.width(), size.height()), |
+ SkRegion::kUnion_Op); |
} |
void CapturerHelper::InvalidateFullScreen() { |
@@ -40,17 +33,21 @@ void CapturerHelper::InvalidateFullScreen() { |
InvalidateScreen(size_most_recent_); |
} |
+// TODO: Is this actually required? If we decide it is there is a bug here where |
+// This will return true if the capture consists of two small rectangles at |
+// opposite corners of the desktop. Need to check that there is exactly one |
+// rectangle in the region. |
+// http://crbug.com/92346 |
Wez
2011/08/10 22:05:43
The bug is introduced by this CL, though. Can be
Lambros
2011/08/10 22:17:10
Drive-by: If you want to test whether |invalid_reg
|
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_invalid_region_lock(invalid_region_lock_); |
+ const SkIRect& bounds = invalid_region_.getBounds(); |
+ return bounds.fLeft == 0 && bounds.fTop == 0 && |
+ bounds.width() == size.width() && bounds.height() == size.height(); |
} |
-void CapturerHelper::SwapInvalidRects(InvalidRects& inval_rects) { |
- base::AutoLock auto_inval_rects_lock(inval_rects_lock_); |
- inval_rects.swap(inval_rects_); |
+void CapturerHelper::SwapInvalidRegion(SkRegion* invalid_region) { |
+ base::AutoLock auto_invalid_region_lock(invalid_region_lock_); |
+ invalid_region->swap(invalid_region_); |
} |
const gfx::Size& CapturerHelper::size_most_recent() const { |