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

Side by Side Diff: remoting/host/video_frame_capturer_helper.h

Issue 11470028: Move screen capturers to remoting/capturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_HOST_VIDEO_FRAME_CAPTURER_HELPER_H_
6 #define REMOTING_HOST_VIDEO_FRAME_CAPTURER_HELPER_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "base/synchronization/lock.h"
10 #include "third_party/skia/include/core/SkRegion.h"
11
12 namespace remoting {
13
14 // VideoFrameCapturerHelper is intended to be used by an implementation of the
15 // VideoFrameCapturer interface. It maintains a thread-safe invalid region, and
16 // the size of the most recently captured screen, on behalf of the
17 // VideoFrameCapturer that owns it.
18 class VideoFrameCapturerHelper {
19 public:
20 VideoFrameCapturerHelper();
21 ~VideoFrameCapturerHelper();
22
23 // Clear out the invalid region.
24 void ClearInvalidRegion();
25
26 // Invalidate the specified region.
27 void InvalidateRegion(const SkRegion& invalid_region);
28
29 // Invalidate the entire screen, of a given size.
30 void InvalidateScreen(const SkISize& size);
31
32 // Invalidate the entire screen, using the size of the most recently
33 // captured screen.
34 void InvalidateFullScreen();
35
36 // Swap the given region with the stored invalid region.
37 void SwapInvalidRegion(SkRegion* invalid_region);
38
39 // Access the size of the most recently captured screen.
40 const SkISize& size_most_recent() const;
41 void set_size_most_recent(const SkISize& size);
42
43 // Lossy compression can result in color values leaking between pixels in one
44 // block. If part of a block changes, then unchanged parts of that block can
45 // be changed in the compressed output. So we need to re-render an entire
46 // block whenever part of the block changes.
47 //
48 // If |log_grid_size| is >= 1, then this function makes SwapInvalidRegion
49 // produce an invalid region expanded so that its vertices lie on a grid of
50 // size 2 ^ |log_grid_size|. The expanded region is then clipped to the size
51 // of the most recently captured screen, as previously set by
52 // set_size_most_recent().
53 // If |log_grid_size| is <= 0, then the invalid region is not expanded.
54 void SetLogGridSize(int log_grid_size);
55
56 // Expands a region so that its vertices all lie on a grid.
57 // The grid size must be >= 2, so |log_grid_size| must be >= 1.
58 static scoped_ptr<SkRegion> ExpandToGrid(const SkRegion& region,
59 int log_grid_size);
60
61 private:
62 // A region that has been manually invalidated (through InvalidateRegion).
63 // These will be returned as dirty_region in the capture data during the next
64 // capture.
65 SkRegion invalid_region_;
66
67 // A lock protecting |invalid_region_| across threads.
68 base::Lock invalid_region_lock_;
69
70 // The size of the most recently captured screen.
71 SkISize size_most_recent_;
72
73 // The log (base 2) of the size of the grid to which the invalid region is
74 // expanded.
75 // If the value is <= 0, then the invalid region is not expanded to a grid.
76 int log_grid_size_;
77
78 DISALLOW_COPY_AND_ASSIGN(VideoFrameCapturerHelper);
79 };
80
81 } // namespace remoting
82
83 #endif // REMOTING_HOST_VIDEO_FRAME_CAPTURER_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698