@@ -20,6 +20,8 @@ pub enum BitMapBackendError {
2020 InvalidBuffer ,
2121 /// Some IO error occurs while the bitmap maniuplation
2222 IOError ( std:: io:: Error ) ,
23+ #[ cfg( all( feature = "gif" , not( target_arch = "wasm32" ) , feature = "image" ) ) ]
24+ GifEncodingError ( gif:: EncodingError ) ,
2325 #[ cfg( all( not( target_arch = "wasm32" ) , feature = "image" ) ) ]
2426 /// Image encoding error
2527 ImageError ( ImageError ) ,
@@ -45,7 +47,7 @@ fn blend(prev: &mut u8, new: u8, a: u64) {
4547#[ cfg( all( feature = "gif" , not( target_arch = "wasm32" ) , feature = "image" ) ) ]
4648mod gif_support {
4749 use super :: * ;
48- use gif:: { Encoder as GifEncoder , Frame as GifFrame , Repeat , SetParameter } ;
50+ use gif:: { Encoder as GifEncoder , Frame as GifFrame , Repeat } ;
4951 use std:: fs:: File ;
5052
5153 pub ( super ) struct GifFile {
@@ -67,11 +69,11 @@ mod gif_support {
6769 dim. 1 as u16 ,
6870 & [ ] ,
6971 )
70- . map_err ( BitMapBackendError :: IOError ) ?;
72+ . map_err ( BitMapBackendError :: GifEncodingError ) ?;
7173
7274 encoder
73- . set ( Repeat :: Infinite )
74- . map_err ( BitMapBackendError :: IOError ) ?;
75+ . set_repeat ( Repeat :: Infinite )
76+ . map_err ( BitMapBackendError :: GifEncodingError ) ?;
7577
7678 Ok ( Self {
7779 encoder,
@@ -89,7 +91,7 @@ mod gif_support {
8991
9092 self . encoder
9193 . write_frame ( & frame)
92- . map_err ( BitMapBackendError :: IOError ) ?;
94+ . map_err ( BitMapBackendError :: GifEncodingError ) ?;
9395
9496 Ok ( ( ) )
9597 }
0 commit comments