BlueGit

ict rusty-teams

fix(app): decode chat image thumbnails scaled down

- Chat, link preview and viewer thumbnails decode stills at most 1024 px on the long edge instead of full size
- GIF, WebP and failed decodes fall back to the gpui loader
- Image cache logs kept and freed megabytes once a minute

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-11-10 · 2 weeks ago

Hash
3e88a0c9c96ef70b588ba8f289d71dedb0ab412d
Parent
e087d350
4 files changed +143 −20
crates/app/src/views/attachments.rs +2 −2
@@ -1,4 +1,4 @@
1 use crate::views::image_memory::bounded;
1 use crate::views::image_memory::{bounded, preview};
2 2 use std::rc::Rc;
3 3
4 4 use gpui_kit::assets::IconName;
@@ -117,7 +117,7 @@ fn image_view(
117 117 let frame = frame
118 118 .cursor_pointer()
119 119 .child(
120 img(bounded(entry.path.clone()))
120 img(preview(entry.path.clone()))
121 121 .id(image_id)
122 122 .size_full()
123 123 .rounded(px(IMAGE_RADIUS))
@@ -1,4 +1,4 @@
1use crate::views::image_memory::bounded;
1use crate::views::image_memory::{bounded, preview};
2use std::rc::Rc;
2use std::rc::Rc;
3
3
4use gpui_kit::assets::IconName;
4use gpui_kit::assets::IconName;
@@ -117,7 +117,7 @@ fn image_view(
117 let frame = frame
117 let frame = frame
118 .cursor_pointer()
118 .cursor_pointer()
119 .child(
119 .child(
120 img(bounded(entry.path.clone()))
120 img(preview(entry.path.clone()))
121 .id(image_id)
121 .id(image_id)
122 .size_full()
122 .size_full()
123 .rounded(px(IMAGE_RADIUS))
123 .rounded(px(IMAGE_RADIUS))
crates/app/src/views/image_memory.rs +137 −14
@@ -1,28 +1,48 @@
1 1 use std::collections::HashMap;
2 use std::path::{Path, PathBuf};
2 3 use std::sync::Arc;
3 4 use std::time::{Duration, Instant};
4 5
5 6 use gpui_kit::{
6 App, AppContext, Entity, Global, ImageCacheError, ImageCacheItem, ImageSource, RenderImage, Resource, Window,
7 hash,
7 App, AppContext, Entity, EntityId, Global, ImageCacheError, ImageCacheItem, ImageSource, RenderImage, Resource,
8 Window, hash,
8 9 };
10 use image::imageops::FilterType;
11 use image::{Frame, ImageFormat, ImageReader};
9 12
10 const BUDGET_BYTES: u64 = 64 * 1024 * 1024;
13 const BUDGET_BYTES: u64 = 64 * MEGABYTE;
11 14 const KEEP_RECENT: Duration = Duration::from_secs(10);
15 const REPORT_EVERY: Duration = Duration::from_secs(60);
16 const MEGABYTE: u64 = 1024 * 1024;
17 const PREVIEW_EDGE: u32 = 1024;
12 18
13 19 /// An image source whose decoded pixels are freed again once the image has been off screen for a while and the budget is full.
14 20 pub fn bounded(source: impl Into<ImageSource>) -> ImageSource {
15 21 match source.into() {
16 ImageSource::Resource(resource) => ImageSource::Custom(Arc::new(move |window, cx| load(&resource, window, cx))),
22 ImageSource::Resource(resource) => {
23 ImageSource::Custom(Arc::new(move |window, cx| load(Request::Full(&resource), window, cx)))
24 }
17 25 other => other,
18 26 }
19 27 }
20 28
29 /// Like [`bounded`], but a still picture is decoded scaled down to at most [`PREVIEW_EDGE`] pixels, for thumbnails of full-size photos.
30 pub fn preview(path: PathBuf) -> ImageSource {
31 let path: Arc<Path> = path.into();
32 ImageSource::Custom(Arc::new(move |window, cx| load(Request::Preview(&path), window, cx)))
33 }
34
35 #[derive(Clone, Copy)]
36 enum Request<'a> {
37 Full(&'a Resource),
38 Preview(&'a Arc<Path>),
39 }
40
21 41 struct SharedImages(Entity<BoundedImages>);
22 42
23 43 impl Global for SharedImages {}
24 44
25 fn load(resource: &Resource, window: &mut Window, cx: &mut App) -> Option<Result<Arc<RenderImage>, ImageCacheError>> {
45 fn load(request: Request, window: &mut Window, cx: &mut App) -> Option<Result<Arc<RenderImage>, ImageCacheError>> {
26 46 let images = match cx.try_global::<SharedImages>() {
27 47 Some(shared) => shared.0.clone(),
28 48 None => {
@@ -31,11 +51,18 @@ fn load(resource: &Resource, window: &mut Window, cx: &mut App) -> Option<Result
31 51 images
32 52 }
33 53 };
34 images.update(cx, |images, cx| images.load(resource, window, cx))
54 let handle = images.clone();
55 images.update(cx, |images, cx| images.load(request, &handle, window, cx))
56 }
57
58 enum Pixels {
59 Item(ImageCacheItem),
60 Decoding { waiting: Vec<EntityId> },
61 Decoded(Arc<RenderImage>),
35 62 }
36 63
37 64 struct Entry {
38 item: ImageCacheItem,
65 pixels: Pixels,
39 66 last_use: Instant,
40 67 bytes: u64,
41 68 }
@@ -43,15 +70,46 @@ struct Entry {
43 70 #[derive(Default)]
44 71 struct BoundedImages {
45 72 entries: HashMap<u64, Entry>,
73 freed_bytes: u64,
74 last_report: Option<Instant>,
46 75 }
47 76
48 77 impl BoundedImages {
49 fn load(&mut self, resource: &Resource, window: &mut Window, cx: &mut App) -> Option<Result<Arc<RenderImage>, ImageCacheError>> {
78 fn load(
79 &mut self,
80 request: Request,
81 handle: &Entity<Self>,
82 window: &mut Window,
83 cx: &mut App,
84 ) -> Option<Result<Arc<RenderImage>, ImageCacheError>> {
50 85 let now = Instant::now();
51 let key = hash(resource);
52 let entry = self.entries.entry(key).or_insert_with(|| Entry { item: ImageCacheItem::new(resource, cx), last_use: now, bytes: 0 });
86 let key = match request {
87 Request::Full(resource) => hash(resource),
88 Request::Preview(path) => hash(&(path, PREVIEW_EDGE)),
89 };
90 let entry = self.entries.entry(key).or_insert_with(|| Entry {
91 pixels: match request {
92 Request::Full(resource) => Pixels::Item(ImageCacheItem::new(resource, cx)),
93 Request::Preview(path) => {
94 start_preview(handle, key, path.clone(), cx);
95 Pixels::Decoding { waiting: Vec::new() }
96 }
97 },
98 last_use: now,
99 bytes: 0,
100 });
53 101 entry.last_use = now;
54 let result = entry.item.use_image(window);
102 let result = match &mut entry.pixels {
103 Pixels::Item(item) => item.use_image(window),
104 Pixels::Decoding { waiting } => {
105 let view = window.current_view();
106 if !waiting.contains(&view) {
107 waiting.push(view);
108 }
109 None
110 }
111 Pixels::Decoded(image) => Some(Ok(image.clone())),
112 };
55 113 if entry.bytes == 0
56 114 && let Some(Ok(image)) = &result
57 115 {
@@ -61,15 +119,70 @@ impl BoundedImages {
61 119 result
62 120 }
63 121
122 fn finish_preview(&mut self, key: u64, path: Arc<Path>, decoded: Option<RenderImage>, cx: &mut App) {
123 let Some(entry) = self.entries.get_mut(&key) else {
124 return;
125 };
126 let pixels = match decoded {
127 Some(image) => Pixels::Decoded(Arc::new(image)),
128 None => Pixels::Item(ImageCacheItem::new(&Resource::Path(path), cx)),
129 };
130 if let Pixels::Decoding { waiting } = std::mem::replace(&mut entry.pixels, pixels) {
131 for view in waiting {
132 cx.notify(view);
133 }
134 }
135 }
136
64 137 fn trim(&mut self, now: Instant) {
65 138 let sizes: Vec<(u64, Instant, u64)> =
66 139 self.entries.iter().map(|(key, entry)| (*key, entry.last_use, entry.bytes)).collect();
140 let mut freed_bytes = 0;
67 141 for key in evictions(sizes, now) {
68 self.entries.remove(&key);
142 freed_bytes += self.entries.remove(&key).map_or(0, |entry| entry.bytes);
143 }
144 self.freed_bytes += freed_bytes;
145 if self.last_report.is_none_or(|last| now.duration_since(last) >= REPORT_EVERY) {
146 self.last_report = Some(now);
147 let kept_bytes: u64 = self.entries.values().map(|entry| entry.bytes).sum();
148 app_base::diagnostics::record(&format!(
149 "images: {} kept ({} MB), {} MB freed so far",
150 self.entries.len(),
151 kept_bytes / MEGABYTE,
152 self.freed_bytes / MEGABYTE
153 ));
69 154 }
70 155 }
71 156 }
72 157
158 fn start_preview(handle: &Entity<BoundedImages>, key: u64, path: Arc<Path>, cx: &mut App) {
159 let images = handle.downgrade();
160 cx.spawn(async move |cx| {
161 let source = path.clone();
162 let decoded = cx.background_executor().spawn(async move { decode_preview(&source) }).await;
163 images.update(cx, |images, cx| images.finish_preview(key, path, decoded, cx)).ok();
164 })
165 .detach();
166 }
167
168 fn decode_preview(path: &Path) -> Option<RenderImage> {
169 let reader = ImageReader::open(path).ok()?.with_guessed_format().ok()?;
170 if !matches!(reader.format()?, ImageFormat::Jpeg | ImageFormat::Png | ImageFormat::Bmp) {
171 return None;
172 }
173 let decoded = reader.decode().ok()?;
174 let scaled = if decoded.width().max(decoded.height()) > PREVIEW_EDGE {
175 decoded.resize(PREVIEW_EDGE, PREVIEW_EDGE, FilterType::Triangle)
176 } else {
177 decoded
178 };
179 let mut pixels = scaled.to_rgba8();
180 for pixel in pixels.chunks_exact_mut(4) {
181 pixel.swap(0, 2);
182 }
183 Some(RenderImage::new(vec![Frame::new(pixels)]))
184 }
185
73 186 fn decoded_bytes(image: &RenderImage) -> u64 {
74 187 (0..image.frame_count())
75 188 .map(|frame| {
@@ -98,8 +211,6 @@ fn evictions(mut sizes: Vec<(u64, Instant, u64)>, now: Instant) -> Vec<u64> {
98 211 mod tests {
99 212 use super::*;
100 213
101 const MEGABYTE: u64 = 1024 * 1024;
102
103 214 #[test]
104 215 fn the_oldest_images_go_until_the_rest_fits() {
105 216 let now = Instant::now() + Duration::from_secs(600);
@@ -123,4 +234,16 @@ mod tests {
123 234 let now = Instant::now() + Duration::from_secs(600);
124 235 assert!(evictions(vec![(1, now - Duration::from_secs(300), MEGABYTE)], now).is_empty());
125 236 }
237
238 #[test]
239 fn a_large_photo_is_decoded_scaled_down_and_an_animation_is_left_to_gpui() {
240 let directory = tempfile::tempdir().unwrap();
241 let photo = directory.path().join("photo");
242 image::RgbaImage::new(3000, 2000).save_with_format(&photo, ImageFormat::Png).unwrap();
243 let decoded = decode_preview(&photo).unwrap();
244 assert_eq!((decoded.size(0).width.0, decoded.size(0).height.0), (1024, 683));
245 let animation = directory.path().join("animation");
246 image::RgbaImage::new(10, 10).save_with_format(&animation, ImageFormat::Gif).unwrap();
247 assert!(decode_preview(&animation).is_none());
248 }
126 249 }
@@ -1,28 +1,48 @@
1use std::collections::HashMap;
1use std::collections::HashMap;
2use std::path::{Path, PathBuf};
2use std::sync::Arc;
3use std::sync::Arc;
3use std::time::{Duration, Instant};
4use std::time::{Duration, Instant};
4
5
5use gpui_kit::{
6use gpui_kit::{
6 App, AppContext, Entity, Global, ImageCacheError, ImageCacheItem, ImageSource, RenderImage, Resource, Window,
7 App, AppContext, Entity, EntityId, Global, ImageCacheError, ImageCacheItem, ImageSource, RenderImage, Resource,
7 hash,
8 Window, hash,
8};
9};
10use image::imageops::FilterType;
11use image::{Frame, ImageFormat, ImageReader};
9
12
10const BUDGET_BYTES: u64 = 64 * 1024 * 1024;
13const BUDGET_BYTES: u64 = 64 * MEGABYTE;
11const KEEP_RECENT: Duration = Duration::from_secs(10);
14const KEEP_RECENT: Duration = Duration::from_secs(10);
15const REPORT_EVERY: Duration = Duration::from_secs(60);
16const MEGABYTE: u64 = 1024 * 1024;
17const PREVIEW_EDGE: u32 = 1024;
12
18
13/// An image source whose decoded pixels are freed again once the image has been off screen for a while and the budget is full.
19/// An image source whose decoded pixels are freed again once the image has been off screen for a while and the budget is full.
14pub fn bounded(source: impl Into<ImageSource>) -> ImageSource {
20pub fn bounded(source: impl Into<ImageSource>) -> ImageSource {
15 match source.into() {
21 match source.into() {
16 ImageSource::Resource(resource) => ImageSource::Custom(Arc::new(move |window, cx| load(&resource, window, cx))),
22 ImageSource::Resource(resource) => {
23 ImageSource::Custom(Arc::new(move |window, cx| load(Request::Full(&resource), window, cx)))
24 }
17 other => other,
25 other => other,
18 }
26 }
19}
27}
20
28
29/// Like [`bounded`], but a still picture is decoded scaled down to at most [`PREVIEW_EDGE`] pixels, for thumbnails of full-size photos.
30pub fn preview(path: PathBuf) -> ImageSource {
31 let path: Arc<Path> = path.into();
32 ImageSource::Custom(Arc::new(move |window, cx| load(Request::Preview(&path), window, cx)))
33}
34
35#[derive(Clone, Copy)]
36enum Request<'a> {
37 Full(&'a Resource),
38 Preview(&'a Arc<Path>),
39}
40
21struct SharedImages(Entity<BoundedImages>);
41struct SharedImages(Entity<BoundedImages>);
22
42
23impl Global for SharedImages {}
43impl Global for SharedImages {}
24
44
25fn load(resource: &Resource, window: &mut Window, cx: &mut App) -> Option<Result<Arc<RenderImage>, ImageCacheError>> {
45fn load(request: Request, window: &mut Window, cx: &mut App) -> Option<Result<Arc<RenderImage>, ImageCacheError>> {
26 let images = match cx.try_global::<SharedImages>() {
46 let images = match cx.try_global::<SharedImages>() {
27 Some(shared) => shared.0.clone(),
47 Some(shared) => shared.0.clone(),
28 None => {
48 None => {
@@ -31,11 +51,18 @@ fn load(resource: &Resource, window: &mut Window, cx: &mut App) -> Option<Result
31 images
51 images
32 }
52 }
33 };
53 };
34 images.update(cx, |images, cx| images.load(resource, window, cx))
54 let handle = images.clone();
55 images.update(cx, |images, cx| images.load(request, &handle, window, cx))
56}
57
58enum Pixels {
59 Item(ImageCacheItem),
60 Decoding { waiting: Vec<EntityId> },
61 Decoded(Arc<RenderImage>),
35}
62}
36
63
37struct Entry {
64struct Entry {
38 item: ImageCacheItem,
65 pixels: Pixels,
39 last_use: Instant,
66 last_use: Instant,
40 bytes: u64,
67 bytes: u64,
41}
68}
@@ -43,15 +70,46 @@ struct Entry {
43#[derive(Default)]
70#[derive(Default)]
44struct BoundedImages {
71struct BoundedImages {
45 entries: HashMap<u64, Entry>,
72 entries: HashMap<u64, Entry>,
73 freed_bytes: u64,
74 last_report: Option<Instant>,
46}
75}
47
76
48impl BoundedImages {
77impl BoundedImages {
49 fn load(&mut self, resource: &Resource, window: &mut Window, cx: &mut App) -> Option<Result<Arc<RenderImage>, ImageCacheError>> {
78 fn load(
79 &mut self,
80 request: Request,
81 handle: &Entity<Self>,
82 window: &mut Window,
83 cx: &mut App,
84 ) -> Option<Result<Arc<RenderImage>, ImageCacheError>> {
50 let now = Instant::now();
85 let now = Instant::now();
51 let key = hash(resource);
86 let key = match request {
52 let entry = self.entries.entry(key).or_insert_with(|| Entry { item: ImageCacheItem::new(resource, cx), last_use: now, bytes: 0 });
87 Request::Full(resource) => hash(resource),
88 Request::Preview(path) => hash(&(path, PREVIEW_EDGE)),
89 };
90 let entry = self.entries.entry(key).or_insert_with(|| Entry {
91 pixels: match request {
92 Request::Full(resource) => Pixels::Item(ImageCacheItem::new(resource, cx)),
93 Request::Preview(path) => {
94 start_preview(handle, key, path.clone(), cx);
95 Pixels::Decoding { waiting: Vec::new() }
96 }
97 },
98 last_use: now,
99 bytes: 0,
100 });
53 entry.last_use = now;
101 entry.last_use = now;
54 let result = entry.item.use_image(window);
102 let result = match &mut entry.pixels {
103 Pixels::Item(item) => item.use_image(window),
104 Pixels::Decoding { waiting } => {
105 let view = window.current_view();
106 if !waiting.contains(&view) {
107 waiting.push(view);
108 }
109 None
110 }
111 Pixels::Decoded(image) => Some(Ok(image.clone())),
112 };
55 if entry.bytes == 0
113 if entry.bytes == 0
56 && let Some(Ok(image)) = &result
114 && let Some(Ok(image)) = &result
57 {
115 {
@@ -61,15 +119,70 @@ impl BoundedImages {
61 result
119 result
62 }
120 }
63
121
122 fn finish_preview(&mut self, key: u64, path: Arc<Path>, decoded: Option<RenderImage>, cx: &mut App) {
123 let Some(entry) = self.entries.get_mut(&key) else {
124 return;
125 };
126 let pixels = match decoded {
127 Some(image) => Pixels::Decoded(Arc::new(image)),
128 None => Pixels::Item(ImageCacheItem::new(&Resource::Path(path), cx)),
129 };
130 if let Pixels::Decoding { waiting } = std::mem::replace(&mut entry.pixels, pixels) {
131 for view in waiting {
132 cx.notify(view);
133 }
134 }
135 }
136
64 fn trim(&mut self, now: Instant) {
137 fn trim(&mut self, now: Instant) {
65 let sizes: Vec<(u64, Instant, u64)> =
138 let sizes: Vec<(u64, Instant, u64)> =
66 self.entries.iter().map(|(key, entry)| (*key, entry.last_use, entry.bytes)).collect();
139 self.entries.iter().map(|(key, entry)| (*key, entry.last_use, entry.bytes)).collect();
140 let mut freed_bytes = 0;
67 for key in evictions(sizes, now) {
141 for key in evictions(sizes, now) {
68 self.entries.remove(&key);
142 freed_bytes += self.entries.remove(&key).map_or(0, |entry| entry.bytes);
143 }
144 self.freed_bytes += freed_bytes;
145 if self.last_report.is_none_or(|last| now.duration_since(last) >= REPORT_EVERY) {
146 self.last_report = Some(now);
147 let kept_bytes: u64 = self.entries.values().map(|entry| entry.bytes).sum();
148 app_base::diagnostics::record(&format!(
149 "images: {} kept ({} MB), {} MB freed so far",
150 self.entries.len(),
151 kept_bytes / MEGABYTE,
152 self.freed_bytes / MEGABYTE
153 ));
69 }
154 }
70 }
155 }
71}
156}
72
157
158fn start_preview(handle: &Entity<BoundedImages>, key: u64, path: Arc<Path>, cx: &mut App) {
159 let images = handle.downgrade();
160 cx.spawn(async move |cx| {
161 let source = path.clone();
162 let decoded = cx.background_executor().spawn(async move { decode_preview(&source) }).await;
163 images.update(cx, |images, cx| images.finish_preview(key, path, decoded, cx)).ok();
164 })
165 .detach();
166}
167
168fn decode_preview(path: &Path) -> Option<RenderImage> {
169 let reader = ImageReader::open(path).ok()?.with_guessed_format().ok()?;
170 if !matches!(reader.format()?, ImageFormat::Jpeg | ImageFormat::Png | ImageFormat::Bmp) {
171 return None;
172 }
173 let decoded = reader.decode().ok()?;
174 let scaled = if decoded.width().max(decoded.height()) > PREVIEW_EDGE {
175 decoded.resize(PREVIEW_EDGE, PREVIEW_EDGE, FilterType::Triangle)
176 } else {
177 decoded
178 };
179 let mut pixels = scaled.to_rgba8();
180 for pixel in pixels.chunks_exact_mut(4) {
181 pixel.swap(0, 2);
182 }
183 Some(RenderImage::new(vec![Frame::new(pixels)]))
184}
185
73fn decoded_bytes(image: &RenderImage) -> u64 {
186fn decoded_bytes(image: &RenderImage) -> u64 {
74 (0..image.frame_count())
187 (0..image.frame_count())
75 .map(|frame| {
188 .map(|frame| {
@@ -98,8 +211,6 @@ fn evictions(mut sizes: Vec<(u64, Instant, u64)>, now: Instant) -> Vec<u64> {
98mod tests {
211mod tests {
99 use super::*;
212 use super::*;
100
213
101 const MEGABYTE: u64 = 1024 * 1024;
102
103 #[test]
214 #[test]
104 fn the_oldest_images_go_until_the_rest_fits() {
215 fn the_oldest_images_go_until_the_rest_fits() {
105 let now = Instant::now() + Duration::from_secs(600);
216 let now = Instant::now() + Duration::from_secs(600);
@@ -123,4 +234,16 @@ mod tests {
123 let now = Instant::now() + Duration::from_secs(600);
234 let now = Instant::now() + Duration::from_secs(600);
124 assert!(evictions(vec![(1, now - Duration::from_secs(300), MEGABYTE)], now).is_empty());
235 assert!(evictions(vec![(1, now - Duration::from_secs(300), MEGABYTE)], now).is_empty());
125 }
236 }
237
238 #[test]
239 fn a_large_photo_is_decoded_scaled_down_and_an_animation_is_left_to_gpui() {
240 let directory = tempfile::tempdir().unwrap();
241 let photo = directory.path().join("photo");
242 image::RgbaImage::new(3000, 2000).save_with_format(&photo, ImageFormat::Png).unwrap();
243 let decoded = decode_preview(&photo).unwrap();
244 assert_eq!((decoded.size(0).width.0, decoded.size(0).height.0), (1024, 683));
245 let animation = directory.path().join("animation");
246 image::RgbaImage::new(10, 10).save_with_format(&animation, ImageFormat::Gif).unwrap();
247 assert!(decode_preview(&animation).is_none());
248 }
126}
249}
crates/app/src/views/image_viewer.rs +2 −2
@@ -1,4 +1,4 @@
1 use crate::views::image_memory::bounded;
1 use crate::views::image_memory::{bounded, preview};
2 2 use std::io::Cursor;
3 3 use std::path::{Path, PathBuf};
4 4 use std::sync::Arc;
@@ -875,7 +875,7 @@ impl ImageViewer {
875 875 .when(!current, |frame| frame.opacity(0.7))
876 876 .map(|frame| match path {
877 877 Some(path) => {
878 frame.child(img(bounded(path)).size_full().object_fit(ObjectFit::Cover))
878 frame.child(img(preview(path)).size_full().object_fit(ObjectFit::Cover))
879 879 }
880 880 None => frame.child(symbol("image", 18., white().opacity(0.5))),
881 881 }),
@@ -1,4 +1,4 @@
1use crate::views::image_memory::bounded;
1use crate::views::image_memory::{bounded, preview};
2use std::io::Cursor;
2use std::io::Cursor;
3use std::path::{Path, PathBuf};
3use std::path::{Path, PathBuf};
4use std::sync::Arc;
4use std::sync::Arc;
@@ -875,7 +875,7 @@ impl ImageViewer {
875 .when(!current, |frame| frame.opacity(0.7))
875 .when(!current, |frame| frame.opacity(0.7))
876 .map(|frame| match path {
876 .map(|frame| match path {
877 Some(path) => {
877 Some(path) => {
878 frame.child(img(bounded(path)).size_full().object_fit(ObjectFit::Cover))
878 frame.child(img(preview(path)).size_full().object_fit(ObjectFit::Cover))
879 }
879 }
880 None => frame.child(symbol("image", 18., white().opacity(0.5))),
880 None => frame.child(symbol("image", 18., white().opacity(0.5))),
881 }),
881 }),