summaryrefslogtreecommitdiffstats
path: root/wgpu/src/renderer
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--wgpu/src/renderer.rs5
-rw-r--r--wgpu/src/renderer/widget/image.rs12
2 files changed, 11 insertions, 6 deletions
diff --git a/wgpu/src/renderer.rs b/wgpu/src/renderer.rs
index 268a3630..fa52bd96 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
}
@@ -229,9 +230,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],
});
diff --git a/wgpu/src/renderer/widget/image.rs b/wgpu/src/renderer/widget/image.rs
index 0006dde1..70dc5d97 100644
--- a/wgpu/src/renderer/widget/image.rs
+++ b/wgpu/src/renderer/widget/image.rs
@@ -2,14 +2,18 @@ use crate::{Primitive, Renderer};
use iced_native::{image, Layout, MouseCursor};
impl image::Renderer for Renderer {
- fn dimensions(&self, path: &str) -> (u32, u32) {
- self.image_pipeline.dimensions(path)
+ fn dimensions(&self, handle: &image::Handle) -> (u32, u32) {
+ self.image_pipeline.dimensions(handle)
}
- fn draw(&mut self, path: &str, layout: Layout<'_>) -> Self::Output {
+ fn draw(
+ &mut self,
+ handle: image::Handle,
+ layout: Layout<'_>,
+ ) -> Self::Output {
(
Primitive::Image {
- path: String::from(path),
+ handle,
bounds: layout.bounds(),
},
MouseCursor::OutOfBounds,