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 13 matching lines...) Expand all Loading... |
24 SharedMemory* shared_memory) | 24 SharedMemory* shared_memory) |
25 : data_(data), | 25 : data_(data), |
26 shared_memory_(shared_memory), | 26 shared_memory_(shared_memory), |
27 size_(size), | 27 size_(size), |
28 stride_(stride), | 28 stride_(stride), |
29 capture_time_ms_(0) { | 29 capture_time_ms_(0) { |
30 } | 30 } |
31 | 31 |
32 DesktopFrame::~DesktopFrame() {} | 32 DesktopFrame::~DesktopFrame() {} |
33 | 33 |
34 void DesktopFrame::CopyPixelsFrom(uint8_t* src_buffer, int src_stride, | 34 void DesktopFrame::CopyPixelsFrom(const uint8_t* src_buffer, int src_stride, |
35 const DesktopRect& dest_rect) { | 35 const DesktopRect& dest_rect) { |
36 RTC_CHECK(DesktopRect::MakeSize(size()).ContainsRect(dest_rect)); | 36 RTC_CHECK(DesktopRect::MakeSize(size()).ContainsRect(dest_rect)); |
37 | 37 |
38 uint8_t* dest = GetFrameDataAtPos(dest_rect.top_left()); | 38 uint8_t* dest = GetFrameDataAtPos(dest_rect.top_left()); |
39 for (int y = 0; y < dest_rect.height(); ++y) { | 39 for (int y = 0; y < dest_rect.height(); ++y) { |
40 memcpy(dest, src_buffer, DesktopFrame::kBytesPerPixel * dest_rect.width()); | 40 memcpy(dest, src_buffer, DesktopFrame::kBytesPerPixel * dest_rect.width()); |
41 src_buffer += src_stride; | 41 src_buffer += src_stride; |
42 dest += stride(); | 42 dest += stride(); |
43 } | 43 } |
44 } | 44 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 : DesktopFrame(size, | 109 : DesktopFrame(size, |
110 stride, | 110 stride, |
111 reinterpret_cast<uint8_t*>(shared_memory->data()), | 111 reinterpret_cast<uint8_t*>(shared_memory->data()), |
112 shared_memory) {} | 112 shared_memory) {} |
113 | 113 |
114 SharedMemoryDesktopFrame::~SharedMemoryDesktopFrame() { | 114 SharedMemoryDesktopFrame::~SharedMemoryDesktopFrame() { |
115 delete shared_memory_; | 115 delete shared_memory_; |
116 } | 116 } |
117 | 117 |
118 } // namespace webrtc | 118 } // namespace webrtc |
OLD | NEW |