From 428e8adb90ba5dcdd7b8aaa1397c7048514fdc66 Mon Sep 17 00:00:00 2001 From: Jeron Aldaron Lau Date: Mon, 19 Feb 2024 14:28:34 -0600 Subject: [PATCH] Remove libavif support --- Cargo.lock | 40 --------------------------------- Cargo.toml | 11 +-------- src/image_cache/image_loader.rs | 23 ------------------- 3 files changed, 1 insertion(+), 73 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9ddf8cf..359e9ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -56,7 +56,6 @@ dependencies = [ "kamadak-exif", "lazy_static", "lexical-sort", - "libavif-image", "log", "open", "pico-args", @@ -1181,51 +1180,12 @@ dependencies = [ "any_ascii", ] -[[package]] -name = "libavif" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de9e3e4b3d7207b3e3a5e88292b304d4daf2d018e4cdc57ec28a6757ab75235c" -dependencies = [ - "libavif-sys", -] - -[[package]] -name = "libavif-image" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00adf2185dbfd6555c2a428b6ab13d1839c58dd9fdf409569ed244c2f54f99a5" -dependencies = [ - "image", - "libavif", -] - -[[package]] -name = "libavif-sys" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baaae0ec93359268f49b6659a7505ba224f0e8f7885535f6a8d14c4aa2a544da" -dependencies = [ - "cmake", - "libc", - "libdav1d-sys", -] - [[package]] name = "libc" version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" -[[package]] -name = "libdav1d-sys" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12c9cc342dc258130a727ad15f48d01ebb181aafec30dd65338d8e51db930572" -dependencies = [ - "libc", -] - [[package]] name = "libloading" version = "0.7.4" diff --git a/Cargo.toml b/Cargo.toml index 369027a..4eb8af4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ identifier = "org.ardaku.alloy" icon = ["resource_dev/alloy.png"] resources = ["LICENSE.txt"] short_description = "A lightweight and minimalistic image viewer based on emulsion" -copyright = "Copyright (c) 2020 The Emulsion Contributors, Copyright (c) 2022 The Alloy Contributors" +copyright = "Copyright (c) 2020 The Emulsion Contributors, Copyright (c) 2022-2024 The Alloy Contributors" linux_exec_args = "%f" linux_mime_types = [ "image/jpeg", @@ -42,9 +42,6 @@ linux_mime_types = [ "image/x‑portable‑anymap" ] -[features] -avif = ["libavif-image"] - [target.'cfg(windows)'.build-dependencies] winres = "0.1" @@ -73,9 +70,3 @@ trash = { version = "3.0", default-features = false } typed-builder = "0.18" usvg = "0.40" winit = "0.28" - -[dependencies.libavif-image] -version = "0.11" -default-features = false -features = ["codec-dav1d"] -optional = true diff --git a/src/image_cache/image_loader.rs b/src/image_cache/image_loader.rs index e0a61f8..c8ad57e 100644 --- a/src/image_cache/image_loader.rs +++ b/src/image_cache/image_loader.rs @@ -39,8 +39,6 @@ pub mod errors { ExifError(#[from] exif::Error), #[error(transparent)] SvgError(#[from] usvg::Error), - #[cfg(feature = "avif")] - AvifError(#[from] libavif_image::Error), #[error("{0}")] Msg(String), } @@ -58,8 +56,6 @@ pub const NON_EXISTENT_REQUEST_ID: u32 = std::u32::MAX; pub enum ImgFormat { Image(ImageFormat), Svg, - #[cfg(feature = "avif")] - Avif, } /// These values define the transformation for a pixel array which is to be displayed. @@ -104,12 +100,6 @@ pub fn detect_format(path: &Path) -> Result { // Try to detect the format from the first 512 bytes if file.read_exact(&mut file_start_bytes).is_ok() { - #[cfg(feature = "avif")] - { - if libavif_image::is_avif(&file_start_bytes) { - return Ok(ImgFormat::Avif); - } - } if path.extension() == Some(std::ffi::OsStr::new("svg")) { return Ok(ImgFormat::Svg); } @@ -256,17 +246,6 @@ where orientation, })?; } - #[cfg(feature = "avif")] - ImgFormat::Avif => { - let buf = fs::read(path)?; - let image = libavif_image::read(&buf)?.into_rgba8(); - process_image(LoadResult::Frame { - req_id, - image, - delay_nano: 0, - orientation, - })?; - } ImgFormat::Svg => { let image = load_svg(path)?; process_image(LoadResult::Frame { @@ -319,8 +298,6 @@ pub fn is_file_supported(filename: &Path) -> bool { | "ppm" | "pgm" => { return true; } - #[cfg(feature = "avif")] - "avif" => return true, _ => (), } }