blob: e9479e5635083c4e9aaf3b4064868a2a2f4a8272 [file] [log] [blame]
// 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 "base/synchronization/lock.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/gfx/size.h"
namespace remoting {
// CapturerHelper is intended to be used by an implementation of the Capturer
// interface. It maintains a thread-safe invalid region, and the size of the
// most recently captured screen, on behalf of the Capturer that owns it.
class CapturerHelper {
// Clear out the invalid region.
void ClearInvalidRegion();
// Invalidate the specified region.
void InvalidateRegion(const SkRegion& invalid_region);
// Invalidate the entire screen, of a given size.
void InvalidateScreen(const gfx::Size& size);
// Invalidate the entire screen, using the size of the most recently
// captured screen.
void InvalidateFullScreen();
// Swap the given region with the stored invalid region.
void SwapInvalidRegion(SkRegion* invalid_region);
// Access the size of the most recently captured screen.
const gfx::Size& size_most_recent() const;
void set_size_most_recent(const gfx::Size& size);
// A region that has been manually invalidated (through InvalidateRegion).
// These will be returned as dirty_region in the capture data during the next
// capture.
SkRegion invalid_region_;
// A lock protecting |invalid_region_| across threads.
base::Lock invalid_region_lock_;
// The size of the most recently captured screen.
gfx::Size size_most_recent_;
} // namespace remoting