diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2018-03-23 18:41:32 +0100 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2018-03-26 20:48:02 +0200 |
commit | ce81420befd0fd0e8335cb676487479e2cc0f985 (patch) | |
tree | 4d883ab322c58496073f43d29c737e35ca23871a /components/canvas/webgl_thread.rs | |
parent | 3ce3f39383c8217a30b15d27f3121f96bbe0014d (diff) | |
download | servo-ce81420befd0fd0e8335cb676487479e2cc0f985.tar.gz servo-ce81420befd0fd0e8335cb676487479e2cc0f985.zip |
Use ByteBuf for the canvas messages
The type Vec<u8> is super unefficient to work with in Serde if all you want
to represent is a simple blob.
Diffstat (limited to 'components/canvas/webgl_thread.rs')
-rw-r--r-- | components/canvas/webgl_thread.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index 8b6ae674825..bba93918c70 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -8,6 +8,7 @@ use euclid::Size2D; use fnv::FnvHashMap; use gleam::gl; use offscreen_gl_context::{GLContext, GLContextAttributes, GLLimits, NativeGLContextMethods}; +use serde_bytes::ByteBuf; use std::thread; use super::gl_context::{GLContextFactory, GLContextWrapper}; use webrender; @@ -904,10 +905,18 @@ impl WebGLImpl { //} } - fn read_pixels(gl: &gl::Gl, x: i32, y: i32, width: i32, height: i32, format: u32, pixel_type: u32, - chan: WebGLSender<Vec<u8>>) { + fn read_pixels( + gl: &gl::Gl, + x: i32, + y: i32, + width: i32, + height: i32, + format: u32, + pixel_type: u32, + chan: WebGLSender<ByteBuf>, + ) { let result = gl.read_pixels(x, y, width, height, format, pixel_type); - chan.send(result).unwrap() + chan.send(result.into()).unwrap() } fn active_attrib(gl: &gl::Gl, |