mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Use ipc::bytes_channel in ReadPixels
This commit is contained in:
parent
4e9281dcbf
commit
408e540c55
3 changed files with 11 additions and 10 deletions
|
@ -7,8 +7,8 @@ use canvas_traits::webgl::*;
|
|||
use euclid::Size2D;
|
||||
use fnv::FnvHashMap;
|
||||
use gleam::gl;
|
||||
use ipc_channel::ipc::IpcBytesSender;
|
||||
use offscreen_gl_context::{GLContext, GLContextAttributes, GLLimits, NativeGLContextMethods};
|
||||
use serde_bytes::ByteBuf;
|
||||
use std::thread;
|
||||
use super::gl_context::{GLContextFactory, GLContextWrapper};
|
||||
use webrender;
|
||||
|
@ -713,8 +713,9 @@ impl WebGLImpl {
|
|||
ctx.gl().pixel_store_i(name, val),
|
||||
WebGLCommand::PolygonOffset(factor, units) =>
|
||||
ctx.gl().polygon_offset(factor, units),
|
||||
WebGLCommand::ReadPixels(x, y, width, height, format, pixel_type, ref chan) =>
|
||||
Self::read_pixels(ctx.gl(), x, y, width, height, format, pixel_type, chan),
|
||||
WebGLCommand::ReadPixels(x, y, width, height, format, pixel_type, ref chan) => {
|
||||
Self::read_pixels(ctx.gl(), x, y, width, height, format, pixel_type, chan)
|
||||
}
|
||||
WebGLCommand::RenderbufferStorage(target, format, width, height) =>
|
||||
ctx.gl().renderbuffer_storage(target, format, width, height),
|
||||
WebGLCommand::SampleCoverage(value, invert) =>
|
||||
|
@ -1165,10 +1166,10 @@ impl WebGLImpl {
|
|||
height: i32,
|
||||
format: u32,
|
||||
pixel_type: u32,
|
||||
chan: &WebGLSender<ByteBuf>,
|
||||
chan: &IpcBytesSender,
|
||||
) {
|
||||
let result = gl.read_pixels(x, y, width, height, format, pixel_type);
|
||||
chan.send(result.into()).unwrap()
|
||||
chan.send(&result).unwrap()
|
||||
}
|
||||
|
||||
fn finish(gl: &gl::Gl, chan: &WebGLSender<()>) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use euclid::Size2D;
|
||||
use gleam::gl;
|
||||
use ipc_channel::ipc::IpcBytesReceiver;
|
||||
use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender};
|
||||
use offscreen_gl_context::{GLContextAttributes, GLLimits};
|
||||
use serde_bytes::ByteBuf;
|
||||
use std::borrow::Cow;
|
||||
|
@ -214,7 +214,7 @@ pub enum WebGLCommand {
|
|||
GetRenderbufferParameter(u32, u32, WebGLSender<i32>),
|
||||
PolygonOffset(f32, f32),
|
||||
RenderbufferStorage(u32, u32, i32, i32),
|
||||
ReadPixels(i32, i32, i32, i32, u32, u32, WebGLSender<ByteBuf>),
|
||||
ReadPixels(i32, i32, i32, i32, u32, u32, IpcBytesSender),
|
||||
SampleCoverage(f32, bool),
|
||||
Scissor(i32, i32, i32, i32),
|
||||
StencilFunc(u32, i32, u32),
|
||||
|
|
|
@ -1202,7 +1202,7 @@ impl WebGLRenderingContext {
|
|||
let width = cmp::min(width, fb_width as u32);
|
||||
let height = cmp::min(height, fb_height as u32);
|
||||
|
||||
let (sender, receiver) = webgl_channel().unwrap();
|
||||
let (sender, receiver) = ipc::bytes_channel().unwrap();
|
||||
self.send_command(WebGLCommand::ReadPixels(
|
||||
0,
|
||||
0,
|
||||
|
@ -1212,7 +1212,7 @@ impl WebGLRenderingContext {
|
|||
constants::UNSIGNED_BYTE,
|
||||
sender,
|
||||
));
|
||||
Some(receiver.recv().unwrap().into())
|
||||
Some(receiver.recv().unwrap())
|
||||
}
|
||||
|
||||
pub fn array_buffer(&self) -> Option<DomRoot<WebGLBuffer>> {
|
||||
|
@ -2894,7 +2894,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
_ => return self.webgl_error(InvalidOperation),
|
||||
};
|
||||
|
||||
let (sender, receiver) = webgl_channel().unwrap();
|
||||
let (sender, receiver) = ipc::bytes_channel().unwrap();
|
||||
self.send_command(WebGLCommand::ReadPixels(x, y, width, height, format, pixel_type, sender));
|
||||
|
||||
let result = receiver.recv().unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue