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

Side by Side 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: fixed up shared lib compile 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
10 namespace remoting { 7 namespace remoting {
11 8
12 CapturerHelper::CapturerHelper() : size_most_recent_(0, 0) { 9 CapturerHelper::CapturerHelper() : size_most_recent_(0, 0) {
13 } 10 }
14 11
15 CapturerHelper::~CapturerHelper() { 12 CapturerHelper::~CapturerHelper() {
16 } 13 }
17 14
18 void CapturerHelper::ClearInvalidRects() { 15 void CapturerHelper::ClearInvalidRegion() {
19 base::AutoLock auto_inval_rects_lock(inval_rects_lock_); 16 base::AutoLock auto_invalid_region_lock(invalid_region_lock_);
20 inval_rects_.clear(); 17 invalid_region_.setEmpty();
21 } 18 }
22 19
23 void CapturerHelper::InvalidateRects(const InvalidRects& inval_rects) { 20 void CapturerHelper::InvalidateRegion(const SkRegion& invalid_region) {
24 base::AutoLock auto_inval_rects_lock(inval_rects_lock_); 21 base::AutoLock auto_invalid_region_lock(invalid_region_lock_);
25 InvalidRects temp_rects; 22 invalid_region_.op(invalid_region, SkRegion::kUnion_Op);
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);
30 } 23 }
31 24
32 void CapturerHelper::InvalidateScreen(const gfx::Size& size) { 25 void CapturerHelper::InvalidateScreen(const gfx::Size& size) {
33 base::AutoLock auto_inval_rects_lock(inval_rects_lock_); 26 base::AutoLock auto_invalid_region_lock(invalid_region_lock_);
34 inval_rects_.clear(); 27 invalid_region_.op(SkIRect::MakeWH(size.width(), size.height()),
35 inval_rects_.insert(gfx::Rect(0, 0, size.width(), size.height())); 28 SkRegion::kUnion_Op);
36 } 29 }
37 30
38 void CapturerHelper::InvalidateFullScreen() { 31 void CapturerHelper::InvalidateFullScreen() {
39 if (size_most_recent_ != gfx::Size(0, 0)) 32 if (size_most_recent_ != gfx::Size(0, 0))
40 InvalidateScreen(size_most_recent_); 33 InvalidateScreen(size_most_recent_);
41 } 34 }
42 35
43 bool CapturerHelper::IsCaptureFullScreen(const gfx::Size& size) { 36 void CapturerHelper::SwapInvalidRegion(SkRegion* invalid_region) {
44 base::AutoLock auto_inval_rects_lock(inval_rects_lock_); 37 base::AutoLock auto_invalid_region_lock(invalid_region_lock_);
45 return inval_rects_.size() == 1u && 38 invalid_region->swap(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();
49 }
50
51 void CapturerHelper::SwapInvalidRects(InvalidRects& inval_rects) {
52 base::AutoLock auto_inval_rects_lock(inval_rects_lock_);
53 inval_rects.swap(inval_rects_);
54 } 39 }
55 40
56 const gfx::Size& CapturerHelper::size_most_recent() const { 41 const gfx::Size& CapturerHelper::size_most_recent() const {
57 return size_most_recent_; 42 return size_most_recent_;
58 } 43 }
59 44
60 void CapturerHelper::set_size_most_recent(const gfx::Size& size) { 45 void CapturerHelper::set_size_most_recent(const gfx::Size& size) {
61 size_most_recent_ = size; 46 size_most_recent_ = size;
62 } 47 }
63 48
64 } // namespace remoting 49 } // 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