Introduce iced_renderer subcrate featuring runtime renderer fallback

This commit is contained in:
Héctor Ramón Jiménez 2023-02-24 23:24:48 +01:00
parent 368cadd25a
commit 5100b5d0a1
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
16 changed files with 371 additions and 72 deletions

View file

@ -46,9 +46,9 @@ pub use primitive::Primitive;
pub use renderer::Renderer;
pub use transformation::Transformation;
pub use viewport::Viewport;
pub use window::compositor;
pub use iced_native::alignment;
pub use iced_native::text;
pub use iced_native::{
Alignment, Background, Color, Font, Point, Rectangle, Size, Vector,
};

View file

@ -43,8 +43,11 @@ impl<B: Backend, T> Renderer<B, T> {
/// Runs the given closure with the [`Backend`] and the recorded primitives
/// of the [`Renderer`].
pub fn with_primitives(&mut self, f: impl FnOnce(&mut B, &[Primitive])) {
f(&mut self.backend, &self.primitives);
pub fn with_primitives<O>(
&mut self,
f: impl FnOnce(&mut B, &[Primitive]) -> O,
) -> O {
f(&mut self.backend, &self.primitives)
}
}

View file

@ -1,6 +1,6 @@
//! A compositor is responsible for initializing a renderer and managing window
//! surfaces.
use crate::compositor::Information;
use crate::window::compositor::Information;
use crate::{Color, Error, Size, Viewport};
use core::ffi::c_void;