mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Send an IpcSharedMemory in tex_image_2d and tex_sub_image_2d
This avoids a copy in the case of textures coming from HTMLImageElement.
This commit is contained in:
parent
cfca906ee2
commit
804d964b7d
4 changed files with 56 additions and 38 deletions
|
@ -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)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue