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

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

Issue 7491070: Switch over to using SkRegions to calculate dirty areas. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean up comments Created 9 years, 4 months 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
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 "remoting/base/types.h" 9 #include "third_party/skia/include/core/SkRegion.h"
10 #include "ui/gfx/size.h"
10 11
11 namespace remoting { 12 namespace remoting {
12 13
13 // CapturerHelper is intended to be used by an implementation of the Capturer 14 // CapturerHelper is intended to be used by an implementation of the Capturer
14 // interface. It maintains a thread-safe list of invalid rectangles, and the 15 // interface. It maintains a thread-safe invalid region, and the size of the
15 // size of the most recently captured screen, on behalf of the Capturer that 16 // most recently captured screen, on behalf of the Capturer that owns it.
16 // owns it.
17 class CapturerHelper { 17 class CapturerHelper {
18 public: 18 public:
19 CapturerHelper(); 19 CapturerHelper();
20 ~CapturerHelper(); 20 ~CapturerHelper();
21 21
22 // Clear out the list of invalid rects. 22 // Clear out the invalid region.
23 void ClearInvalidRects(); 23 void ClearInvalidRegion();
24 24
25 // Invalidate the specified screen rects. 25 // Invalidate the specified region.
26 void InvalidateRects(const InvalidRects& inval_rects); 26 void InvalidateRegion(const SkRegion& inval_region);
27 27
28 // Invalidate the entire screen, of a given size. 28 // Invalidate the entire screen, of a given size.
29 void InvalidateScreen(const gfx::Size& size); 29 void InvalidateScreen(const gfx::Size& size);
30 30
31 // Invalidate the entire screen, using the size of the most recently 31 // Invalidate the entire screen, using the size of the most recently
32 // captured screen. 32 // captured screen.
33 void InvalidateFullScreen(); 33 void InvalidateFullScreen();
34 34
35 // Whether the invalid region is a full screen of a given size. 35 // Whether the invalid region is a full screen of a given size.
36 bool IsCaptureFullScreen(const gfx::Size& size); 36 bool IsCaptureFullScreen(const gfx::Size& size);
37 37
38 // Swap the given set of rects with the stored invalid rects. 38 // Swap the given region with the stored invalid region.
39 // This should be used like this: 39 // This should be used like this:
40 // 40 //
41 // InvalidRects inval_rects; 41 // SkRegion inval_region;
42 // common.SwapInvalidRects(inval_rects); 42 // common.SwapInvalidRegion(inval_region);
Wez 2011/08/08 20:49:34 Does this example actually add anything? How else
dmac 2011/08/10 20:30:36 Done.
43 // 43 //
44 // This passes the invalid rects to the caller, and removes them from this 44 // This passes the invalid region to the caller, and removes them from this
45 // object. The caller should then pass the raster data in those rects to the 45 // object. The caller should then pass the raster data in the region to the
46 // client. 46 // client.
47 void SwapInvalidRects(InvalidRects& inval_rects); 47 void SwapInvalidRegion(SkRegion& inval_region);
Wez 2011/08/08 20:49:34 Pass by pointer, not reference.
dmac 2011/08/10 20:30:36 Done.
48 48
49 // Access the size of the most recently captured screen. 49 // Access the size of the most recently captured screen.
50 const gfx::Size& size_most_recent() const; 50 const gfx::Size& size_most_recent() const;
51 void set_size_most_recent(const gfx::Size& size); 51 void set_size_most_recent(const gfx::Size& size);
52 52
53 private: 53 private:
54 // Rects that have been manually invalidated (through InvalidateRect). 54 // A region that has been manually invalidated (through InvalidateRegion).
55 // These will be returned as dirty_rects in the capture data during the next 55 // These will be returned as dirty_region in the capture data during the next
56 // capture. 56 // capture.
57 InvalidRects inval_rects_; 57 SkRegion inval_region_;
Wez 2011/08/08 20:49:34 Style: Rename |dirty_region| or |invalid_region|.
dmac 2011/08/10 20:30:36 Done.
58 58
59 // A lock protecting |inval_rects_| across threads. 59 // A lock protecting |inval_region_| across threads.
60 base::Lock inval_rects_lock_; 60 base::Lock inval_region_lock_;
Wez 2011/08/08 20:49:34 Rename to match region above.
dmac 2011/08/10 20:30:36 Done.
61 61
62 // The size of the most recently captured screen. 62 // The size of the most recently captured screen.
63 gfx::Size size_most_recent_; 63 gfx::Size size_most_recent_;
64 64
65 DISALLOW_COPY_AND_ASSIGN(CapturerHelper); 65 DISALLOW_COPY_AND_ASSIGN(CapturerHelper);
66 }; 66 };
67 67
68 } // namespace remoting 68 } // namespace remoting
69 69
70 #endif // REMOTING_HOST_CAPTURER_HELPER_H_ 70 #endif // REMOTING_HOST_CAPTURER_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698