diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2018-11-17 16:10:14 +0100 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2018-11-20 10:14:50 +0100 |
commit | ca62b5c318bc101dce49be99302dae0abed1dfd2 (patch) | |
tree | 252acbd57e633ce33d49233b2c0862002e875bc9 /components/canvas/webgl_thread.rs | |
parent | 5f9e3d8bb999b29f7b9092a31552e47ceed7da02 (diff) | |
download | servo-ca62b5c318bc101dce49be99302dae0abed1dfd2.tar.gz servo-ca62b5c318bc101dce49be99302dae0abed1dfd2.zip |
Call prepare_pixels on the WebGL thread
Diffstat (limited to 'components/canvas/webgl_thread.rs')
-rw-r--r-- | components/canvas/webgl_thread.rs | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index 700fdf0db72..abc0ed2f768 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -1045,25 +1045,40 @@ impl WebGLImpl { WebGLCommand::TexImage2D { target, level, - internal_format, + effective_internal_format, size, format, data_type, + effective_data_type, unpacking_alignment, + alpha_treatment, + y_axis_treatment, + tex_source, ref receiver, } => { + let pixels = prepare_pixels( + format, + data_type, + size, + unpacking_alignment, + alpha_treatment, + y_axis_treatment, + tex_source, + receiver.recv().unwrap(), + ); + ctx.gl() .pixel_store_i(gl::UNPACK_ALIGNMENT, unpacking_alignment as i32); ctx.gl().tex_image_2d( target, level as i32, - internal_format as i32, + effective_internal_format as i32, size.width as i32, size.height as i32, 0, - format, - data_type, - Some(&receiver.recv().unwrap()), + format.as_gl_constant(), + effective_data_type, + Some(&pixels), ); }, WebGLCommand::TexSubImage2D { @@ -1074,9 +1089,24 @@ impl WebGLImpl { size, format, data_type, + effective_data_type, unpacking_alignment, + alpha_treatment, + y_axis_treatment, + tex_source, ref receiver, } => { + let pixels = prepare_pixels( + format, + data_type, + size, + unpacking_alignment, + alpha_treatment, + y_axis_treatment, + tex_source, + receiver.recv().unwrap(), + ); + ctx.gl() .pixel_store_i(gl::UNPACK_ALIGNMENT, unpacking_alignment as i32); ctx.gl().tex_sub_image_2d( @@ -1086,9 +1116,9 @@ impl WebGLImpl { yoffset, size.width as i32, size.height as i32, - format, - data_type, - &receiver.recv().unwrap(), + format.as_gl_constant(), + effective_data_type, + &pixels, ); }, WebGLCommand::DrawingBufferWidth(ref sender) => sender |