summaryrefslogtreecommitdiffstats
path: root/wgpu/src/renderer
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-29 21:44:39 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-29 21:44:39 +0100
commit505588d5851fed8a3bb334edacfa6d96c545d562 (patch)
tree1fb107d7c5f9bae0b6fe0c9ff106d7b9bd483b52 /wgpu/src/renderer
parent811d8b90d71c26100f0933217f5474e090fbf17c (diff)
downloadiced-505588d5851fed8a3bb334edacfa6d96c545d562.tar.gz
iced-505588d5851fed8a3bb334edacfa6d96c545d562.tar.bz2
iced-505588d5851fed8a3bb334edacfa6d96c545d562.zip
Allow to load an image from memory
New `image::Handle` opaque type uniquely identifying some `image::Data`, allowing reliable caching.
Diffstat (limited to 'wgpu/src/renderer')
-rw-r--r--wgpu/src/renderer/widget/image.rs12
1 files changed, 8 insertions, 4 deletions
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,