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

Side by Side Diff: remoting/host/linux/x_server_pixel_buffer.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
« no previous file with comments | « remoting/host/ipc_video_frame_capturer.cc ('k') | remoting/host/linux/x_server_pixel_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Don't include this file in any .h files because it pulls in some X headers.
6
7 #ifndef REMOTING_HOST_LINUX_X_SERVER_PIXEL_BUFFER_H_
8 #define REMOTING_HOST_LINUX_X_SERVER_PIXEL_BUFFER_H_
9
10 #include "base/basictypes.h"
11 #include "third_party/skia/include/core/SkRect.h"
12
13 #include <X11/Xutil.h>
14 #include <X11/extensions/XShm.h>
15
16 namespace remoting {
17
18 // A class to allow the X server's pixel buffer to be accessed as efficiently
19 // as possible.
20 class XServerPixelBuffer {
21 public:
22 XServerPixelBuffer();
23 ~XServerPixelBuffer();
24
25 void Release();
26 void Init(Display* display);
27
28 // If shared memory is being used without pixmaps, synchronize this pixel
29 // buffer with the root window contents (otherwise, this is a no-op).
30 // This is to avoid doing a full-screen capture for each individual
31 // rectangle in the capture list, when it only needs to be done once at the
32 // beginning.
33 void Synchronize();
34
35 // Capture the specified rectangle and return a pointer to its top-left pixel
36 // or NULL if capture fails. The returned pointer remains valid until the next
37 // call to CaptureRect.
38 // In the case where the full-screen data is captured by Synchronize(), this
39 // simply returns the pointer without doing any more work.
40 uint8* CaptureRect(const SkIRect& rect);
41
42 // Return information about the most recent capture. This is only guaranteed
43 // to be valid between CaptureRect calls.
44 int GetStride() const;
45 int GetDepth() const;
46 int GetBitsPerPixel() const;
47 int GetRedMask() const;
48 int GetBlueMask() const;
49 int GetGreenMask() const;
50 int GetRedShift() const;
51 int GetBlueShift() const;
52 int GetGreenShift() const;
53 bool IsRgb() const;
54
55 private:
56 void InitShm(int screen);
57 bool InitPixmaps(int width, int height, int depth);
58
59 Display* display_;
60 Window root_window_;
61 XImage* x_image_;
62 XShmSegmentInfo* shm_segment_info_;
63 Pixmap shm_pixmap_;
64 GC shm_gc_;
65
66 DISALLOW_COPY_AND_ASSIGN(XServerPixelBuffer);
67 };
68
69 } // namespace remoting
70
71 #endif // REMOTING_HOST_LINUX_X_SERVER_PIXEL_BUFFER_H_
OLDNEW
« no previous file with comments | « remoting/host/ipc_video_frame_capturer.cc ('k') | remoting/host/linux/x_server_pixel_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698