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 // Don't include this file in any .h files because it pulls in some X headers. | 5 // Don't include this file in any .h files because it pulls in some X headers. |
6 | 6 |
7 #ifndef REMOTING_HOST_X_SERVER_PIXEL_BUFFER_H_ | 7 #ifndef REMOTING_HOST_X_SERVER_PIXEL_BUFFER_H_ |
8 #define REMOTING_HOST_X_SERVER_PIXEL_BUFFER_H_ | 8 #define REMOTING_HOST_X_SERVER_PIXEL_BUFFER_H_ |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "ui/gfx/rect.h" | 12 #include "third_party/skia/include/core/SkRect.h" |
13 | 13 |
14 #include <X11/Xutil.h> | 14 #include <X11/Xutil.h> |
15 #include <X11/extensions/XShm.h> | 15 #include <X11/extensions/XShm.h> |
16 | 16 |
17 namespace remoting { | 17 namespace remoting { |
18 | 18 |
19 // A class to allow the X server's pixel buffer to be accessed as efficiently | 19 // A class to allow the X server's pixel buffer to be accessed as efficiently |
20 // as possible. | 20 // as possible. |
21 class XServerPixelBuffer { | 21 class XServerPixelBuffer { |
22 public: | 22 public: |
23 XServerPixelBuffer(); | 23 XServerPixelBuffer(); |
24 ~XServerPixelBuffer(); | 24 ~XServerPixelBuffer(); |
25 | 25 |
26 void Release(); | 26 void Release(); |
27 void Init(Display* display); | 27 void Init(Display* display); |
28 | 28 |
29 // If shared memory is being used without pixmaps, synchronize this pixel | 29 // If shared memory is being used without pixmaps, synchronize this pixel |
30 // buffer with the root window contents (otherwise, this is a no-op). | 30 // buffer with the root window contents (otherwise, this is a no-op). |
31 // This is to avoid doing a full-screen capture for each individual | 31 // This is to avoid doing a full-screen capture for each individual |
32 // rectangle in the capture list, when it only needs to be done once at the | 32 // rectangle in the capture list, when it only needs to be done once at the |
33 // beginning. | 33 // beginning. |
34 void Synchronize(); | 34 void Synchronize(); |
35 | 35 |
36 // Capture the specified rectangle and return a pointer to its top-left pixel | 36 // Capture the specified rectangle and return a pointer to its top-left pixel |
37 // or NULL if capture fails. The returned pointer remains valid until the next | 37 // or NULL if capture fails. The returned pointer remains valid until the next |
38 // call to CaptureRect. | 38 // call to CaptureRect. |
39 // In the case where the full-screen data is captured by Synchronize(), this | 39 // In the case where the full-screen data is captured by Synchronize(), this |
40 // simply returns the pointer without doing any more work. | 40 // simply returns the pointer without doing any more work. |
41 uint8* CaptureRect(const gfx::Rect& rect); | 41 uint8* CaptureRect(const SkIRect& rect); |
42 | 42 |
43 // Return information about the most recent capture. This is only guaranteed | 43 // Return information about the most recent capture. This is only guaranteed |
44 // to be valid between CaptureRect calls. | 44 // to be valid between CaptureRect calls. |
45 int GetStride() const; | 45 int GetStride() const; |
46 int GetDepth() const; | 46 int GetDepth() const; |
47 int GetBitsPerPixel() const; | 47 int GetBitsPerPixel() const; |
48 int GetRedMask() const; | 48 int GetRedMask() const; |
49 int GetBlueMask() const; | 49 int GetBlueMask() const; |
50 int GetGreenMask() const; | 50 int GetGreenMask() const; |
51 int GetRedShift() const; | 51 int GetRedShift() const; |
(...skipping 11 matching lines...) Expand all Loading... |
63 XShmSegmentInfo* shm_segment_info_; | 63 XShmSegmentInfo* shm_segment_info_; |
64 Pixmap shm_pixmap_; | 64 Pixmap shm_pixmap_; |
65 GC shm_gc_; | 65 GC shm_gc_; |
66 | 66 |
67 DISALLOW_COPY_AND_ASSIGN(XServerPixelBuffer); | 67 DISALLOW_COPY_AND_ASSIGN(XServerPixelBuffer); |
68 }; | 68 }; |
69 | 69 |
70 } // namespace remoting | 70 } // namespace remoting |
71 | 71 |
72 #endif // REMOTING_HOST_X_SERVER_PIXEL_BUFFER_H_ | 72 #endif // REMOTING_HOST_X_SERVER_PIXEL_BUFFER_H_ |
OLD | NEW |