fix clippy warning for clamp pattern in webgl_thread (#33230)

Signed-off-by: Callum Leslie <git@cleslie.uk>
This commit is contained in:
Callum Leslie 2024-08-28 18:01:13 +01:00 committed by GitHub
parent 7c4ba51f51
commit 87f437d230
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1046,7 +1046,7 @@ impl WebGLImpl {
gl.clear_color(r, g, b, a); gl.clear_color(r, g, b, a);
}, },
WebGLCommand::ClearDepth(depth) => { WebGLCommand::ClearDepth(depth) => {
let value = depth.max(0.).min(1.) as f64; let value = depth.clamp(0., 1.) as f64;
state.depth_clear_value = value; state.depth_clear_value = value;
gl.clear_depth(value) gl.clear_depth(value)
}, },
@ -1085,7 +1085,7 @@ impl WebGLImpl {
state.restore_depth_invariant(gl); state.restore_depth_invariant(gl);
}, },
WebGLCommand::DepthRange(near, far) => { WebGLCommand::DepthRange(near, far) => {
gl.depth_range(near.max(0.).min(1.) as f64, far.max(0.).min(1.) as f64) gl.depth_range(near.clamp(0., 1.) as f64, far.clamp(0., 1.) as f64)
}, },
WebGLCommand::Disable(cap) => match cap { WebGLCommand::Disable(cap) => match cap {
gl::SCISSOR_TEST => { gl::SCISSOR_TEST => {