| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "remoting/capturer/linux/x_server_pixel_buffer.h" | 5 #include "media/video/capture/screen/linux/x_server_pixel_buffer.h" |
| 6 | 6 |
| 7 #include <sys/shm.h> | 7 #include <sys/shm.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| 11 #if defined(TOOLKIT_GTK) | 11 #if defined(TOOLKIT_GTK) |
| 12 #include <gdk/gdk.h> | 12 #include <gdk/gdk.h> |
| 13 #else // !defined(TOOLKIT_GTK) | 13 #else // !defined(TOOLKIT_GTK) |
| 14 #include <X11/Xlib.h> | 14 #include <X11/Xlib.h> |
| 15 #endif // !defined(TOOLKIT_GTK) | 15 #endif // !defined(TOOLKIT_GTK) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 DCHECK(g_xserver_error_trap_enabled); | 49 DCHECK(g_xserver_error_trap_enabled); |
| 50 XSetErrorHandler(NULL); | 50 XSetErrorHandler(NULL); |
| 51 g_xserver_error_trap_enabled = false; | 51 g_xserver_error_trap_enabled = false; |
| 52 return g_last_xserver_error_code; | 52 return g_last_xserver_error_code; |
| 53 } | 53 } |
| 54 | 54 |
| 55 #endif // !defined(TOOLKIT_GTK) | 55 #endif // !defined(TOOLKIT_GTK) |
| 56 | 56 |
| 57 } // namespace | 57 } // namespace |
| 58 | 58 |
| 59 namespace remoting { | 59 namespace media { |
| 60 | 60 |
| 61 XServerPixelBuffer::XServerPixelBuffer() | 61 XServerPixelBuffer::XServerPixelBuffer() |
| 62 : display_(NULL), root_window_(0), | 62 : display_(NULL), root_window_(0), |
| 63 root_window_size_(SkISize::Make(0, 0)), x_image_(NULL), | 63 root_window_size_(SkISize::Make(0, 0)), x_image_(NULL), |
| 64 shm_segment_info_(NULL), shm_pixmap_(0), shm_gc_(NULL) { | 64 shm_segment_info_(NULL), shm_pixmap_(0), shm_gc_(NULL) { |
| 65 } | 65 } |
| 66 | 66 |
| 67 XServerPixelBuffer::~XServerPixelBuffer() { | 67 XServerPixelBuffer::~XServerPixelBuffer() { |
| 68 Release(); | 68 Release(); |
| 69 } | 69 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 } | 265 } |
| 266 | 266 |
| 267 int XServerPixelBuffer::GetGreenShift() const { | 267 int XServerPixelBuffer::GetGreenShift() const { |
| 268 return ffs(x_image_->green_mask) - 1; | 268 return ffs(x_image_->green_mask) - 1; |
| 269 } | 269 } |
| 270 | 270 |
| 271 bool XServerPixelBuffer::IsRgb() const { | 271 bool XServerPixelBuffer::IsRgb() const { |
| 272 return GetRedShift() == 16 && GetGreenShift() == 8 && GetBlueShift() == 0; | 272 return GetRedShift() == 16 && GetGreenShift() == 8 && GetBlueShift() == 0; |
| 273 } | 273 } |
| 274 | 274 |
| 275 } // namespace remoting | 275 } // namespace media |
| OLD | NEW |