1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 13:21:38 +03:00

update image to 0.25

This improves how non-conforming jpegs are decoded and displayed.

refs: https://github.com/wez/wezterm/issues/5365
This commit is contained in:
Wez Furlong 2024-05-05 16:14:46 -07:00
parent ec438e714c
commit 265b85be1d
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
11 changed files with 350 additions and 27 deletions

341
Cargo.lock generated
View File

@ -56,6 +56,12 @@ dependencies = [
"memchr",
]
[[package]]
name = "aligned-vec"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4aa90d7ce82d4be67b64039a3d588d38dbcc6736577de4a847025ce5b0c468d1"
[[package]]
name = "allocator-api2"
version = "0.2.18"
@ -138,6 +144,23 @@ version = "1.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519"
[[package]]
name = "arbitrary"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110"
[[package]]
name = "arg_enum_proc_macro"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.60",
]
[[package]]
name = "arrayref"
version = "0.3.7"
@ -397,6 +420,29 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
[[package]]
name = "av1-grain"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6678909d8c5d46a42abcf571271e15fdbc0a225e3646cf23762cd415046c78bf"
dependencies = [
"anyhow",
"arrayvec",
"log",
"nom",
"num-rational 0.4.1",
"v_frame",
]
[[package]]
name = "avif-serialize"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "876c75a42f6364451a033496a14c44bffe41f5f4a8236f697391f11024e596d2"
dependencies = [
"arrayvec",
]
[[package]]
name = "az"
version = "1.2.1"
@ -497,6 +543,12 @@ dependencies = [
"serde",
]
[[package]]
name = "bitstream-io"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06c9989a51171e2e81038ab168b6ae22886fe9ded214430dbb4f41c28cf176da"
[[package]]
name = "block"
version = "0.1.6"
@ -548,6 +600,12 @@ dependencies = [
"serde",
]
[[package]]
name = "built"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41bfbdb21256b87a8b5e80fab81a8eed158178e812fd7ba451907518b2742f16"
[[package]]
name = "bumpalo"
version = "3.16.0"
@ -580,6 +638,12 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "byteorder-lite"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
[[package]]
name = "bytes"
version = "1.6.0"
@ -636,6 +700,16 @@ dependencies = [
"once_cell",
]
[[package]]
name = "cfg-expr"
version = "0.15.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02"
dependencies = [
"smallvec",
"target-lexicon",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
@ -1068,7 +1142,7 @@ dependencies = [
"clap",
"criterion-plot",
"is-terminal",
"itertools",
"itertools 0.10.5",
"num-traits",
"once_cell",
"oorandom",
@ -1089,7 +1163,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1"
dependencies = [
"cast",
"itertools",
"itertools 0.10.5",
]
[[package]]
@ -2541,22 +2615,43 @@ dependencies = [
[[package]]
name = "image"
version = "0.24.9"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d"
checksum = "fd54d660e773627692c524beaad361aca785a4f9f5730ce91f42aabe5bce3d11"
dependencies = [
"bytemuck",
"byteorder",
"color_quant",
"exr",
"gif",
"jpeg-decoder",
"image-webp",
"num-traits",
"png",
"qoi",
"ravif",
"rayon",
"rgb",
"tiff",
"zune-core",
"zune-jpeg",
]
[[package]]
name = "image-webp"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d730b085583c4d789dfd07fdcf185be59501666a90c97c40162b37e4fdad272d"
dependencies = [
"byteorder-lite",
"thiserror",
]
[[package]]
name = "imgref"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44feda355f4159a7c757171a77de25daf6411e217b4cabd03bd6650690468126"
[[package]]
name = "indexmap"
version = "1.9.3"
@ -2607,6 +2702,17 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "interpolate_name"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.60",
]
[[package]]
name = "intrusive-collections"
version = "0.9.6"
@ -2668,6 +2774,15 @@ dependencies = [
"either",
]
[[package]]
name = "itertools"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "1.0.11"
@ -2688,9 +2803,6 @@ name = "jpeg-decoder"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0"
dependencies = [
"rayon",
]
[[package]]
name = "js-sys"
@ -2827,6 +2939,17 @@ dependencies = [
"rle-decode-fast",
]
[[package]]
name = "libfuzzer-sys"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a96cfd5557eb82f2b83fed4955246c988d331975a002961b07c81584d107e7f7"
dependencies = [
"arbitrary",
"cc",
"once_cell",
]
[[package]]
name = "libgit2-sys"
version = "0.16.2+1.7.2"
@ -3000,6 +3123,15 @@ dependencies = [
"luahelper",
]
[[package]]
name = "loop9"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062"
dependencies = [
"imgref",
]
[[package]]
name = "lru"
version = "0.7.8"
@ -3072,6 +3204,16 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
[[package]]
name = "maybe-rayon"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519"
dependencies = [
"cfg-if",
"rayon",
]
[[package]]
name = "memchr"
version = "2.7.2"
@ -3379,6 +3521,12 @@ dependencies = [
"tempfile",
]
[[package]]
name = "new_debug_unreachable"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
[[package]]
name = "nix"
version = "0.25.1"
@ -3441,6 +3589,12 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21"
[[package]]
name = "noop_proc_macro"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
[[package]]
name = "normalize-line-endings"
version = "0.3.0"
@ -3480,11 +3634,11 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b7a8e9be5e039e2ff869df49155f1c06bd01ade2117ec783e56ab0932b67a8f"
dependencies = [
"num-bigint",
"num-bigint 0.3.3",
"num-complex",
"num-integer",
"num-iter",
"num-rational",
"num-rational 0.3.2",
"num-traits",
]
@ -3499,6 +3653,17 @@ dependencies = [
"num-traits",
]
[[package]]
name = "num-bigint"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0"
dependencies = [
"autocfg",
"num-integer",
"num-traits",
]
[[package]]
name = "num-complex"
version = "0.3.1"
@ -3525,6 +3690,17 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "num-derive"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.60",
]
[[package]]
name = "num-integer"
version = "0.1.46"
@ -3552,7 +3728,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07"
dependencies = [
"autocfg",
"num-bigint",
"num-bigint 0.3.3",
"num-integer",
"num-traits",
]
[[package]]
name = "num-rational"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
dependencies = [
"autocfg",
"num-bigint 0.4.4",
"num-integer",
"num-traits",
]
@ -4131,6 +4319,19 @@ name = "profiling"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43d84d1d7a6ac92673717f9f6d1518374ef257669c24ebc5ac25d5033828be58"
dependencies = [
"profiling-procmacros",
]
[[package]]
name = "profiling-procmacros"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd"
dependencies = [
"quote",
"syn 2.0.60",
]
[[package]]
name = "promise"
@ -4160,6 +4361,12 @@ dependencies = [
"bytemuck",
]
[[package]]
name = "quick-error"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
[[package]]
name = "quick-xml"
version = "0.30.0"
@ -4241,6 +4448,56 @@ dependencies = [
"governor",
]
[[package]]
name = "rav1e"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd87ce80a7665b1cce111f8a16c1f3929f6547ce91ade6addf4ec86a8dda5ce9"
dependencies = [
"arbitrary",
"arg_enum_proc_macro",
"arrayvec",
"av1-grain",
"bitstream-io",
"built",
"cfg-if",
"interpolate_name",
"itertools 0.12.1",
"libc",
"libfuzzer-sys",
"log",
"maybe-rayon",
"new_debug_unreachable",
"noop_proc_macro",
"num-derive 0.4.2",
"num-traits",
"once_cell",
"paste",
"profiling",
"rand",
"rand_chacha",
"simd_helpers",
"system-deps",
"thiserror",
"v_frame",
"wasm-bindgen",
]
[[package]]
name = "ravif"
version = "0.11.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc13288f5ab39e6d7c9d501759712e6969fcc9734220846fc9ed26cae2cc4234"
dependencies = [
"avif-serialize",
"imgref",
"loop9",
"quick-error",
"rav1e",
"rayon",
"rgb",
]
[[package]]
name = "raw-window-handle"
version = "0.5.2"
@ -4875,6 +5132,15 @@ version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
[[package]]
name = "simd_helpers"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6"
dependencies = [
"quote",
]
[[package]]
name = "siphasher"
version = "0.3.11"
@ -5197,6 +5463,19 @@ dependencies = [
"libc",
]
[[package]]
name = "system-deps"
version = "6.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349"
dependencies = [
"cfg-expr",
"heck",
"pkg-config",
"toml 0.8.12",
"version-compare",
]
[[package]]
name = "tabout"
version = "0.3.0"
@ -5221,6 +5500,12 @@ dependencies = [
"xattr",
]
[[package]]
name = "target-lexicon"
version = "0.12.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f"
[[package]]
name = "tempfile"
version = "3.10.1"
@ -5322,7 +5607,7 @@ dependencies = [
"log",
"memmem",
"nix 0.26.4",
"num-derive",
"num-derive 0.3.3",
"num-traits",
"ordered-float",
"pest",
@ -5837,6 +6122,17 @@ dependencies = [
"serde",
]
[[package]]
name = "v_frame"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6f32aaa24bacd11e488aa9ba66369c7cd514885742c9fe08cfe85884db3e92b"
dependencies = [
"aligned-vec",
"num-traits",
"wasm-bindgen",
]
[[package]]
name = "varbincode"
version = "0.1.0"
@ -5854,6 +6150,12 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "version-compare"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b"
[[package]]
name = "version_check"
version = "0.9.4"
@ -7335,6 +7637,12 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "zune-core"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a"
[[package]]
name = "zune-inflate"
version = "0.2.54"
@ -7344,6 +7652,15 @@ dependencies = [
"simd-adler32",
]
[[package]]
name = "zune-jpeg"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec866b44a2a1fd6133d363f073ca1b179f438f99e7e5bfb1e33f7181facfe448"
dependencies = [
"zune-core",
]
[[package]]
name = "zvariant"
version = "3.15.2"

View File

@ -62,6 +62,9 @@ As features stabilize some brief notes about them will accumulate here.
#### Updated
* Bundled conpty.dll and OpenConsole.exe to build 1.19.240130002.nupkg
* Bundled harfbuzz to 8.4.0
* image crate to 0.25, which means that JPEG images are now decoded via
[zune-jpeg](https://docs.rs/zune-jpeg/latest/zune_jpeg/), which improves
handling of non-conforming jpeg images. #5365
* Color schemes:
[Blue Dolphin (Gogh)](colorschemes/b/index.md#blue-dolphin-gogh),
[Butrin (Gogh)](colorschemes/b/index.md#butrin-gogh),

View File

@ -10,7 +10,7 @@ anyhow = "1.0"
config = { path = "../../config" }
csscolorparser = {version="0.6", features=["lab"]}
deltae = "0.3"
image = "0.24.6"
image = "0.25"
lazy_static = "1.4"
log = "0.4"
lru = "0.7"

View File

@ -22,7 +22,7 @@ humansize = "2.1"
miniz_oxide = "0.4"
finl_unicode = "1.2"
hex = "0.4"
image = "0.24.6"
image = "0.25"
lazy_static = "1.4"
log = "0.4"
lru = "0.7"

View File

@ -22,7 +22,7 @@ finl_unicode = "1.2"
fixedbitset = "0.4"
fnv = {version="1.0", optional=true}
hex = "0.4"
image = {version="0.24.6", optional=true}
image = {version="0.25", optional=true}
lazy_static = "1.4"
libc = "0.2"
log = "0.4"

View File

@ -387,8 +387,9 @@ impl ImageDataType {
return Self::EncodedFile(data);
}
};
let cursor = std::io::Cursor::new(&*data);
match format {
ImageFormat::Gif => image::codecs::gif::GifDecoder::new(&*data)
ImageFormat::Gif => image::codecs::gif::GifDecoder::new(cursor)
.and_then(|decoder| decoder.into_frames().collect_frames())
.and_then(|frames| {
if frames.is_empty() {
@ -406,12 +407,15 @@ impl ImageDataType {
Self::decode_single(data)
}),
ImageFormat::Png => {
let decoder = match image::codecs::png::PngDecoder::new(&*data) {
let decoder = match image::codecs::png::PngDecoder::new(cursor) {
Ok(d) => d,
_ => return Self::EncodedFile(data),
};
if decoder.is_apng() {
match decoder.apng().into_frames().collect_frames() {
if decoder.is_apng().unwrap_or(false) {
match decoder
.apng()
.and_then(|d| d.into_frames().collect_frames())
{
Ok(frames) if frames.is_empty() => {
log::error!("decoded image has 0 frames, using placeholder");
Self::placeholder()
@ -424,7 +428,7 @@ impl ImageDataType {
}
}
ImageFormat::WebP => {
let decoder = match image::codecs::webp::WebPDecoder::new(&*data) {
let decoder = match image::codecs::webp::WebPDecoder::new(cursor) {
Ok(d) => d,
_ => return Self::EncodedFile(data),
};

View File

@ -22,7 +22,7 @@ euclid = "0.22"
finl_unicode = "1.2"
freetype = { path = "../deps/freetype" }
harfbuzz = { path = "../deps/harfbuzz" }
image = "0.24.6"
image = "0.25"
lazy_static = "1.4"
lfucache = { path = "../lfucache" }
log = "0.4"

View File

@ -55,7 +55,7 @@ futures = "0.3"
fuzzy-matcher = "0.3"
hdrhistogram = "7.1"
http_req = "0.10"
image = "0.24.6"
image = "0.25"
lazy_static = "1.4"
libc = "0.2"
lfucache = { path = "../lfucache" }

View File

@ -268,8 +268,8 @@ impl FrameDecoder {
reader.rewind().context("rewinding reader for png")?;
let decoder = image::codecs::png::PngDecoder::with_limits(reader, limits.clone())
.context("PngDecoder::with_limits")?;
if decoder.is_apng() {
decoder.apng().into_frames()
if decoder.is_apng().unwrap_or(false) {
decoder.apng()?.into_frames()
} else {
let buf = DynamicImage::from_decoder(decoder)?.into_rgba8();
let delay = image::Delay::from_numer_denom_ms(u32::MAX, 1);

View File

@ -17,7 +17,7 @@ config = { path = "../config" }
env-bootstrap = { path = "../env-bootstrap" }
filedescriptor = { version="0.8", path = "../filedescriptor" }
hostname = "0.4"
image = "0.24.6"
image = "0.25"
libc = "0.2"
log = "0.4"
mux = { path = "../mux" }

View File

@ -48,8 +48,7 @@ use wezterm_input_types::{
use crate::wayland::WaylandConnection;
use crate::x11::KeyboardWithFallback;
use crate::{
Appearance,
Clipboard, Connection, ConnectionOps, Dimensions, MouseCursor, Point, Rect,
Appearance, Clipboard, Connection, ConnectionOps, Dimensions, MouseCursor, Point, Rect,
RequestedWindowGeometry, ResizeIncrement, ResolvedGeometry, Window, WindowEvent,
WindowEventSender, WindowKeyEvent, WindowOps, WindowState,
};