Gate Custom variants in iced_renderer behind custom feature
This commit is contained in:
parent
188db4da48
commit
9171df1e35
5 changed files with 34 additions and 9 deletions
|
|
@ -1,5 +1,4 @@
|
|||
use crate::core::Color;
|
||||
use crate::custom;
|
||||
use crate::graphics::compositor::{Information, SurfaceError, Window};
|
||||
use crate::graphics::{Error, Viewport};
|
||||
use crate::{Renderer, Settings};
|
||||
|
|
@ -11,14 +10,16 @@ pub enum Compositor {
|
|||
TinySkia(iced_tiny_skia::window::Compositor),
|
||||
#[cfg(feature = "wgpu")]
|
||||
Wgpu(iced_wgpu::window::Compositor),
|
||||
Custom(Box<dyn custom::Compositor>),
|
||||
#[cfg(feature = "custom")]
|
||||
Custom(Box<dyn crate::custom::Compositor>),
|
||||
}
|
||||
|
||||
pub enum Surface {
|
||||
TinySkia(iced_tiny_skia::window::Surface),
|
||||
#[cfg(feature = "wgpu")]
|
||||
Wgpu(iced_wgpu::window::Surface<'static>),
|
||||
Custom(Box<dyn custom::Surface>),
|
||||
#[cfg(feature = "custom")]
|
||||
Custom(Box<dyn crate::custom::Surface>),
|
||||
}
|
||||
|
||||
impl crate::graphics::Compositor for Compositor {
|
||||
|
|
@ -59,6 +60,7 @@ impl crate::graphics::Compositor for Compositor {
|
|||
Compositor::Wgpu(compositor) => {
|
||||
Renderer::Wgpu(compositor.create_renderer())
|
||||
}
|
||||
#[cfg(feature = "custom")]
|
||||
Compositor::Custom(compositor) => {
|
||||
Renderer::Custom(compositor.create_renderer())
|
||||
}
|
||||
|
|
@ -79,6 +81,7 @@ impl crate::graphics::Compositor for Compositor {
|
|||
Self::Wgpu(compositor) => {
|
||||
Surface::Wgpu(compositor.create_surface(window, width, height))
|
||||
}
|
||||
#[cfg(feature = "custom")]
|
||||
Self::Custom(compositor) => Surface::Custom(
|
||||
compositor.create_surface(Box::new(window), width, height),
|
||||
),
|
||||
|
|
@ -99,6 +102,7 @@ impl crate::graphics::Compositor for Compositor {
|
|||
(Self::Wgpu(compositor), Surface::Wgpu(surface)) => {
|
||||
compositor.configure_surface(surface, width, height);
|
||||
}
|
||||
#[cfg(feature = "custom")]
|
||||
(Self::Custom(compositor), Surface::Custom(surface)) => {
|
||||
compositor.configure_surface(surface, width, height);
|
||||
}
|
||||
|
|
@ -114,6 +118,7 @@ impl crate::graphics::Compositor for Compositor {
|
|||
Self::TinySkia(compositor) => compositor.fetch_information(),
|
||||
#[cfg(feature = "wgpu")]
|
||||
Self::Wgpu(compositor) => compositor.fetch_information(),
|
||||
#[cfg(feature = "custom")]
|
||||
Self::Custom(compositor) => compositor.fetch_information(),
|
||||
}
|
||||
}
|
||||
|
|
@ -158,7 +163,7 @@ impl crate::graphics::Compositor for Compositor {
|
|||
)
|
||||
}),
|
||||
|
||||
#[cfg(feature = "wgpu")]
|
||||
#[cfg(feature = "custom")]
|
||||
(
|
||||
Self::Custom(compositor),
|
||||
crate::Renderer::Custom(renderer),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue