| OLD | NEW |
| 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 namespace remoting { | 7 namespace remoting { |
| 8 | 8 |
| 9 CapturerHelper::CapturerHelper() : size_most_recent_(0, 0) { | 9 CapturerHelper::CapturerHelper() : size_most_recent_(SkISize::Make(0, 0)) { |
| 10 } | 10 } |
| 11 | 11 |
| 12 CapturerHelper::~CapturerHelper() { | 12 CapturerHelper::~CapturerHelper() { |
| 13 } | 13 } |
| 14 | 14 |
| 15 void CapturerHelper::ClearInvalidRegion() { | 15 void CapturerHelper::ClearInvalidRegion() { |
| 16 base::AutoLock auto_invalid_region_lock(invalid_region_lock_); | 16 base::AutoLock auto_invalid_region_lock(invalid_region_lock_); |
| 17 invalid_region_.setEmpty(); | 17 invalid_region_.setEmpty(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 void CapturerHelper::InvalidateRegion(const SkRegion& invalid_region) { | 20 void CapturerHelper::InvalidateRegion(const SkRegion& invalid_region) { |
| 21 base::AutoLock auto_invalid_region_lock(invalid_region_lock_); | 21 base::AutoLock auto_invalid_region_lock(invalid_region_lock_); |
| 22 invalid_region_.op(invalid_region, SkRegion::kUnion_Op); | 22 invalid_region_.op(invalid_region, SkRegion::kUnion_Op); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void CapturerHelper::InvalidateScreen(const gfx::Size& size) { | 25 void CapturerHelper::InvalidateScreen(const SkISize& size) { |
| 26 base::AutoLock auto_invalid_region_lock(invalid_region_lock_); | 26 base::AutoLock auto_invalid_region_lock(invalid_region_lock_); |
| 27 invalid_region_.op(SkIRect::MakeWH(size.width(), size.height()), | 27 invalid_region_.op(SkIRect::MakeWH(size.width(), size.height()), |
| 28 SkRegion::kUnion_Op); | 28 SkRegion::kUnion_Op); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void CapturerHelper::InvalidateFullScreen() { | 31 void CapturerHelper::InvalidateFullScreen() { |
| 32 if (size_most_recent_ != gfx::Size(0, 0)) | 32 if (!size_most_recent_.isZero()) |
| 33 InvalidateScreen(size_most_recent_); | 33 InvalidateScreen(size_most_recent_); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void CapturerHelper::SwapInvalidRegion(SkRegion* invalid_region) { | 36 void CapturerHelper::SwapInvalidRegion(SkRegion* invalid_region) { |
| 37 base::AutoLock auto_invalid_region_lock(invalid_region_lock_); | 37 base::AutoLock auto_invalid_region_lock(invalid_region_lock_); |
| 38 invalid_region->swap(invalid_region_); | 38 invalid_region->swap(invalid_region_); |
| 39 } | 39 } |
| 40 | 40 |
| 41 const gfx::Size& CapturerHelper::size_most_recent() const { | 41 const SkISize& CapturerHelper::size_most_recent() const { |
| 42 return size_most_recent_; | 42 return size_most_recent_; |
| 43 } | 43 } |
| 44 | 44 |
| 45 void CapturerHelper::set_size_most_recent(const gfx::Size& size) { | 45 void CapturerHelper::set_size_most_recent(const SkISize& size) { |
| 46 size_most_recent_ = size; | 46 size_most_recent_ = size; |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace remoting | 49 } // namespace remoting |
| OLD | NEW |