summaryrefslogtreecommitdiffstats
path: root/tiny_skia
diff options
context:
space:
mode:
Diffstat (limited to 'tiny_skia')
-rw-r--r--tiny_skia/src/window/compositor.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/tiny_skia/src/window/compositor.rs b/tiny_skia/src/window/compositor.rs
index 828e522f..32095e23 100644
--- a/tiny_skia/src/window/compositor.rs
+++ b/tiny_skia/src/window/compositor.rs
@@ -8,6 +8,7 @@ use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle};
use std::marker::PhantomData;
pub struct Compositor<Theme> {
+ settings: Settings,
_theme: PhantomData<Theme>,
}
@@ -28,7 +29,7 @@ impl<Theme> crate::graphics::Compositor for Compositor<Theme> {
settings: Self::Settings,
_compatible_window: Option<&W>,
) -> Result<(Self, Self::Renderer), Error> {
- let (compositor, backend) = new();
+ let (compositor, backend) = new(settings);
Ok((
compositor,
@@ -40,6 +41,14 @@ impl<Theme> crate::graphics::Compositor for Compositor<Theme> {
))
}
+ fn renderer(&self) -> Self::Renderer {
+ Renderer::new(
+ Backend::new(),
+ self.settings.default_font,
+ self.settings.default_text_size,
+ )
+ }
+
fn create_surface<W: HasRawWindowHandle + HasRawDisplayHandle>(
&mut self,
window: &W,
@@ -121,9 +130,10 @@ impl<Theme> crate::graphics::Compositor for Compositor<Theme> {
}
}
-pub fn new<Theme>() -> (Compositor<Theme>, Backend) {
+pub fn new<Theme>(settings: Settings) -> (Compositor<Theme>, Backend) {
(
Compositor {
+ settings,
_theme: PhantomData,
},
Backend::new(),