Skip to content

Commit

Permalink
Instanciate and use the implemented webrender::ExternalImageHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
ceyusa authored and ferjm committed Jul 4, 2019
1 parent e000c14 commit a9ad088
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 4 additions & 2 deletions components/canvas/media_mode/inprocess.rs
Expand Up @@ -13,9 +13,11 @@ use euclid::Size2D;
pub struct GLPlayerThreads(GLPlayerSender<GLPlayerMsg>);

impl GLPlayerThreads {
pub fn new() -> GLPlayerThreads {
pub fn new() -> (GLPlayerThreads, Box<dyn webrender::ExternalImageHandler>) {
let channel = GLPlayerThread::start();
GLPlayerThreads(channel)
let external =
GLPlayerExternalImageHandler::new(GLPlayerExternalImages::new(channel.clone()));
(GLPlayerThreads(channel), Box::new(external))
}

/// Gets the GLPlayerThread handle for each script pipeline.
Expand Down
11 changes: 8 additions & 3 deletions components/servo/lib.rs
Expand Up @@ -309,8 +309,13 @@ where
let gl_context = window.get_gl_context();
let glplayer_threads = match gl_context {
GlContext::Unknown => None,
_ => Some(GLPlayerThreads::new()),
_ => {
let (glplayer_threads, image_handler) = GLPlayerThreads::new();
webrender.set_external_image_handler(image_handler);
Some(glplayer_threads)
},
};

let player_context = WindowGLContext {
gl_context,
native_display: window.get_native_display(),
Expand Down Expand Up @@ -697,15 +702,15 @@ fn create_constellation(

// Initialize WebGL Thread entry point.
let webgl_threads = gl_factory.map(|factory| {
let (webgl_threads, image_handler, output_handler) = WebGLThreads::new(
let (webgl_threads, _image_handler, output_handler) = WebGLThreads::new(
factory,
window_gl,
webrender_api_sender.clone(),
webvr_compositor.map(|c| c as Box<_>),
);

// Set webrender external image handler for WebGL textures
webrender.set_external_image_handler(image_handler);
//webrender.set_external_image_handler(image_handler);

// Set DOM to texture handler, if enabled.
if let Some(output_handler) = output_handler {
Expand Down

0 comments on commit a9ad088

Please sign in to comment.