| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 DesktopFrame* BasicDesktopFrame::CopyOf(const DesktopFrame& frame) { | 70 DesktopFrame* BasicDesktopFrame::CopyOf(const DesktopFrame& frame) { |
| 71 DesktopFrame* result = new BasicDesktopFrame(frame.size()); | 71 DesktopFrame* result = new BasicDesktopFrame(frame.size()); |
| 72 for (int y = 0; y < frame.size().height(); ++y) { | 72 for (int y = 0; y < frame.size().height(); ++y) { |
| 73 memcpy(result->data() + y * result->stride(), | 73 memcpy(result->data() + y * result->stride(), |
| 74 frame.data() + y * frame.stride(), | 74 frame.data() + y * frame.stride(), |
| 75 frame.size().width() * kBytesPerPixel); | 75 frame.size().width() * kBytesPerPixel); |
| 76 } | 76 } |
| 77 result->set_dpi(frame.dpi()); | 77 result->set_dpi(frame.dpi()); |
| 78 result->set_capture_time_ms(frame.capture_time_ms()); | 78 result->set_capture_time_ms(frame.capture_time_ms()); |
| 79 result->set_capturer_id(frame.capturer_id()); |
| 79 *result->mutable_updated_region() = frame.updated_region(); | 80 *result->mutable_updated_region() = frame.updated_region(); |
| 80 return result; | 81 return result; |
| 81 } | 82 } |
| 82 | 83 |
| 83 // static | 84 // static |
| 84 std::unique_ptr<DesktopFrame> SharedMemoryDesktopFrame::Create( | 85 std::unique_ptr<DesktopFrame> SharedMemoryDesktopFrame::Create( |
| 85 DesktopSize size, | 86 DesktopSize size, |
| 86 SharedMemoryFactory* shared_memory_factory) { | 87 SharedMemoryFactory* shared_memory_factory) { |
| 87 size_t buffer_size = size.height() * size.width() * kBytesPerPixel; | 88 size_t buffer_size = size.height() * size.width() * kBytesPerPixel; |
| 88 std::unique_ptr<SharedMemory> shared_memory = | 89 std::unique_ptr<SharedMemory> shared_memory = |
| (...skipping 20 matching lines...) Expand all Loading... |
| 109 : DesktopFrame(size, | 110 : DesktopFrame(size, |
| 110 stride, | 111 stride, |
| 111 reinterpret_cast<uint8_t*>(shared_memory->data()), | 112 reinterpret_cast<uint8_t*>(shared_memory->data()), |
| 112 shared_memory) {} | 113 shared_memory) {} |
| 113 | 114 |
| 114 SharedMemoryDesktopFrame::~SharedMemoryDesktopFrame() { | 115 SharedMemoryDesktopFrame::~SharedMemoryDesktopFrame() { |
| 115 delete shared_memory_; | 116 delete shared_memory_; |
| 116 } | 117 } |
| 117 | 118 |
| 118 } // namespace webrtc | 119 } // namespace webrtc |
| OLD | NEW |