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

Side by Side Diff: remoting/host/capturer_helper.cc

Issue 7622002: Revert 96327 - Switch over to using SkRegions to calculate dirty areas. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/capturer_helper.h ('k') | remoting/host/capturer_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/host/capturer_helper.h" 5 #include "remoting/host/capturer_helper.h"
6 6
7 #include <algorithm>
8 #include <iterator>
9
7 namespace remoting { 10 namespace remoting {
8 11
9 CapturerHelper::CapturerHelper() : size_most_recent_(0, 0) { 12 CapturerHelper::CapturerHelper() : size_most_recent_(0, 0) {
10 } 13 }
11 14
12 CapturerHelper::~CapturerHelper() { 15 CapturerHelper::~CapturerHelper() {
13 } 16 }
14 17
15 void CapturerHelper::ClearInvalidRegion() { 18 void CapturerHelper::ClearInvalidRects() {
16 base::AutoLock auto_invalid_region_lock(invalid_region_lock_); 19 base::AutoLock auto_inval_rects_lock(inval_rects_lock_);
17 invalid_region_.setEmpty(); 20 inval_rects_.clear();
18 } 21 }
19 22
20 void CapturerHelper::InvalidateRegion(const SkRegion& invalid_region) { 23 void CapturerHelper::InvalidateRects(const InvalidRects& inval_rects) {
21 base::AutoLock auto_invalid_region_lock(invalid_region_lock_); 24 base::AutoLock auto_inval_rects_lock(inval_rects_lock_);
22 invalid_region_.op(invalid_region, SkRegion::kUnion_Op); 25 InvalidRects temp_rects;
26 std::set_union(inval_rects_.begin(), inval_rects_.end(),
27 inval_rects.begin(), inval_rects.end(),
28 std::inserter(temp_rects, temp_rects.begin()));
29 inval_rects_.swap(temp_rects);
23 } 30 }
24 31
25 void CapturerHelper::InvalidateScreen(const gfx::Size& size) { 32 void CapturerHelper::InvalidateScreen(const gfx::Size& size) {
26 base::AutoLock auto_invalid_region_lock(invalid_region_lock_); 33 base::AutoLock auto_inval_rects_lock(inval_rects_lock_);
27 invalid_region_.op(SkIRect::MakeWH(size.width(), size.height()), 34 inval_rects_.clear();
28 SkRegion::kUnion_Op); 35 inval_rects_.insert(gfx::Rect(0, 0, size.width(), size.height()));
29 } 36 }
30 37
31 void CapturerHelper::InvalidateFullScreen() { 38 void CapturerHelper::InvalidateFullScreen() {
32 if (size_most_recent_ != gfx::Size(0, 0)) 39 if (size_most_recent_ != gfx::Size(0, 0))
33 InvalidateScreen(size_most_recent_); 40 InvalidateScreen(size_most_recent_);
34 } 41 }
35 42
36 // TODO: Is this actually required?
37 // http://crbug.com/92346
38 bool CapturerHelper::IsCaptureFullScreen(const gfx::Size& size) { 43 bool CapturerHelper::IsCaptureFullScreen(const gfx::Size& size) {
39 base::AutoLock auto_invalid_region_lock(invalid_region_lock_); 44 base::AutoLock auto_inval_rects_lock(inval_rects_lock_);
40 SkRegion fullScreenRegion(SkIRect::MakeWH(size.width(), size.height())); 45 return inval_rects_.size() == 1u &&
41 return fullScreenRegion == invalid_region_; 46 inval_rects_.begin()->x() == 0 && inval_rects_.begin()->y() == 0 &&
47 inval_rects_.begin()->width() == size.width() &&
48 inval_rects_.begin()->height() == size.height();
42 } 49 }
43 50
44 void CapturerHelper::SwapInvalidRegion(SkRegion* invalid_region) { 51 void CapturerHelper::SwapInvalidRects(InvalidRects& inval_rects) {
45 base::AutoLock auto_invalid_region_lock(invalid_region_lock_); 52 base::AutoLock auto_inval_rects_lock(inval_rects_lock_);
46 invalid_region->swap(invalid_region_); 53 inval_rects.swap(inval_rects_);
47 } 54 }
48 55
49 const gfx::Size& CapturerHelper::size_most_recent() const { 56 const gfx::Size& CapturerHelper::size_most_recent() const {
50 return size_most_recent_; 57 return size_most_recent_;
51 } 58 }
52 59
53 void CapturerHelper::set_size_most_recent(const gfx::Size& size) { 60 void CapturerHelper::set_size_most_recent(const gfx::Size& size) {
54 size_most_recent_ = size; 61 size_most_recent_ = size;
55 } 62 }
56 63
57 } // namespace remoting 64 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/capturer_helper.h ('k') | remoting/host/capturer_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698