Draft support for dynamic custom renderer injection
This commit is contained in:
parent
2b00e8b145
commit
188db4da48
12 changed files with 316 additions and 35 deletions
|
|
@ -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()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue