summaryrefslogtreecommitdiffstats
path: root/renderer/src/geometry/cache.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-21 05:52:48 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-21 05:52:48 +0100
commit188db4da48954b95a3fe79bcd22689ffc3a661e0 (patch)
tree8af47544c98c212b50c15e66458518974139b796 /renderer/src/geometry/cache.rs
parent2b00e8b1457b0ccbafe12db3dbd6431c2c72f275 (diff)
downloadiced-188db4da48954b95a3fe79bcd22689ffc3a661e0.tar.gz
iced-188db4da48954b95a3fe79bcd22689ffc3a661e0.tar.bz2
iced-188db4da48954b95a3fe79bcd22689ffc3a661e0.zip
Draft support for dynamic custom renderer injection
Diffstat (limited to 'renderer/src/geometry/cache.rs')
-rw-r--r--renderer/src/geometry/cache.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/renderer/src/geometry/cache.rs b/renderer/src/geometry/cache.rs
index 3aff76b9..6a43ddb6 100644
--- a/renderer/src/geometry/cache.rs
+++ b/renderer/src/geometry/cache.rs
@@ -1,4 +1,5 @@
use crate::core::Size;
+use crate::custom;
use crate::geometry::{Frame, Geometry};
use crate::Renderer;
@@ -29,6 +30,7 @@ enum Internal {
TinySkia(Arc<iced_tiny_skia::Primitive>),
#[cfg(feature = "wgpu")]
Wgpu(Arc<iced_wgpu::Primitive>),
+ Custom(Arc<dyn custom::Geometry>),
}
impl Cache {
@@ -82,6 +84,9 @@ impl Cache {
content: primitive.clone(),
});
}
+ Internal::Custom(geometry) => {
+ return Geometry::Custom(geometry.clone().load())
+ }
}
}
}
@@ -100,6 +105,9 @@ impl Cache {
Geometry::Wgpu(primitive) => {
Internal::Wgpu(Arc::new(primitive))
}
+ Geometry::Custom(geometry) => {
+ Internal::Custom(geometry.cache())
+ }
}
};
@@ -120,6 +128,7 @@ impl Cache {
content: primitive,
})
}
+ Internal::Custom(geometry) => Geometry::Custom(geometry.load()),
}
}
}