Skip to main content

Module element_pictures

Module element_pictures 

Expand description

Pictures a renderer copies on the GPU from where the page shows them.

In a browser a video’s pictures are decoded by the page’s media element. Reading each one back to draw it as RGBA costs the page’s one thread a colour conversion and a copy of every pixel per picture: more than a frame’s time for a 1080p video on a software GPU. Instead the widget draws an image with no pixels of its own, a new one per picture, and shows which element holds its pixels; before rendering a frame, the page’s renderer takes them and copies each element’s picture into a texture the image draws from. A new picture so changes only the pixels under the video: nothing is measured or laid out again.

Off the web nothing is shown here: the media engine hands out no element pictures there.

Structs§

ElementPicture
A picture to copy from element (the page’s video element, a wasm_bindgen::JsValue) into the pixels image draws from.

Functions§

show
image draws the picture element shows now: the renderer copies it before it renders the next frame.
take
The pictures shown since the last call, oldest first.