mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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.
This commit is contained in:
parent
3ce3f39383
commit
ce81420bef
19 changed files with 170 additions and 62 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue