Added support for custom shader widget for iced_wgpu backend.
This commit is contained in:
parent
817f728687
commit
781ef1f94c
37 changed files with 2139 additions and 6 deletions
|
|
@ -7,6 +7,7 @@ pub mod compositor;
|
|||
pub mod geometry;
|
||||
|
||||
mod settings;
|
||||
pub mod widget;
|
||||
|
||||
pub use iced_graphics as graphics;
|
||||
pub use iced_graphics::core;
|
||||
|
|
@ -59,6 +60,26 @@ impl<T> Renderer<T> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn draw_custom<P: widget::shader::Primitive>(
|
||||
&mut self,
|
||||
bounds: Rectangle,
|
||||
primitive: P,
|
||||
) {
|
||||
match self {
|
||||
Renderer::TinySkia(_) => {
|
||||
log::warn!(
|
||||
"Custom shader primitive is unavailable with tiny-skia."
|
||||
);
|
||||
}
|
||||
#[cfg(feature = "wgpu")]
|
||||
Renderer::Wgpu(renderer) => {
|
||||
renderer.draw_primitive(iced_wgpu::Primitive::Custom(
|
||||
iced_wgpu::primitive::Custom::shader(bounds, primitive),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> core::Renderer for Renderer<T> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue