Re-organize custom module as pipeline module
... and move `Shader` widget to `iced_widget` crate
This commit is contained in:
parent
2dda9132cd
commit
9489e29e66
14 changed files with 246 additions and 197 deletions
|
|
@ -1,13 +1,15 @@
|
|||
#![forbid(rust_2018_idioms)]
|
||||
#![deny(unsafe_code, unused_results, rustdoc::broken_intra_doc_links)]
|
||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||
#[cfg(feature = "wgpu")]
|
||||
pub use iced_wgpu as wgpu;
|
||||
|
||||
pub mod compositor;
|
||||
|
||||
#[cfg(feature = "geometry")]
|
||||
pub mod geometry;
|
||||
|
||||
mod settings;
|
||||
pub mod widget;
|
||||
|
||||
pub use iced_graphics as graphics;
|
||||
pub use iced_graphics::core;
|
||||
|
|
@ -60,26 +62,6 @@ 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> {
|
||||
|
|
@ -292,3 +274,23 @@ impl<T> crate::graphics::geometry::Renderer for Renderer<T> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "wgpu")]
|
||||
impl<T> iced_wgpu::primitive::pipeline::Renderer for Renderer<T> {
|
||||
fn draw_pipeline_primitive(
|
||||
&mut self,
|
||||
bounds: Rectangle,
|
||||
primitive: impl wgpu::primitive::pipeline::Primitive,
|
||||
) {
|
||||
match self {
|
||||
Self::TinySkia(_renderer) => {
|
||||
log::warn!(
|
||||
"Custom shader primitive is unavailable with tiny-skia."
|
||||
);
|
||||
}
|
||||
Self::Wgpu(renderer) => {
|
||||
renderer.draw_pipeline_primitive(bounds, primitive);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue