commit cd52848a0b762e21e06e5ab3c1cb74bfdbfec96e
parent 80a294a777944c6e5ca96c5f4c7cf1944a8fc3a8
Author: kernelkind <kernelkind@gmail.com>
Date: Sat, 22 Nov 2025 21:19:50 -0700
feat(media-loading): new Images::latest_texture
Signed-off-by: kernelkind <kernelkind@gmail.com>
Diffstat:
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/crates/notedeck/src/imgcache.rs b/crates/notedeck/src/imgcache.rs
@@ -1,7 +1,8 @@
+use crate::jobs::MediaJobSender;
use crate::media::gif::{ensure_latest_texture_from_cache, AnimatedImgTexCache};
use crate::media::images::ImageType;
use crate::media::static_imgs::StaticImgTexCache;
-use crate::media::{AnimationMode, BlurCache};
+use crate::media::{AnimationMode, BlurCache, NoLoadingLatestTex};
use crate::urls::{UrlCache, UrlMimes};
use crate::ImageMetadata;
use crate::ObfuscationType;
@@ -556,6 +557,24 @@ impl Images {
)
}
+ pub fn latest_texture<'a>(
+ &'a mut self,
+ jobs: &MediaJobSender,
+ ui: &mut egui::Ui,
+ url: &str,
+ img_type: ImageType,
+ animation_mode: AnimationMode,
+ ) -> Option<&'a TextureHandle> {
+ let cache_type = crate::urls::supported_mime_hosted_at_url(&mut self.urls, url)?;
+
+ let mut loader = NoLoadingLatestTex::new(
+ &self.textures.static_image,
+ &self.textures.animated,
+ &mut self.gif_states,
+ );
+ loader.latest(jobs, ui.ctx(), url, cache_type, img_type, animation_mode)
+ }
+
pub fn get_cache(&self, cache_type: MediaCacheType) -> &MediaCache {
match cache_type {
MediaCacheType::Image => &self.static_imgs,