summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-02-24 23:24:48 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-02-24 23:24:48 +0100
commit5100b5d0a1f654ec1254b7765ceadfb9091d6939 (patch)
treeac33dc79803af7040659380c0c94440b29e93e77 /graphics
parent368cadd25a8b57ee5c41e45d1abe8d1dfb194c69 (diff)
downloadiced-5100b5d0a1f654ec1254b7765ceadfb9091d6939.tar.gz
iced-5100b5d0a1f654ec1254b7765ceadfb9091d6939.tar.bz2
iced-5100b5d0a1f654ec1254b7765ceadfb9091d6939.zip
Introduce `iced_renderer` subcrate featuring runtime renderer fallback
Diffstat (limited to 'graphics')
-rw-r--r--graphics/src/lib.rs2
-rw-r--r--graphics/src/renderer.rs7
-rw-r--r--graphics/src/window/gl_compositor.rs2
3 files changed, 7 insertions, 4 deletions
diff --git a/graphics/src/lib.rs b/graphics/src/lib.rs
index 41bef2c3..bbbdfa0e 100644
--- a/graphics/src/lib.rs
+++ b/graphics/src/lib.rs
@@ -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,
};
diff --git a/graphics/src/renderer.rs b/graphics/src/renderer.rs
index b052c094..859ebc04 100644
--- a/graphics/src/renderer.rs
+++ b/graphics/src/renderer.rs
@@ -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)
}
}
diff --git a/graphics/src/window/gl_compositor.rs b/graphics/src/window/gl_compositor.rs
index a45a7ca1..3e6dfd9e 100644
--- a/graphics/src/window/gl_compositor.rs
+++ b/graphics/src/window/gl_compositor.rs
@@ -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;