sergeyu@chromium.org | 15e32cc | 2013-04-29 20:10:57 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #include "webrtc/modules/desktop_capture/desktop_frame.h" |
| 12 | |
| 13 | namespace webrtc { |
| 14 | |
| 15 | DesktopFrame::DesktopFrame(DesktopSize size, |
| 16 | int stride, |
| 17 | uint8_t* data, |
| 18 | SharedMemory* shared_memory) |
| 19 | : size_(size), |
| 20 | stride_(stride), |
| 21 | data_(data), |
| 22 | shared_memory_(shared_memory), |
| 23 | capture_time_ms_(0) { |
| 24 | } |
| 25 | |
| 26 | DesktopFrame::~DesktopFrame() {} |
| 27 | |
| 28 | BasicDesktopFrame::BasicDesktopFrame(DesktopSize size) |
| 29 | : DesktopFrame(size, kBytesPerPixel * size.width(), |
| 30 | new uint8_t[kBytesPerPixel * size.width() * size.height()], |
| 31 | NULL) { |
| 32 | } |
| 33 | |
| 34 | BasicDesktopFrame::~BasicDesktopFrame() { |
| 35 | delete[] data_; |
| 36 | } |
| 37 | |
| 38 | SharedMemoryDesktopFrame::SharedMemoryDesktopFrame( |
| 39 | DesktopSize size, |
| 40 | int stride, |
| 41 | SharedMemory* shared_memory) |
| 42 | : DesktopFrame(size, stride, |
| 43 | reinterpret_cast<uint8_t*>(shared_memory->data()), |
| 44 | shared_memory) { |
| 45 | } |
| 46 | |
| 47 | SharedMemoryDesktopFrame::~SharedMemoryDesktopFrame() { |
| 48 | delete shared_memory_; |
| 49 | } |
| 50 | |
| 51 | } // namespace webrtc |