diff options
Diffstat (limited to 'components/script/dom/htmlcanvaselement.rs')
-rw-r--r-- | components/script/dom/htmlcanvaselement.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index 60f6482a49f..326b1804ddf 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use canvas_traits::{CanvasMsg, FromLayoutMsg, CanvasData}; +use canvas_traits::{CanvasMsg, FromScriptMsg}; use dom::attr::Attr; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasRenderingContext2DMethods; @@ -202,16 +202,17 @@ impl HTMLCanvasElement { let data = if let Some(renderer) = self.ipc_renderer() { let (sender, receiver) = ipc::channel().unwrap(); - let msg = CanvasMsg::FromLayout(FromLayoutMsg::SendData(sender)); + let msg = CanvasMsg::FromScript(FromScriptMsg::SendPixels(sender)); renderer.send(msg).unwrap(); match receiver.recv().unwrap() { - CanvasData::Pixels(pixel_data) - => pixel_data.image_data.to_vec(), - CanvasData::WebGL(_) - // TODO(emilio): Not sure if WebGL canvas is required for 2d spec, - // but I think it's not. - => return None, + Some(pixels) => pixels, + None => { + // TODO(emilio, #14109): Not sure if WebGL canvas is + // required for 2d spec, but I think it's not, if so, make + // this return a readback from the GL context. + return None; + } } } else { repeat(0xffu8).take((size.height as usize) * (size.width as usize) * 4).collect() |