Fix Candidate::build in compositor of iced_renderer
This commit is contained in:
parent
f0fa5f76cb
commit
e63cc181bd
1 changed files with 37 additions and 34 deletions
|
|
@ -179,47 +179,50 @@ impl Candidate {
|
||||||
fn build<Theme, W: HasRawWindowHandle + HasRawDisplayHandle>(
|
fn build<Theme, W: HasRawWindowHandle + HasRawDisplayHandle>(
|
||||||
self,
|
self,
|
||||||
settings: Settings,
|
settings: Settings,
|
||||||
compatible_window: Option<&W>,
|
_compatible_window: Option<&W>,
|
||||||
) -> Result<(Compositor<Theme>, Renderer<Theme>), Error> {
|
) -> Result<(Compositor<Theme>, Renderer<Theme>), Error> {
|
||||||
match self {
|
match self {
|
||||||
|
#[cfg(feature = "wgpu")]
|
||||||
Self::Wgpu => {
|
Self::Wgpu => {
|
||||||
if cfg!(feature = "wgpu") {
|
let (compositor, backend) = iced_wgpu::window::compositor::new(
|
||||||
let (compositor, backend) =
|
iced_wgpu::Settings {
|
||||||
iced_wgpu::window::compositor::new(
|
default_font: settings.default_font,
|
||||||
iced_wgpu::Settings {
|
default_text_size: settings.default_text_size,
|
||||||
default_font: settings.default_font,
|
antialiasing: settings.antialiasing,
|
||||||
default_text_size: settings.default_text_size,
|
..iced_wgpu::Settings::from_env()
|
||||||
antialiasing: settings.antialiasing,
|
},
|
||||||
..iced_wgpu::Settings::from_env()
|
_compatible_window,
|
||||||
},
|
)?;
|
||||||
compatible_window,
|
|
||||||
)?;
|
|
||||||
|
|
||||||
return Ok((
|
Ok((
|
||||||
Compositor::Wgpu(compositor),
|
Compositor::Wgpu(compositor),
|
||||||
Renderer::new(crate::Backend::Wgpu(backend)),
|
Renderer::new(crate::Backend::Wgpu(backend)),
|
||||||
));
|
))
|
||||||
} else {
|
|
||||||
panic!("`wgpu` feature was not enabled in `iced_renderer`");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "tiny-skia")]
|
||||||
Self::TinySkia => {
|
Self::TinySkia => {
|
||||||
if cfg!(feature = "tiny-skia") {
|
let (compositor, backend) =
|
||||||
let (compositor, backend) =
|
iced_tiny_skia::window::compositor::new(
|
||||||
iced_tiny_skia::window::compositor::new(
|
iced_tiny_skia::Settings {
|
||||||
iced_tiny_skia::Settings {
|
default_font: settings.default_font,
|
||||||
default_font: settings.default_font,
|
default_text_size: settings.default_text_size,
|
||||||
default_text_size: settings.default_text_size,
|
},
|
||||||
},
|
);
|
||||||
);
|
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
Compositor::TinySkia(compositor),
|
Compositor::TinySkia(compositor),
|
||||||
Renderer::new(crate::Backend::TinySkia(backend)),
|
Renderer::new(crate::Backend::TinySkia(backend)),
|
||||||
))
|
))
|
||||||
} else {
|
}
|
||||||
panic!("`tiny-skia` feature was not enabled in `iced_renderer`");
|
#[cfg(not(feature = "wgpu"))]
|
||||||
}
|
Self::Wgpu => {
|
||||||
|
panic!("`wgpu` feature was not enabled in `iced_renderer`")
|
||||||
|
}
|
||||||
|
#[cfg(not(feature = "tiny-skia"))]
|
||||||
|
Self::TinySkia => {
|
||||||
|
panic!(
|
||||||
|
"`tiny-skia` feature was not enabled in `iced_renderer`"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue