| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 CopyPixelsFrom(src_frame.GetFrameDataAtPos(src_pos), | 52 CopyPixelsFrom(src_frame.GetFrameDataAtPos(src_pos), |
| 53 src_frame.stride(), dest_rect); | 53 src_frame.stride(), dest_rect); |
| 54 } | 54 } |
| 55 | 55 |
| 56 uint8_t* DesktopFrame::GetFrameDataAtPos(const DesktopVector& pos) const { | 56 uint8_t* DesktopFrame::GetFrameDataAtPos(const DesktopVector& pos) const { |
| 57 return data() + stride() * pos.y() + DesktopFrame::kBytesPerPixel * pos.x(); | 57 return data() + stride() * pos.y() + DesktopFrame::kBytesPerPixel * pos.x(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 BasicDesktopFrame::BasicDesktopFrame(DesktopSize size) | 60 BasicDesktopFrame::BasicDesktopFrame(DesktopSize size) |
| 61 : DesktopFrame(size, kBytesPerPixel * size.width(), | 61 : DesktopFrame(size, |
| 62 kBytesPerPixel * size.width(), |
| 62 new uint8_t[kBytesPerPixel * size.width() * size.height()], | 63 new uint8_t[kBytesPerPixel * size.width() * size.height()], |
| 63 NULL) { | 64 nullptr) {} |
| 64 } | |
| 65 | 65 |
| 66 BasicDesktopFrame::~BasicDesktopFrame() { | 66 BasicDesktopFrame::~BasicDesktopFrame() { |
| 67 delete[] data_; | 67 delete[] data_; |
| 68 } | 68 } |
| 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(), |
| (...skipping 34 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 |