From 505588d5851fed8a3bb334edacfa6d96c545d562 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 29 Nov 2019 21:44:39 +0100 Subject: Allow to load an image from memory New `image::Handle` opaque type uniquely identifying some `image::Data`, allowing reliable caching. --- wgpu/src/renderer.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'wgpu/src/renderer.rs') diff --git a/wgpu/src/renderer.rs b/wgpu/src/renderer.rs index f27a4b8a..ad081383 100644 --- a/wgpu/src/renderer.rs +++ b/wgpu/src/renderer.rs @@ -229,9 +229,9 @@ impl Renderer { border_radius: *border_radius as f32, }); } - Primitive::Image { path, bounds } => { + Primitive::Image { handle, bounds } => { layer.images.push(Image { - path: path.clone(), + handle: handle.clone(), position: [bounds.x, bounds.y], scale: [bounds.width, bounds.height], }); -- cgit From fab6d79e84adaad436c7a507ae2e38897ff1739c Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 30 Nov 2019 02:55:14 +0100 Subject: Implement basic image cache trimming in iced_wgpu --- wgpu/src/renderer.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'wgpu/src/renderer.rs') diff --git a/wgpu/src/renderer.rs b/wgpu/src/renderer.rs index ad081383..8f0f7432 100644 --- a/wgpu/src/renderer.rs +++ b/wgpu/src/renderer.rs @@ -127,6 +127,7 @@ impl Renderer { } self.queue.submit(&[encoder.finish()]); + self.image_pipeline.trim_cache(); *mouse_cursor } -- cgit