OLD | NEW |
| (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_CAPTURER_CAPTURE_DATA_H_ | |
6 #define REMOTING_CAPTURER_CAPTURE_DATA_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/memory/ref_counted.h" | |
12 #include "remoting/capturer/shared_buffer.h" | |
13 #include "third_party/skia/include/core/SkRegion.h" | |
14 | |
15 namespace remoting { | |
16 | |
17 class SharedBuffer; | |
18 | |
19 // Stores the data and information of a capture to pass off to the | |
20 // encoding thread. | |
21 class CaptureData : public base::RefCountedThreadSafe<CaptureData> { | |
22 public: | |
23 // 32 bit RGB is 4 bytes per pixel. | |
24 static const int kBytesPerPixel = 4; | |
25 | |
26 CaptureData(uint8* data, int stride, const SkISize& size); | |
27 | |
28 // Data buffer. | |
29 uint8* data() const { return data_; } | |
30 | |
31 // Distance in bytes between neighboring lines in the data buffer. | |
32 int stride() const { return stride_; } | |
33 | |
34 // Gets the dirty region from the previous capture. | |
35 const SkRegion& dirty_region() const { return dirty_region_; } | |
36 | |
37 // Returns the size of the image captured. | |
38 SkISize size() const { return size_; } | |
39 | |
40 SkRegion& mutable_dirty_region() { return dirty_region_; } | |
41 | |
42 // Returns the time spent on capturing. | |
43 int capture_time_ms() const { return capture_time_ms_; } | |
44 | |
45 // Sets the time spent on capturing. | |
46 void set_capture_time_ms(int capture_time_ms) { | |
47 capture_time_ms_ = capture_time_ms; | |
48 } | |
49 | |
50 int64 client_sequence_number() const { return client_sequence_number_; } | |
51 | |
52 void set_client_sequence_number(int64 client_sequence_number) { | |
53 client_sequence_number_ = client_sequence_number; | |
54 } | |
55 | |
56 SkIPoint dpi() const { return dpi_; } | |
57 | |
58 void set_dpi(const SkIPoint& dpi) { dpi_ = dpi; } | |
59 | |
60 // Returns the shared memory buffer pointed to by |data|. | |
61 scoped_refptr<SharedBuffer> shared_buffer() const { return shared_buffer_; } | |
62 | |
63 // Sets the shared memory buffer pointed to by |data|. | |
64 void set_shared_buffer(scoped_refptr<SharedBuffer> shared_buffer) { | |
65 shared_buffer_ = shared_buffer; | |
66 } | |
67 | |
68 private: | |
69 friend class base::RefCountedThreadSafe<CaptureData>; | |
70 virtual ~CaptureData(); | |
71 | |
72 uint8* data_; | |
73 int stride_; | |
74 SkRegion dirty_region_; | |
75 SkISize size_; | |
76 | |
77 // Time spent in capture. Unit is in milliseconds. | |
78 int capture_time_ms_; | |
79 | |
80 // Sequence number supplied by client for performance tracking. | |
81 int64 client_sequence_number_; | |
82 | |
83 // DPI for this frame. | |
84 SkIPoint dpi_; | |
85 | |
86 scoped_refptr<SharedBuffer> shared_buffer_; | |
87 }; | |
88 | |
89 } // namespace remoting | |
90 | |
91 #endif // REMOTING_CAPTURER_CAPTURE_DATA_H_ | |
OLD | NEW |