aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlcanvaselement.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2018-11-21 12:51:49 +0100
committerAnthony Ramine <n.oxyde@gmail.com>2018-11-21 12:53:50 +0100
commit9a8d03a0f3047d8408b2368d46d144fea670f95d (patch)
tree4459c03931e7f565b65ac681c38a75d63ba1046a /components/script/dom/htmlcanvaselement.rs
parent804d964b7d85c0c4efd0e9e9eb290bd15a24bb9d (diff)
downloadservo-9a8d03a0f3047d8408b2368d46d144fea670f95d.tar.gz
servo-9a8d03a0f3047d8408b2368d46d144fea670f95d.zip
Make HTMLCanvasElement::fetch_all_data return a shared memory blob
Diffstat (limited to 'components/script/dom/htmlcanvaselement.rs')
-rw-r--r--components/script/dom/htmlcanvaselement.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs
index 850f15bdc9e..1dbb0806728 100644
--- a/components/script/dom/htmlcanvaselement.rs
+++ b/components/script/dom/htmlcanvaselement.rs
@@ -36,6 +36,7 @@ use euclid::{Rect, Size2D};
use html5ever::{LocalName, Prefix};
use image::png::PNGEncoder;
use image::ColorType;
+use ipc_channel::ipc::IpcSharedMemory;
use js::error::throw_type_error;
use js::jsapi::JSContext;
use js::rust::HandleValue;
@@ -280,7 +281,7 @@ impl HTMLCanvasElement {
self.Height() != 0 && self.Width() != 0
}
- pub fn fetch_all_data(&self) -> Option<(Vec<u8>, Size2D<u32>)> {
+ pub fn fetch_all_data(&self) -> Option<(Option<IpcSharedMemory>, Size2D<u32>)> {
let size = self.get_size();
if size.width == 0 || size.height == 0 {
@@ -297,7 +298,7 @@ impl HTMLCanvasElement {
);
context.get_ipc_renderer().send(msg).unwrap();
- receiver.recv().unwrap()?.into()
+ Some(receiver.recv().unwrap())
},
Some(&CanvasContext::WebGL(_)) => {
// TODO: add a method in WebGLRenderingContext to get the pixels.
@@ -307,7 +308,7 @@ impl HTMLCanvasElement {
// TODO: add a method in WebGL2RenderingContext to get the pixels.
return None;
},
- None => vec![0; size.height as usize * size.width as usize * 4],
+ None => None,
};
Some((data, size))