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 #ifndef REMOTING_HOST_CAPTURER_HELPER_H_ | 5 #ifndef REMOTING_HOST_CAPTURER_HELPER_H_ |
6 #define REMOTING_HOST_CAPTURER_HELPER_H_ | 6 #define REMOTING_HOST_CAPTURER_HELPER_H_ |
7 | 7 |
8 #include "base/synchronization/lock.h" | 8 #include "base/synchronization/lock.h" |
9 #include "third_party/skia/include/core/SkRegion.h" | 9 #include "third_party/skia/include/core/SkRegion.h" |
10 #include "ui/gfx/size.h" | |
11 | 10 |
12 namespace remoting { | 11 namespace remoting { |
13 | 12 |
14 // CapturerHelper is intended to be used by an implementation of the Capturer | 13 // CapturerHelper is intended to be used by an implementation of the Capturer |
15 // interface. It maintains a thread-safe invalid region, and the size of the | 14 // interface. It maintains a thread-safe invalid region, and the size of the |
16 // most recently captured screen, on behalf of the Capturer that owns it. | 15 // most recently captured screen, on behalf of the Capturer that owns it. |
17 class CapturerHelper { | 16 class CapturerHelper { |
18 public: | 17 public: |
19 CapturerHelper(); | 18 CapturerHelper(); |
20 ~CapturerHelper(); | 19 ~CapturerHelper(); |
21 | 20 |
22 // Clear out the invalid region. | 21 // Clear out the invalid region. |
23 void ClearInvalidRegion(); | 22 void ClearInvalidRegion(); |
24 | 23 |
25 // Invalidate the specified region. | 24 // Invalidate the specified region. |
26 void InvalidateRegion(const SkRegion& invalid_region); | 25 void InvalidateRegion(const SkRegion& invalid_region); |
27 | 26 |
28 // Invalidate the entire screen, of a given size. | 27 // Invalidate the entire screen, of a given size. |
29 void InvalidateScreen(const gfx::Size& size); | 28 void InvalidateScreen(const SkISize& size); |
30 | 29 |
31 // Invalidate the entire screen, using the size of the most recently | 30 // Invalidate the entire screen, using the size of the most recently |
32 // captured screen. | 31 // captured screen. |
33 void InvalidateFullScreen(); | 32 void InvalidateFullScreen(); |
34 | 33 |
35 // Swap the given region with the stored invalid region. | 34 // Swap the given region with the stored invalid region. |
36 void SwapInvalidRegion(SkRegion* invalid_region); | 35 void SwapInvalidRegion(SkRegion* invalid_region); |
37 | 36 |
38 // Access the size of the most recently captured screen. | 37 // Access the size of the most recently captured screen. |
39 const gfx::Size& size_most_recent() const; | 38 const SkISize& size_most_recent() const; |
40 void set_size_most_recent(const gfx::Size& size); | 39 void set_size_most_recent(const SkISize& size); |
41 | 40 |
42 private: | 41 private: |
43 // A region that has been manually invalidated (through InvalidateRegion). | 42 // A region that has been manually invalidated (through InvalidateRegion). |
44 // These will be returned as dirty_region in the capture data during the next | 43 // These will be returned as dirty_region in the capture data during the next |
45 // capture. | 44 // capture. |
46 SkRegion invalid_region_; | 45 SkRegion invalid_region_; |
47 | 46 |
48 // A lock protecting |invalid_region_| across threads. | 47 // A lock protecting |invalid_region_| across threads. |
49 base::Lock invalid_region_lock_; | 48 base::Lock invalid_region_lock_; |
50 | 49 |
51 // The size of the most recently captured screen. | 50 // The size of the most recently captured screen. |
52 gfx::Size size_most_recent_; | 51 SkISize size_most_recent_; |
53 | 52 |
54 DISALLOW_COPY_AND_ASSIGN(CapturerHelper); | 53 DISALLOW_COPY_AND_ASSIGN(CapturerHelper); |
55 }; | 54 }; |
56 | 55 |
57 } // namespace remoting | 56 } // namespace remoting |
58 | 57 |
59 #endif // REMOTING_HOST_CAPTURER_HELPER_H_ | 58 #endif // REMOTING_HOST_CAPTURER_HELPER_H_ |
OLD | NEW |