mirror of
https://github.com/wez/wezterm.git
synced 2024-09-22 12:17:19 +03:00
fall back to single frame gif parse if animated mode fails
At least we'll show something if we have a malformed gif.
This commit is contained in:
parent
9b3d35623f
commit
62d1d11eaf
@ -281,11 +281,16 @@ impl DecodedImage {
|
||||
use image::{AnimationDecoder, ImageFormat};
|
||||
let format = image::guess_format(image_data.data())?;
|
||||
match format {
|
||||
ImageFormat::Gif => {
|
||||
let decoder = image::gif::GifDecoder::new(image_data.data())?;
|
||||
let frames = decoder.into_frames().collect_frames()?;
|
||||
Ok(Self::with_frames(frames))
|
||||
}
|
||||
ImageFormat::Gif => image::gif::GifDecoder::new(image_data.data())
|
||||
.and_then(|decoder| decoder.into_frames().collect_frames())
|
||||
.and_then(|frames| Ok(Self::with_frames(frames)))
|
||||
.or_else(|err| {
|
||||
log::error!(
|
||||
"Unable to parse animated gif: {:#}, trying as single frame",
|
||||
err
|
||||
);
|
||||
Self::with_single(image_data)
|
||||
}),
|
||||
ImageFormat::Png => {
|
||||
let decoder = image::png::PngDecoder::new(image_data.data())?;
|
||||
if decoder.is_apng() {
|
||||
|
Loading…
Reference in New Issue
Block a user