improve handling of animated webp images

Use mainline image crate to avoid an otherwise unavoidable panic
in the upstream: https://github.com/image-rs/image/issues/1775

Explicitly operate on the frames from the animation.

refs: https://github.com/wez/wezterm/issues/3250
This commit is contained in:
Wez Furlong committed 2023-03-15 11:34:47 -07:00
1 parent c6dc38b7f3
commit 2bfb29f1be
7 files changed
+33 -15

No files matched your search

Generated
+13 -11
View File
@@ -1761,9 +1761,9 @@ dependencies = [
[[package]]
name = "gif"
version = "0.11.4"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3edd93c6756b4dfaf2709eafcc345ba2636565295c198a9cfbf75fa5e3e00b06"
checksum = "80792593675e051cf94a4b111980da2ba60d4a83e43e0048c5693baab3977045"
dependencies = [
"color_quant",
"weezl",
@@ -2229,8 +2229,7 @@ dependencies = [
[[package]]
name = "image"
version = "0.24.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69b7ea949b537b0fd0af141fff8c77690f2ce96f4f41f042ccb6c69c6c965945"
source = "git+https://github.com/image-rs/image.git?rev=fe069785ae245a2c510fd724ef96da283b05a236#fe069785ae245a2c510fd724ef96da283b05a236"
dependencies = [
"bytemuck",
"byteorder",
@@ -2241,7 +2240,7 @@ dependencies = [
"num-rational 0.4.1",
"num-traits",
"png",
"scoped_threadpool",
"qoi",
"tiff",
]
@@ -3863,6 +3862,15 @@ version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b45c49fc4f91f35bae654f85ebb3a44d60ac64f11b3166ffa609def390c732d8"
[[package]]
name = "qoi"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001"
dependencies = [
"bytemuck",
]
[[package]]
name = "quanta"
version = "0.9.3"
@@ -4244,12 +4252,6 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
[[package]]
name = "scoped_threadpool"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8"
[[package]]
name = "scopeguard"
version = "1.1.0"
+2
View File
@@ -121,6 +121,8 @@ As features stabilize some brief notes about them will accumulate here.
* SSH: Closing an individual pane via `CloseCurrentPane` would kill the remote
pane but not detect that it had exited.
[#3095](https://github.com/wez/wezterm/issues/3095)
* Panic when decoding animated webp images
[#3250](https://github.com/wez/wezterm/issues/3250)
#### Changed
* `CTRL-SHIFT-P` now activates the new [command
+2 -1
View File
@@ -10,7 +10,8 @@ anyhow = "1.0"
config = { path = "../../config" }
csscolorparser = {version="0.6", features=["lab"]}
deltae = "0.3"
image = "0.24.2"
# we want image 0.24.6 or later. see https://github.com/wez/wezterm/issues/3250
image = {version="0.24", git="https://github.com/image-rs/image.git", rev="fe069785ae245a2c510fd724ef96da283b05a236"}
lazy_static = "1.4"
log = "0.4"
lru = "0.7"
+2 -1
View File
@@ -20,7 +20,8 @@ csscolorparser = "0.6"
miniz_oxide = "0.4"
finl_unicode = "1.2"
hex = "0.4"
image = "0.24"
# we want image 0.24.6 or later. see https://github.com/wez/wezterm/issues/3250
image = {version="0.24", git="https://github.com/image-rs/image.git", rev="fe069785ae245a2c510fd724ef96da283b05a236"}
lazy_static = "1.4"
log = "0.4"
lru = "0.7"
+2 -1
View File
@@ -21,7 +21,8 @@ finl_unicode = "1.2"
fixedbitset = "0.4"
fnv = {version="1.0", optional=true}
hex = "0.4"
image = {version="0.24", optional=true}
# we want image 0.24.6 or later. see https://github.com/wez/wezterm/issues/3250
image = {version="0.24", git="https://github.com/image-rs/image.git", rev="fe069785ae245a2c510fd724ef96da283b05a236", optional=true}
lazy_static = "1.4"
libc = "0.2"
log = "0.4"
+10
View File
@@ -357,6 +357,16 @@ impl ImageDataType {
Self::decode_single(data)
}
}
ImageFormat::WebP => {
let decoder = match image::codecs::webp::WebPDecoder::new(&*data) {
Ok(d) => d,
_ => return Self::EncodedFile(data),
};
match decoder.into_frames().collect_frames() {
Ok(frames) => Self::decode_frames(frames),
_ => Self::EncodedFile(data),
}
}
_ => Self::decode_single(data),
}
}
+2 -1
View File
@@ -55,7 +55,8 @@ futures = "0.3"
fuzzy-matcher = "0.3"
hdrhistogram = "7.1"
http_req = "0.9"
image = "0.24"
# we want image 0.24.6 or later. see https://github.com/wez/wezterm/issues/3250
image = {version="0.24", git="https://github.com/image-rs/image.git", rev="fe069785ae245a2c510fd724ef96da283b05a236"}
lazy_static = "1.4"
libc = "0.2"
lfucache = { path = "../lfucache" }