implement get_image_pixels() for video element

This commit is contained in:
Víctor Manuel Jáquez Leal 2019-09-13 15:59:26 +02:00
parent bc07154e05
commit b75d454162
4 changed files with 48 additions and 3 deletions

View file

@ -604,9 +604,14 @@ impl WebGLRenderingContext {
return Ok(None);
}
},
TexImageSource::HTMLVideoElement(_) => {
// TODO: https://github.com/servo/servo/issues/6711
return Ok(None);
TexImageSource::HTMLVideoElement(video) => match video.get_current_frame_data() {
Some((data, size)) => {
let data = data.unwrap_or_else(|| {
IpcSharedMemory::from_bytes(&vec![0; size.area() as usize * 4])
});
TexPixels::new(data, size, PixelFormat::BGRA8, false)
},
None => return Ok(None),
},
}))
}