diff --git a/.gitattributes b/.gitattributes index 09b004b6..b5348bf2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,8 @@ * text=auto eol=lf Cargo.lock linguist-generated=false *.png filter=lfs diff=lfs merge=lfs -text -# The icon.png is needed when including eframe via git, so it may not be in lfs + +# Exclude some small files from LFS: crates/eframe/data/* !filter !diff !merge text=auto eol=lf +crates/egui_demo_lib/data/* !filter !diff !merge text=auto eol=lf +crates/egui/assets/* !filter !diff !merge text=auto eol=lf diff --git a/.github/workflows/png_only_on_lfs.yml b/.github/workflows/png_only_on_lfs.yml index e3d68ea3..624a7f45 100644 --- a/.github/workflows/png_only_on_lfs.yml +++ b/.github/workflows/png_only_on_lfs.yml @@ -13,11 +13,18 @@ jobs: - name: Check that png files are on git LFS run: | binary_extensions="png" - exclude="crates/eframe/data" + exclude_paths=( + "crates/eframe/data" + "crates/egui_demo_lib/data/" + "crates/egui/assets/" + ) # Find binary files that are not tracked by Git LFS for ext in $binary_extensions; do - if comm -23 <(git ls-files | grep -v "^$exclude" | sort) <(git lfs ls-files -n | sort) | grep "\.${ext}$"; then + # Create grep pattern to exclude multiple paths + exclude_pattern=$(printf "|^%s" "${exclude_paths[@]}" | sed 's/^|//') + + if comm -23 <(git ls-files | grep -Ev "$exclude_pattern" | sort) <(git lfs ls-files -n | sort) | grep "\.${ext}$"; then echo "Error: Found binary file with extension .$ext not tracked by git LFS. See CONTRIBUTING.md" exit 1 fi diff --git a/crates/egui/assets/ferris.png b/crates/egui/assets/ferris.png index 129c7f93..8741baa1 100644 Binary files a/crates/egui/assets/ferris.png and b/crates/egui/assets/ferris.png differ diff --git a/crates/egui_demo_app/Cargo.toml b/crates/egui_demo_app/Cargo.toml index 2a1661fc..c3083d11 100644 --- a/crates/egui_demo_app/Cargo.toml +++ b/crates/egui_demo_app/Cargo.toml @@ -28,8 +28,8 @@ default = ["glow", "persistence"] # image_viewer adds about 0.9 MB of WASM web_app = ["http", "persistence"] -http = ["ehttp", "image", "poll-promise", "egui_extras/image"] -image_viewer = ["image", "egui_extras/all_loaders", "rfd"] +http = ["ehttp", "image/jpeg", "poll-promise", "egui_extras/image"] +image_viewer = ["image/jpeg", "egui_extras/all_loaders", "rfd"] persistence = [ "eframe/persistence", "egui_extras/serde", @@ -56,6 +56,10 @@ eframe = { workspace = true, default-features = false, features = [ egui = { workspace = true, features = ["callstack", "default", "log"] } egui_demo_lib = { workspace = true, features = ["default", "chrono"] } egui_extras = { workspace = true, features = ["default", "image"] } +image = { workspace = true, default-features = false, features = [ + # Ensure we can display the test images + "png", +] } log.workspace = true profiling.workspace = true @@ -70,7 +74,6 @@ wgpu = { workspace = true, features = ["webgpu", "webgl"], optional = true } # feature "http": ehttp = { version = "0.5", optional = true } -image = { workspace = true, optional = true, features = ["jpeg", "png"] } poll-promise = { version = "0.3", optional = true, default-features = false } # feature "persistence": diff --git a/crates/egui_demo_lib/data/icon.png b/crates/egui_demo_lib/data/icon.png index eb17ab1a..87f15e74 100644 Binary files a/crates/egui_demo_lib/data/icon.png and b/crates/egui_demo_lib/data/icon.png differ diff --git a/crates/egui_extras/src/loaders/image_loader.rs b/crates/egui_extras/src/loaders/image_loader.rs index 088ef5e4..4c1a846e 100644 --- a/crates/egui_extras/src/loaders/image_loader.rs +++ b/crates/egui_extras/src/loaders/image_loader.rs @@ -78,6 +78,12 @@ impl ImageLoader for ImageCrateLoader { } } + if bytes.starts_with(b"version https://git-lfs") { + return Err(LoadError::FormatNotSupported { + detected_format: Some("git-lfs".to_owned()), + }); + } + // (3) log::trace!("started loading {uri:?}"); let result = crate::image::load_image_bytes(&bytes).map(Arc::new);