@@ -44,13 +44,16 @@ impl<'a> IconRenderer<'a> {
4444 /// Renders with either [`gif::Encoder`] or [`png::Encoder`] depending on whether the icon state is animated
4545 /// or not.
4646 /// Returns a [`RenderType`] to help you determine how to treat the written data.
47- pub fn prepare_render ( & self , icon_state : & StateIndex ) -> io:: Result < RenderStateGuard > {
47+ pub fn prepare_render ( & self , icon_state : & StateIndex ) -> io:: Result < RenderStateGuard < ' _ > > {
4848 self . prepare_render_state ( self . source . get_icon_state ( icon_state) ?)
4949 }
5050
5151 /// This is here so that duplicate icon states can be handled by not relying on the btreemap
5252 /// of state names in [`Metadata`].
53- pub fn prepare_render_state ( & ' a self , icon_state : & ' a State ) -> io:: Result < RenderStateGuard > {
53+ pub fn prepare_render_state (
54+ & ' a self ,
55+ icon_state : & ' a State ,
56+ ) -> io:: Result < RenderStateGuard < ' a > > {
5457 match icon_state. is_animated ( ) {
5558 false => Ok ( RenderStateGuard {
5659 renderer : self ,
@@ -133,7 +136,7 @@ impl<'a> IconRenderer<'a> {
133136 /// Renders each direction to the same canvas, offsetting them to the right
134137 fn render_dirs ( & self , icon_state : & State , canvas : & mut Image , frame : u32 ) {
135138 for ( dir_no, dir) in Self :: ordered_dirs ( icon_state. dirs ) . iter ( ) . enumerate ( ) {
136- let frame_idx = icon_state. index_of_frame ( * dir, frame as u32 ) ;
139+ let frame_idx = icon_state. index_of_frame ( * dir, frame) ;
137140 let frame_rect = self . source . rect_of_index ( frame_idx) ;
138141 canvas. composite (
139142 & self . source . image ,
@@ -162,11 +165,11 @@ impl<'a> IconRenderer<'a> {
162165 let mut canvas = self . get_canvas ( icon_state. dirs ) ;
163166
164167 let mut encoder = gif:: Encoder :: new ( target, canvas. width as u16 , canvas. height as u16 , & [ ] )
165- . map_err ( |e| io:: Error :: new ( io :: ErrorKind :: Other , format ! ( "{e}" ) ) ) ?;
168+ . map_err ( |e| io:: Error :: other ( format ! ( "{e}" ) ) ) ?;
166169
167170 encoder
168171 . set_repeat ( gif:: Repeat :: Infinite )
169- . map_err ( |e| io:: Error :: new ( io :: ErrorKind :: Other , format ! ( "{e}" ) ) ) ?;
172+ . map_err ( |e| io:: Error :: other ( format ! ( "{e}" ) ) ) ?;
170173
171174 let range = if icon_state. rewind {
172175 Either :: Left ( ( 0 ..frames) . chain ( ( 0 ..frames) . rev ( ) ) )
0 commit comments