| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 XServerPixelBuffer::XServerPixelBuffer() {} | 62 XServerPixelBuffer::XServerPixelBuffer() {} |
| 63 | 63 |
| 64 XServerPixelBuffer::~XServerPixelBuffer() { | 64 XServerPixelBuffer::~XServerPixelBuffer() { |
| 65 Release(); | 65 Release(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void XServerPixelBuffer::Release() { | 68 void XServerPixelBuffer::Release() { |
| 69 if (x_image_) { | 69 if (x_image_) { |
| 70 XDestroyImage(x_image_); | 70 XDestroyImage(x_image_); |
| 71 x_image_ = NULL; | 71 x_image_ = nullptr; |
| 72 } | 72 } |
| 73 if (shm_pixmap_) { | 73 if (shm_pixmap_) { |
| 74 XFreePixmap(display_, shm_pixmap_); | 74 XFreePixmap(display_, shm_pixmap_); |
| 75 shm_pixmap_ = 0; | 75 shm_pixmap_ = 0; |
| 76 } | 76 } |
| 77 if (shm_gc_) { | 77 if (shm_gc_) { |
| 78 XFreeGC(display_, shm_gc_); | 78 XFreeGC(display_, shm_gc_); |
| 79 shm_gc_ = NULL; | 79 shm_gc_ = nullptr; |
| 80 } | 80 } |
| 81 if (shm_segment_info_) { | 81 if (shm_segment_info_) { |
| 82 if (shm_segment_info_->shmaddr != reinterpret_cast<char*>(-1)) | 82 if (shm_segment_info_->shmaddr != reinterpret_cast<char*>(-1)) |
| 83 shmdt(shm_segment_info_->shmaddr); | 83 shmdt(shm_segment_info_->shmaddr); |
| 84 if (shm_segment_info_->shmid != -1) | 84 if (shm_segment_info_->shmid != -1) |
| 85 shmctl(shm_segment_info_->shmid, IPC_RMID, 0); | 85 shmctl(shm_segment_info_->shmid, IPC_RMID, 0); |
| 86 delete shm_segment_info_; | 86 delete shm_segment_info_; |
| 87 shm_segment_info_ = NULL; | 87 shm_segment_info_ = nullptr; |
| 88 } | 88 } |
| 89 window_ = 0; | 89 window_ = 0; |
| 90 } | 90 } |
| 91 | 91 |
| 92 bool XServerPixelBuffer::Init(Display* display, Window window) { | 92 bool XServerPixelBuffer::Init(Display* display, Window window) { |
| 93 Release(); | 93 Release(); |
| 94 display_ = display; | 94 display_ = display; |
| 95 | 95 |
| 96 XWindowAttributes attributes; | 96 XWindowAttributes attributes; |
| 97 { | 97 { |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 // Write as 32-bit RGB. | 331 // Write as 32-bit RGB. |
| 332 dst_pos_32[x] = ((r >> 8) & 0xff0000) | ((g >> 16) & 0xff00) | | 332 dst_pos_32[x] = ((r >> 8) & 0xff0000) | ((g >> 16) & 0xff00) | |
| 333 ((b >> 24) & 0xff); | 333 ((b >> 24) & 0xff); |
| 334 } | 334 } |
| 335 dst_pos += frame->stride(); | 335 dst_pos += frame->stride(); |
| 336 src_pos += src_stride; | 336 src_pos += src_stride; |
| 337 } | 337 } |
| 338 } | 338 } |
| 339 | 339 |
| 340 } // namespace webrtc | 340 } // namespace webrtc |
| OLD | NEW |