diff options
author | Simon Wülker <simon.wuelker@arcor.de> | 2025-02-24 18:44:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-24 17:44:35 +0000 |
commit | be6765447d84e28e35903dd3b10e9d81ada0b53d (patch) | |
tree | 24022ffbbf5972f7b78607033ee609c3c668d548 /components/canvas | |
parent | d78f7b2d786735d1c2fad30555bd0d0d42d87129 (diff) | |
download | servo-be6765447d84e28e35903dd3b10e9d81ada0b53d.tar.gz servo-be6765447d84e28e35903dd3b10e9d81ada0b53d.zip |
Update to rust 1.85 (#35628)
* Update to rust 1.85
This is needed for cargo-deny
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Upgrade crown
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Clippy fixes
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Re-upgrade cargo-deny to 0.18
Keeping it locked to 0.18 just in case they
update their required rustc version again
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Diffstat (limited to 'components/canvas')
-rw-r--r-- | components/canvas/canvas_data.rs | 7 | ||||
-rw-r--r-- | components/canvas/webgl_thread.rs | 32 |
2 files changed, 18 insertions, 21 deletions
diff --git a/components/canvas/canvas_data.rs b/components/canvas/canvas_data.rs index 97839f38905..b776399ee2e 100644 --- a/components/canvas/canvas_data.rs +++ b/components/canvas/canvas_data.rs @@ -216,10 +216,7 @@ impl PathBuilderRef<'_> { } fn current_point(&mut self) -> Option<Point2D<f32>> { - let inverse = match self.transform.inverse() { - Some(i) => i, - None => return None, - }; + let inverse = self.transform.inverse()?; self.builder .get_current_point() .map(|point| inverse.transform_point(Point2D::new(point.x, point.y))) @@ -1404,7 +1401,7 @@ impl<'a> CanvasData<'a> { let canvas_rect = Rect::from_size(canvas_size); if canvas_rect .intersection(&read_rect) - .map_or(true, |rect| rect.is_empty()) + .is_none_or(|rect| rect.is_empty()) { return vec![]; } diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index c3382918083..7c6b53d7579 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -2881,10 +2881,10 @@ fn image_to_tex_image_data( for i in 0..pixel_count { let p = { let rgba = &pixels[i * 4..i * 4 + 4]; - (rgba[0] as u16 & 0xf0) << 8 | - (rgba[1] as u16 & 0xf0) << 4 | + ((rgba[0] as u16 & 0xf0) << 8) | + ((rgba[1] as u16 & 0xf0) << 4) | (rgba[2] as u16 & 0xf0) | - (rgba[3] as u16 & 0xf0) >> 4 + ((rgba[3] as u16 & 0xf0) >> 4) }; NativeEndian::write_u16(&mut pixels[i * 2..i * 2 + 2], p); } @@ -2895,10 +2895,10 @@ fn image_to_tex_image_data( for i in 0..pixel_count { let p = { let rgba = &pixels[i * 4..i * 4 + 4]; - (rgba[0] as u16 & 0xf8) << 8 | - (rgba[1] as u16 & 0xf8) << 3 | - (rgba[2] as u16 & 0xf8) >> 2 | - (rgba[3] as u16) >> 7 + ((rgba[0] as u16 & 0xf8) << 8) | + ((rgba[1] as u16 & 0xf8) << 3) | + ((rgba[2] as u16 & 0xf8) >> 2) | + ((rgba[3] as u16) >> 7) }; NativeEndian::write_u16(&mut pixels[i * 2..i * 2 + 2], p); } @@ -2909,9 +2909,9 @@ fn image_to_tex_image_data( for i in 0..pixel_count { let p = { let rgb = &pixels[i * 4..i * 4 + 3]; - (rgb[0] as u16 & 0xf8) << 8 | - (rgb[1] as u16 & 0xfc) << 3 | - (rgb[2] as u16 & 0xf8) >> 3 + ((rgb[0] as u16 & 0xf8) << 8) | + ((rgb[1] as u16 & 0xfc) << 3) | + ((rgb[2] as u16 & 0xf8) >> 3) }; NativeEndian::write_u16(&mut pixels[i * 2..i * 2 + 2], p); } @@ -3057,15 +3057,15 @@ fn premultiply_inplace(format: TexFormat, data_type: TexDataType, pixels: &mut [ (TexFormat::RGBA, TexDataType::UnsignedShort4444) => { for rgba in pixels.chunks_mut(2) { let pix = NativeEndian::read_u16(rgba); - let extend_to_8_bits = |val| (val | val << 4) as u8; - let r = extend_to_8_bits(pix >> 12 & 0x0f); - let g = extend_to_8_bits(pix >> 8 & 0x0f); - let b = extend_to_8_bits(pix >> 4 & 0x0f); + let extend_to_8_bits = |val| (val | (val << 4)) as u8; + let r = extend_to_8_bits((pix >> 12) & 0x0f); + let g = extend_to_8_bits((pix >> 8) & 0x0f); + let b = extend_to_8_bits((pix >> 4) & 0x0f); let a = extend_to_8_bits(pix & 0x0f); NativeEndian::write_u16( rgba, - ((pixels::multiply_u8_color(r, a) & 0xf0) as u16) << 8 | - ((pixels::multiply_u8_color(g, a) & 0xf0) as u16) << 4 | + (((pixels::multiply_u8_color(r, a) & 0xf0) as u16) << 8) | + (((pixels::multiply_u8_color(g, a) & 0xf0) as u16) << 4) | ((pixels::multiply_u8_color(b, a) & 0xf0) as u16) | ((a & 0x0f) as u16), ); |