Allow custom renderers in Program and Application
This commit is contained in:
parent
4f2f40c68b
commit
5137d655e6
19 changed files with 162 additions and 122 deletions
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue