From 6e18da5363c541fb7aa989863bdf71cf0c79fb9f Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Sat, 7 Dec 2024 05:43:09 +0900 Subject: [PATCH] Update gif_loader.rs --- crates/egui_extras/src/loaders/gif_loader.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/egui_extras/src/loaders/gif_loader.rs b/crates/egui_extras/src/loaders/gif_loader.rs index 1c20135150c..5b1e710bc0f 100644 --- a/crates/egui_extras/src/loaders/gif_loader.rs +++ b/crates/egui_extras/src/loaders/gif_loader.rs @@ -131,4 +131,13 @@ impl ImageLoader for GifLoader { }) .sum() } + + fn frame_count(&self, uri: &str) -> usize { + let cache = self.cache.lock(); + if let Some(Ok(image)) = cache.get(uri) { + image.frames.len() + } else { + 0 + } + } }