| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 DesktopRect::MakeOriginSize(src_pos, dest_rect.size()))); | 50 DesktopRect::MakeOriginSize(src_pos, dest_rect.size()))); |
| 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 DesktopVector DesktopFrame::GetPosAtFrameData(const uint8_t* const pos) const { |
| 61 return DesktopVector((pos - data()) % stride() / DesktopFrame::kBytesPerPixel, |
| 62 (pos - data()) / stride()); |
| 63 } |
| 64 |
| 60 BasicDesktopFrame::BasicDesktopFrame(DesktopSize size) | 65 BasicDesktopFrame::BasicDesktopFrame(DesktopSize size) |
| 61 : DesktopFrame(size, kBytesPerPixel * size.width(), | 66 : DesktopFrame(size, kBytesPerPixel * size.width(), |
| 62 new uint8_t[kBytesPerPixel * size.width() * size.height()], | 67 new uint8_t[kBytesPerPixel * size.width() * size.height()], |
| 63 NULL) { | 68 NULL) { |
| 64 } | 69 } |
| 65 | 70 |
| 66 BasicDesktopFrame::~BasicDesktopFrame() { | 71 BasicDesktopFrame::~BasicDesktopFrame() { |
| 67 delete[] data_; | 72 delete[] data_; |
| 68 } | 73 } |
| 69 | 74 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 : DesktopFrame(size, | 114 : DesktopFrame(size, |
| 110 stride, | 115 stride, |
| 111 reinterpret_cast<uint8_t*>(shared_memory->data()), | 116 reinterpret_cast<uint8_t*>(shared_memory->data()), |
| 112 shared_memory) {} | 117 shared_memory) {} |
| 113 | 118 |
| 114 SharedMemoryDesktopFrame::~SharedMemoryDesktopFrame() { | 119 SharedMemoryDesktopFrame::~SharedMemoryDesktopFrame() { |
| 115 delete shared_memory_; | 120 delete shared_memory_; |
| 116 } | 121 } |
| 117 | 122 |
| 118 } // namespace webrtc | 123 } // namespace webrtc |
| OLD | NEW |