diff options
author | 2024-03-22 07:09:51 +0100 | |
---|---|---|
committer | 2024-03-22 07:09:51 +0100 | |
commit | 5137d655e6bbd29581fc1469d0385515113f2999 (patch) | |
tree | 46a3ff77014d7e7bd2047ce7c6e7dfe9b3a596cd /tiny_skia | |
parent | 4f2f40c68b4647f281d34034beb159a41422aa06 (diff) | |
download | iced-5137d655e6bbd29581fc1469d0385515113f2999.tar.gz iced-5137d655e6bbd29581fc1469d0385515113f2999.tar.bz2 iced-5137d655e6bbd29581fc1469d0385515113f2999.zip |
Allow custom renderers in `Program` and `Application`
Diffstat (limited to 'tiny_skia')
-rw-r--r-- | tiny_skia/src/settings.rs | 10 | ||||
-rw-r--r-- | tiny_skia/src/window/compositor.rs | 7 |
2 files changed, 13 insertions, 4 deletions
diff --git a/tiny_skia/src/settings.rs b/tiny_skia/src/settings.rs index ec27b218..01d015b4 100644 --- a/tiny_skia/src/settings.rs +++ b/tiny_skia/src/settings.rs @@ -1,4 +1,5 @@ use crate::core::{Font, Pixels}; +use crate::graphics; /// The settings of a [`Backend`]. /// @@ -22,3 +23,12 @@ impl Default for Settings { } } } + +impl From<graphics::Settings> for Settings { + fn from(settings: graphics::Settings) -> Self { + Self { + default_font: settings.default_font, + default_text_size: settings.default_text_size, + } + } +} diff --git a/tiny_skia/src/window/compositor.rs b/tiny_skia/src/window/compositor.rs index a98825f1..0c08097b 100644 --- a/tiny_skia/src/window/compositor.rs +++ b/tiny_skia/src/window/compositor.rs @@ -1,7 +1,7 @@ use crate::core::{Color, Rectangle, Size}; use crate::graphics::compositor::{self, Information}; use crate::graphics::damage; -use crate::graphics::{Error, Viewport}; +use crate::graphics::{self, Error, Viewport}; use crate::{Backend, Primitive, Renderer, Settings}; use std::collections::VecDeque; @@ -25,15 +25,14 @@ pub struct Surface { } impl crate::graphics::Compositor for Compositor { - type Settings = Settings; type Renderer = Renderer; type Surface = Surface; fn new<W: compositor::Window>( - settings: Self::Settings, + settings: graphics::Settings, compatible_window: W, ) -> impl Future<Output = Result<Self, Error>> { - future::ready(Ok(new(settings, compatible_window))) + future::ready(Ok(new(settings.into(), compatible_window))) } fn create_renderer(&self) -> Self::Renderer { |