OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 buffer->DataU(), buffer->StrideU(), | 193 buffer->DataU(), buffer->StrideU(), |
194 buffer->DataV(), buffer->StrideV(), | 194 buffer->DataV(), buffer->StrideV(), |
195 copy->MutableDataY(), copy->StrideY(), | 195 copy->MutableDataY(), copy->StrideY(), |
196 copy->MutableDataU(), copy->StrideU(), | 196 copy->MutableDataU(), copy->StrideU(), |
197 copy->MutableDataV(), copy->StrideV(), | 197 copy->MutableDataV(), copy->StrideV(), |
198 width, height) == 0); | 198 width, height) == 0); |
199 | 199 |
200 return copy; | 200 return copy; |
201 } | 201 } |
202 | 202 |
| 203 void I420Buffer::SetToBlack() { |
| 204 RTC_CHECK(libyuv::I420Rect(MutableDataY(), StrideY(), |
| 205 MutableDataU(), StrideU(), |
| 206 MutableDataV(), StrideV(), |
| 207 0, 0, width(), height(), |
| 208 0, 128, 128) == 0); |
| 209 } |
| 210 |
203 NativeHandleBuffer::NativeHandleBuffer(void* native_handle, | 211 NativeHandleBuffer::NativeHandleBuffer(void* native_handle, |
204 int width, | 212 int width, |
205 int height) | 213 int height) |
206 : native_handle_(native_handle), width_(width), height_(height) { | 214 : native_handle_(native_handle), width_(width), height_(height) { |
207 RTC_DCHECK(native_handle != nullptr); | 215 RTC_DCHECK(native_handle != nullptr); |
208 RTC_DCHECK_GT(width, 0); | 216 RTC_DCHECK_GT(width, 0); |
209 RTC_DCHECK_GT(height, 0); | 217 RTC_DCHECK_GT(height, 0); |
210 } | 218 } |
211 | 219 |
212 int NativeHandleBuffer::width() const { | 220 int NativeHandleBuffer::width() const { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 buffer->StrideV() * uv_offset_y + uv_offset_x; | 341 buffer->StrideV() * uv_offset_y + uv_offset_x; |
334 return new rtc::RefCountedObject<WrappedI420Buffer>( | 342 return new rtc::RefCountedObject<WrappedI420Buffer>( |
335 cropped_width, cropped_height, | 343 cropped_width, cropped_height, |
336 y_plane, buffer->StrideY(), | 344 y_plane, buffer->StrideY(), |
337 u_plane, buffer->StrideU(), | 345 u_plane, buffer->StrideU(), |
338 v_plane, buffer->StrideV(), | 346 v_plane, buffer->StrideV(), |
339 rtc::KeepRefUntilDone(buffer)); | 347 rtc::KeepRefUntilDone(buffer)); |
340 } | 348 } |
341 | 349 |
342 } // namespace webrtc | 350 } // namespace webrtc |
OLD | NEW |