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 |
11 #include "webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.h" | 11 #include "webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.h" |
12 | 12 |
13 #include <assert.h> | 13 #include <assert.h> |
14 #include <string.h> | 14 #include <string.h> |
15 #include <sys/shm.h> | 15 #include <sys/shm.h> |
16 | 16 |
17 #include "webrtc/modules/desktop_capture/desktop_frame.h" | 17 #include "webrtc/modules/desktop_capture/desktop_frame.h" |
18 #include "webrtc/modules/desktop_capture/x11/x_error_trap.h" | 18 #include "webrtc/modules/desktop_capture/x11/x_error_trap.h" |
19 #include "webrtc/system_wrappers/interface/logging.h" | 19 #include "webrtc/system_wrappers/include/logging.h" |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 // Returns the number of bits |mask| has to be shifted left so its last | 23 // Returns the number of bits |mask| has to be shifted left so its last |
24 // (most-significant) bit set becomes the most-significant bit of the word. | 24 // (most-significant) bit set becomes the most-significant bit of the word. |
25 // When |mask| is 0 the function returns 31. | 25 // When |mask| is 0 the function returns 31. |
26 uint32_t MaskToShift(uint32_t mask) { | 26 uint32_t MaskToShift(uint32_t mask) { |
27 int shift = 0; | 27 int shift = 0; |
28 if ((mask & 0xffff0000u) == 0) { | 28 if ((mask & 0xffff0000u) == 0) { |
29 mask <<= 16; | 29 mask <<= 16; |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 // Write as 32-bit RGB. | 328 // Write as 32-bit RGB. |
329 dst_pos_32[x] = ((r >> 8) & 0xff0000) | ((g >> 16) & 0xff00) | | 329 dst_pos_32[x] = ((r >> 8) & 0xff0000) | ((g >> 16) & 0xff00) | |
330 ((b >> 24) & 0xff); | 330 ((b >> 24) & 0xff); |
331 } | 331 } |
332 dst_pos += frame->stride(); | 332 dst_pos += frame->stride(); |
333 src_pos += src_stride; | 333 src_pos += src_stride; |
334 } | 334 } |
335 } | 335 } |
336 | 336 |
337 } // namespace webrtc | 337 } // namespace webrtc |
OLD | NEW |