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

Unified Diff: remoting/host/differ.cc

Issue 7491070: Switch over to using SkRegions to calculate dirty areas. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleaned 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/differ.cc
diff --git a/remoting/host/differ.cc b/remoting/host/differ.cc
index 397bd4363350a86eadc3ab9c061091a4cab04071..6d3d06800c19c37f37b1dd507947b821bbb9eb14 100644
--- a/remoting/host/differ.cc
+++ b/remoting/host/differ.cc
@@ -26,12 +26,12 @@ Differ::Differ(int width, int height, int bpp, int stride) {
Differ::~Differ() {}
-void Differ::CalcDirtyRects(const void* prev_buffer, const void* curr_buffer,
- InvalidRects* rects) {
- if (!rects) {
+void Differ::CalcDirtyRegion(const void* prev_buffer, const void* curr_buffer,
+ SkRegion* region) {
+ if (!region) {
return;
}
- rects->clear();
+ region->setEmpty();
if (!prev_buffer || !curr_buffer) {
return;
@@ -42,7 +42,7 @@ void Differ::CalcDirtyRects(const void* prev_buffer, const void* curr_buffer,
// Now that we've identified the blocks that have changed, merge adjacent
// blocks to minimize the number of rects that we return.
- MergeBlocks(rects);
+ MergeBlocks(region);
}
void Differ::MarkDirtyBlocks(const void* prev_buffer, const void* curr_buffer) {
@@ -131,9 +131,9 @@ DiffInfo Differ::DiffPartialBlock(const uint8* prev_buffer,
return 0;
}
-void Differ::MergeBlocks(InvalidRects* rects) {
- DCHECK(rects);
- rects->clear();
+void Differ::MergeBlocks(SkRegion* region) {
+ DCHECK(region);
+ region->setEmpty();
uint8* diff_info_row_start = static_cast<uint8*>(diff_info_.get());
int diff_info_stride = diff_info_width_ * sizeof(DiffInfo);
@@ -195,7 +195,8 @@ void Differ::MergeBlocks(InvalidRects* rects) {
if (top + height > height_) {
height = height_ - top;
}
- rects->insert(gfx::Rect(left, top, width, height));
+ region->op(SkIRect::MakeXYWH(left, top, width, height),
+ SkRegion::kUnion_Op);
}
// Increment to next block in this row.

Powered by Google App Engine
This is Rietveld 408576698