summaryrefslogtreecommitdiffstats
path: root/remoting/host/capturer_helper.cc
blob: 12e7d86782938fa6b953c9c2648444e1a7fdd8ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "remoting/host/capturer_helper.h"

namespace remoting {

CapturerHelper::CapturerHelper() : size_most_recent_(0, 0) {
}

CapturerHelper::~CapturerHelper() {
}

void CapturerHelper::ClearInvalidRegion() {
  base::AutoLock auto_invalid_region_lock(invalid_region_lock_);
  invalid_region_.setEmpty();
}

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_invalid_region_lock(invalid_region_lock_);
  invalid_region_.op(SkIRect::MakeWH(size.width(), size.height()),
                     SkRegion::kUnion_Op);
}

void CapturerHelper::InvalidateFullScreen() {
  if (size_most_recent_ != gfx::Size(0, 0))
    InvalidateScreen(size_most_recent_);
}

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 {
  return size_most_recent_;
}

void CapturerHelper::set_size_most_recent(const gfx::Size& size) {
  size_most_recent_ = size;
}

}  // namespace remoting