File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ either = "1.13.0"
1616
1717[dependencies .bytemuck ]
1818version = " 1.19.0"
19- features = [" derive" ]
19+ features = [" derive" , " extern_crate_alloc " ]
2020
2121[dependencies .bumpalo ]
2222version = " 3.16.0"
Original file line number Diff line number Diff line change @@ -133,10 +133,8 @@ impl Image {
133133 width : bitmap. width as u32 ,
134134 height : bitmap. height as u32 ,
135135 data : {
136- let cast_input = bytemuck:: cast_slice ( bitmap. buffer . as_slice ( ) ) ;
137- let mut arr = Array2 :: default ( ( bitmap. width , bitmap. height ) ) ;
138- arr. as_slice_mut ( ) . unwrap ( ) . copy_from_slice ( cast_input) ;
139- arr
136+ let cast_input = bytemuck:: allocation:: cast_vec ( bitmap. buffer ) ;
137+ Array2 :: from_shape_vec ( ( bitmap. width , bitmap. height ) , cast_input) . unwrap ( )
140138 } ,
141139 }
142140 }
Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ impl<'a> IconRenderer<'a> {
180180 for frame in range {
181181 self . render_dirs ( icon_state, & mut canvas, frame as u32 ) ;
182182
183- let mut pixels = bytemuck:: cast_slice ( canvas. data . as_slice ( ) . unwrap ( ) ) . to_owned ( ) ;
183+ let mut pixels = bytemuck:: cast_slice_mut ( canvas. data . as_slice_mut ( ) . unwrap ( ) ) ;
184184 let mut gif_frame =
185185 gif:: Frame :: from_rgba ( canvas. width as u16 , canvas. height as u16 , & mut pixels) ;
186186 // gif::Frame delays are measured in "Frame delay in units of 10 ms."
You can’t perform that action at this time.
0 commit comments