diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2018-11-19 12:36:45 +0100 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2018-11-20 10:14:52 +0100 |
commit | 804d964b7d85c0c4efd0e9e9eb290bd15a24bb9d (patch) | |
tree | e7bd22b6b91d4f5f507df5e8ada84f1c3c6eb487 /components/script/dom/imagedata.rs | |
parent | cfca906ee2325fad74896b7647db26625099cf66 (diff) | |
download | servo-804d964b7d85c0c4efd0e9e9eb290bd15a24bb9d.tar.gz servo-804d964b7d85c0c4efd0e9e9eb290bd15a24bb9d.zip |
Send an IpcSharedMemory in tex_image_2d and tex_sub_image_2d
This avoids a copy in the case of textures coming from HTMLImageElement.
Diffstat (limited to 'components/script/dom/imagedata.rs')
-rw-r--r-- | components/script/dom/imagedata.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/components/script/dom/imagedata.rs b/components/script/dom/imagedata.rs index 2d7fb22ba09..9566c7b0f39 100644 --- a/components/script/dom/imagedata.rs +++ b/components/script/dom/imagedata.rs @@ -10,6 +10,7 @@ use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; use euclid::{Rect, Size2D}; +use ipc_channel::ipc::IpcSharedMemory; use js::jsapi::{Heap, JSContext, JSObject}; use js::rust::Runtime; use js::typedarray::{CreateWith, Uint8ClampedArray}; @@ -156,8 +157,8 @@ impl ImageData { } #[allow(unsafe_code)] - pub fn to_vec(&self) -> Vec<u8> { - unsafe { self.as_slice().into() } + pub fn to_shared_memory(&self) -> IpcSharedMemory { + IpcSharedMemory::from_bytes(unsafe { self.as_slice() }) } #[allow(unsafe_code)] |