this repo has no description
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

♻️ Cast dims into usize variables in render_to_hwc_frame

authored by

Gwenn Le Bihan and committed by
Gwen Le Bihan
8bd143b4 aa49a3d1

+6 -7
+6 -7
src/canvas.rs
··· 627 627 let (width, height) = self.resolution_to_size(resolution); 628 628 let pixmap = self.render_to_pixmap_no_cache(width, height)?; 629 629 630 - let mut data = vec![0u8; height as usize * width as usize * 3]; 630 + let (width, height) = (width as usize, height as usize); 631 + let mut data = vec![0u8; height * width * 3]; 632 + 631 633 data.par_chunks_exact_mut(3) 632 634 .enumerate() 633 635 .for_each(|(index, chunk)| { 634 - let x = index / (height as usize); 635 - let y = index % (height as usize); 636 + let x = index / height; 637 + let y = index % height; 636 638 637 639 let pixel = pixmap 638 640 .pixel(x as u32, y as u32) ··· 643 645 chunk[2] = pixel.blue(); 644 646 }); 645 647 646 - Ok(video_rs::Frame::from_shape_vec( 647 - [height as usize, width as usize, 3], 648 - data, 649 - )?) 648 + Ok(video_rs::Frame::from_shape_vec([height, width, 3], data)?) 650 649 } 651 650 652 651 fn usvg_tree_to_pixmap(