diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2018-10-02 13:25:45 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2018-10-02 14:21:06 +0200 |
commit | a3392610c3414a86a2294073bdc59c78c237bfda (patch) | |
tree | 549cc165a6a48da00ac9a6e4f715f3978112f79f /components/canvas/webgl_thread.rs | |
parent | b8dbf2dddd88516f85370c49015133435750003d (diff) | |
download | servo-a3392610c3414a86a2294073bdc59c78c237bfda.tar.gz servo-a3392610c3414a86a2294073bdc59c78c237bfda.zip |
Make HTMLCanvasElement::get_size return a Size2D<u32>
The changes keep trickling down.
Diffstat (limited to 'components/canvas/webgl_thread.rs')
-rw-r--r-- | components/canvas/webgl_thread.rs | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index 74f25b7768b..413566e7817 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -219,7 +219,7 @@ impl<VR: WebVRRenderHandler + 'static> WebGLThread<VR> { fn create_webgl_context( &mut self, version: WebGLVersion, - size: Size2D<i32>, + size: Size2D<u32>, attributes: GLContextAttributes, ) -> Result<(WebGLContextId, GLLimits, WebGLContextShareMode), String> { // Creating a new GLContext may make the current bound context_id dirty. @@ -239,7 +239,7 @@ impl<VR: WebVRRenderHandler + 'static> WebGLThread<VR> { let ctx = self.gl_factory.new_context(version, size, attributes)?; Ok((ctx, WebGLContextShareMode::Readback)) }) - .map_err(|msg| msg.to_owned())?; + .map_err(|msg: &str| msg.to_owned())?; let id = WebGLContextId(self.next_webgl_id); let (size, texture_id, limits) = ctx.get_info(); @@ -261,10 +261,12 @@ impl<VR: WebVRRenderHandler + 'static> WebGLThread<VR> { } /// Resizes a WebGLContext - fn resize_webgl_context(&mut self, - context_id: WebGLContextId, - size: Size2D<i32>, - sender: WebGLSender<Result<(), String>>) { + fn resize_webgl_context( + &mut self, + context_id: WebGLContextId, + size: Size2D<u32>, + sender: WebGLSender<Result<(), String>>, + ) { let data = Self::make_current_if_needed_mut( context_id, &mut self.contexts, @@ -796,8 +798,12 @@ impl WebGLImpl { ctx.gl().renderbuffer_storage(target, format, width, height), WebGLCommand::SampleCoverage(value, invert) => ctx.gl().sample_coverage(value, invert), - WebGLCommand::Scissor(x, y, width, height) => - ctx.gl().scissor(x, y, width, height), + WebGLCommand::Scissor(x, y, width, height) => { + // FIXME(nox): Kinda unfortunate that some u32 values could + // end up as negative numbers here, but I don't even think + // that can happen in the real world. + ctx.gl().scissor(x, y, width as i32, height as i32); + }, WebGLCommand::StencilFunc(func, ref_, mask) => ctx.gl().stencil_func(func, ref_, mask), WebGLCommand::StencilFuncSeparate(face, func, ref_, mask) => |