Skip to content

Commit deb566a

Browse files
committed
dyrend: Support glow renderer
1 parent 8d6d245 commit deb566a

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

dyrend/Cargo.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ path = "../glow"
2323
default-features = false
2424
optional = true
2525

26+
[dependencies.iced_glutin]
27+
path = "../glutin"
28+
default-features = false
29+
optional = true
30+
31+
2632
[dependencies.iced_softbuffer]
2733
path = "../softbuffer"
2834
default-features = false
@@ -37,8 +43,7 @@ optional = true
3743
default = ["softbuffer"]
3844
image = ["iced_graphics/image", "iced_glow?/image", "iced_softbuffer?/image", "iced_wgpu?/image"]
3945
svg = ["iced_graphics/svg", "iced_glow?/svg", "iced_softbuffer?/svg", "iced_wgpu?/svg"]
40-
#TODO: implement Compositor for glow Backend
41-
#glow = ["iced_glow"]
46+
glow = ["iced_glow", "iced_glutin"]
4247
softbuffer = ["iced_softbuffer"]
4348
wgpu = ["iced_wgpu"]
4449

dyrend/src/window/compositor.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#[cfg(feature = "glow")]
22
use iced_glow::window::Compositor as GlowCompositor;
3+
#[cfg(feature = "glow")]
4+
use iced_glutin::Compositor as GlutinCompositor;
35
use iced_graphics::{
46
compositor::{self, Compositor as _, Information, SurfaceError},
57
Color, Error, Viewport,
@@ -16,7 +18,7 @@ use crate::Renderer;
1618
/// A window graphics backend for iced powered by `glow`.
1719
pub enum Compositor<Theme> {
1820
#[cfg(feature = "glow")]
19-
Glow(GlowCompositor<Theme>),
21+
Glow(GlutinCompositor<GlowCompositor<Theme>>),
2022
#[cfg(feature = "softbuffer")]
2123
softbuffer(softbufferCompositor<Theme>),
2224
#[cfg(feature = "wgpu")]
@@ -25,7 +27,7 @@ pub enum Compositor<Theme> {
2527

2628
pub enum Surface<Theme> {
2729
#[cfg(feature = "glow")]
28-
Glow(<GlowCompositor<Theme> as compositor::Compositor>::Surface),
30+
Glow(<GlutinCompositor<GlowCompositor<Theme>> as compositor::Compositor>::Surface),
2931
#[cfg(feature = "softbuffer")]
3032
softbuffer(
3133
<softbufferCompositor<Theme> as compositor::Compositor>::Surface,
@@ -40,13 +42,16 @@ impl<Theme> Compositor<Theme> {
4042
settings: crate::Settings,
4143
compatible_window: Option<&W>,
4244
) -> Result<(Self, Renderer<Theme>), Error> {
43-
match GlowCompositor::new(
44-
iced_glow::Settings {
45-
default_font: settings.default_font,
46-
default_text_size: settings.default_text_size,
47-
text_multithreading: settings.text_multithreading,
48-
antialiasing: settings.antialiasing,
49-
..iced_glow::Settings::from_env()
45+
match GlutinCompositor::new(
46+
iced_glutin::Settings {
47+
gl_settings: iced_glow::Settings {
48+
default_font: settings.default_font,
49+
default_text_size: settings.default_text_size,
50+
text_multithreading: settings.text_multithreading,
51+
antialiasing: settings.antialiasing,
52+
..iced_glow::Settings::from_env()
53+
},
54+
try_opengles_first: false, // XXX
5055
},
5156
compatible_window,
5257
) {

0 commit comments

Comments
 (0)