Chromium Code Reviews| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 DesktopFrame* desktop_frame) { | 52 DesktopFrame* desktop_frame) { |
| 53 rtc::scoped_refptr<Core> core(new Core(desktop_frame)); | 53 rtc::scoped_refptr<Core> core(new Core(desktop_frame)); |
| 54 return new SharedDesktopFrame(core); | 54 return new SharedDesktopFrame(core); |
| 55 } | 55 } |
| 56 | 56 |
| 57 DesktopFrame* SharedDesktopFrame::GetUnderlyingFrame() { | 57 DesktopFrame* SharedDesktopFrame::GetUnderlyingFrame() { |
| 58 return core_->frame(); | 58 return core_->frame(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 SharedDesktopFrame* SharedDesktopFrame::Share() { | 61 SharedDesktopFrame* SharedDesktopFrame::Share() { |
| 62 SharedDesktopFrame* result = new SharedDesktopFrame(core_); | 62 return new SharedDesktopFrame(core_); |
| 63 result->set_dpi(dpi()); | |
| 64 result->set_capture_time_ms(capture_time_ms()); | |
| 65 *result->mutable_updated_region() = updated_region(); | |
| 66 return result; | |
| 67 } | 63 } |
| 68 | 64 |
| 69 bool SharedDesktopFrame::IsShared() { | 65 bool SharedDesktopFrame::IsShared() { |
| 70 return !core_->HasOneRef(); | 66 return !core_->HasOneRef(); |
| 71 } | 67 } |
| 72 | 68 |
| 73 SharedDesktopFrame::SharedDesktopFrame(rtc::scoped_refptr<Core> core) | 69 SharedDesktopFrame::SharedDesktopFrame(rtc::scoped_refptr<Core> core) |
| 74 : DesktopFrame(core->frame()->size(), | 70 : DesktopFrame(DesktopSize(), // Do not use |
| 75 core->frame()->stride(), | 71 0, // Do not use |
| 76 core->frame()->data(), | 72 nullptr, // Do not use |
| 77 core->frame()->shared_memory()), | 73 nullptr), // Do not use |
| 78 core_(core) { | 74 core_(core) {} |
| 75 | |
| 76 const DesktopSize& SharedDesktopFrame::size() const { | |
| 77 return core_->frame()->size(); | |
| 78 } | |
| 79 | |
| 80 int SharedDesktopFrame::stride() const { | |
| 81 return core_->frame()->stride(); | |
| 82 } | |
| 83 | |
| 84 uint8_t* SharedDesktopFrame::data() const { | |
| 85 return core_->frame()->data(); | |
| 86 } | |
| 87 | |
| 88 SharedMemory* SharedDesktopFrame::shared_memory() const { | |
| 89 return core_->frame()->shared_memory(); | |
| 90 } | |
| 91 | |
| 92 const DesktopRegion& SharedDesktopFrame::updated_region() const { | |
| 93 return core_->frame()->updated_region(); | |
|
Sergey Ulanov
2016/04/08 21:22:26
SharedDesktopFrame instances are supposed to share
| |
| 94 } | |
| 95 | |
| 96 DesktopRegion* SharedDesktopFrame::mutable_updated_region() { | |
| 97 return core_->frame()->mutable_updated_region(); | |
| 98 } | |
| 99 | |
| 100 const DesktopVector& SharedDesktopFrame::dpi() const { | |
| 101 return core_->frame()->dpi(); | |
| 102 } | |
| 103 | |
| 104 void SharedDesktopFrame::set_dpi(const DesktopVector& dpi) { | |
| 105 core_->frame()->set_dpi(dpi); | |
| 106 } | |
| 107 | |
| 108 int64_t SharedDesktopFrame::capture_time_ms() const { | |
| 109 return core_->frame()->capture_time_ms(); | |
| 110 } | |
| 111 | |
| 112 void SharedDesktopFrame::set_capture_time_ms(int64_t time_ms) { | |
| 113 core_->frame()->set_capture_time_ms(time_ms); | |
| 114 } | |
| 115 | |
| 116 const DesktopRegion* SharedDesktopFrame::shape() const { | |
| 117 return core_->frame()->shape(); | |
| 118 } | |
| 119 | |
| 120 void SharedDesktopFrame::set_shape(DesktopRegion* shape) { | |
| 121 core_->frame()->set_shape(shape); | |
| 122 } | |
| 123 | |
| 124 void SharedDesktopFrame::CopyPixelsFrom(uint8_t* src_buffer, | |
| 125 int src_stride, | |
| 126 const DesktopRect& dest_rect) { | |
| 127 core_->frame()->CopyPixelsFrom(src_buffer, src_stride, dest_rect); | |
| 128 } | |
| 129 | |
| 130 void SharedDesktopFrame::CopyPixelsFrom(const DesktopFrame& src_frame, | |
| 131 const DesktopVector& src_pos, | |
| 132 const DesktopRect& dest_rect) { | |
| 133 core_->frame()->CopyPixelsFrom(src_frame, src_pos, dest_rect); | |
| 79 } | 134 } |
| 80 | 135 |
| 81 } // namespace webrtc | 136 } // namespace webrtc |
| OLD | NEW |