Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove libavif support #255

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 1 addition & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -42,9 +42,6 @@ linux_mime_types = [
"image/x‑portable‑anymap"
]

[features]
avif = ["libavif-image"]

[target.'cfg(windows)'.build-dependencies]
winres = "0.1"

Expand Down Expand Up @@ -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
23 changes: 0 additions & 23 deletions src/image_cache/image_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand All @@ -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.
Expand Down Expand Up @@ -104,12 +100,6 @@ pub fn detect_format(path: &Path) -> Result<ImgFormat> {

// 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);
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -319,8 +298,6 @@ pub fn is_file_supported(filename: &Path) -> bool {
| "ppm" | "pgm" => {
return true;
}
#[cfg(feature = "avif")]
"avif" => return true,
_ => (),
}
}
Expand Down
Loading