Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send an IpcSharedMemory in tex_image_2d and tex_sub_image_2d #22225

Merged
merged 9 commits into from Nov 21, 2018

Some generated files are not rendered by default. Learn more.

@@ -15,12 +15,14 @@ webgl_backtrace = ["canvas_traits/webgl_backtrace"]

[dependencies]
azure = {git = "https://github.com/servo/rust-azure"}
byteorder = "1"
canvas_traits = {path = "../canvas_traits"}
compositing = {path = "../compositing"}
cssparser = "0.25"
euclid = "0.19"
fnv = "1.0"
gleam = "0.6.4"
half = "1"
ipc-channel = "0.11"
log = "0.4"
num-traits = "0.2"
@@ -13,9 +13,8 @@ use azure::azure_hl::{ExtendMode, GradientStop, LinearGradientPattern, RadialGra
use canvas_traits::canvas::*;
use cssparser::RGBA;
use euclid::{Point2D, Rect, Size2D, Transform2D, Vector2D};
use ipc_channel::ipc::IpcSender;
use ipc_channel::ipc::{IpcSender, IpcSharedMemory};
use num_traits::ToPrimitive;
use serde_bytes::ByteBuf;
use std::mem;
use std::sync::Arc;

@@ -451,15 +450,11 @@ impl<'a> CanvasData<'a> {
}

#[allow(unsafe_code)]
pub fn send_pixels(&mut self, chan: IpcSender<Option<ByteBuf>>) {
let data = unsafe {
self.drawtarget
.snapshot()
.get_data_surface()
.data()
.to_vec()
};
chan.send(Some(data.into())).unwrap();
pub fn send_pixels(&mut self, chan: IpcSender<IpcSharedMemory>) {
let data = IpcSharedMemory::from_bytes(unsafe {
self.drawtarget.snapshot().get_data_surface().data()
});
chan.send(data).unwrap();
}

#[allow(unsafe_code)]
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.