summaryrefslogtreecommitdiffstats
path: root/graphics/src/window/gl_compositor.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-03-04 05:37:11 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-03-04 05:37:11 +0100
commit3a0d34c0240f4421737a6a08761f99d6f8140d02 (patch)
treec9a4a6b8e9c1db1b8fcd05bc98e3f131d5ef4bd5 /graphics/src/window/gl_compositor.rs
parentc54409d1711e1f615c7ea4b02c082954e340632a (diff)
downloadiced-3a0d34c0240f4421737a6a08761f99d6f8140d02.tar.gz
iced-3a0d34c0240f4421737a6a08761f99d6f8140d02.tar.bz2
iced-3a0d34c0240f4421737a6a08761f99d6f8140d02.zip
Create `iced_widget` subcrate and re-organize the whole codebase
Diffstat (limited to 'graphics/src/window/gl_compositor.rs')
-rw-r--r--graphics/src/window/gl_compositor.rs71
1 files changed, 0 insertions, 71 deletions
diff --git a/graphics/src/window/gl_compositor.rs b/graphics/src/window/gl_compositor.rs
deleted file mode 100644
index 3e6dfd9e..00000000
--- a/graphics/src/window/gl_compositor.rs
+++ /dev/null
@@ -1,71 +0,0 @@
-//! A compositor is responsible for initializing a renderer and managing window
-//! surfaces.
-use crate::window::compositor::Information;
-use crate::{Color, Error, Size, Viewport};
-
-use core::ffi::c_void;
-
-/// A basic OpenGL compositor.
-///
-/// A compositor is responsible for initializing a renderer and managing window
-/// surfaces.
-///
-/// For now, this compositor only deals with a single global surface
-/// for drawing. However, the trait will most likely change in the near future
-/// to handle multiple surfaces at once.
-///
-/// If you implement an OpenGL renderer, you can implement this trait to ease
-/// integration with existing windowing shells, like `iced_glutin`.
-pub trait GLCompositor: Sized {
- /// The renderer of the [`GLCompositor`].
- ///
- /// This should point to your renderer type, which could be a type alias
- /// of the [`Renderer`] provided in this crate with with a specific
- /// [`Backend`].
- ///
- /// [`Renderer`]: crate::Renderer
- /// [`Backend`]: crate::Backend
- type Renderer: iced_native::Renderer;
-
- /// The settings of the [`GLCompositor`].
- ///
- /// It's up to you to decide the configuration supported by your renderer!
- type Settings: Default;
-
- /// Creates a new [`GLCompositor`] and [`Renderer`] with the given
- /// [`Settings`] and an OpenGL address loader function.
- ///
- /// # Safety
- /// The `loader_function` should resolve to valid OpenGL bindings.
- ///
- /// [`Renderer`]: crate::Renderer
- /// [`Backend`]: crate::Backend
- /// [`Settings`]: Self::Settings
- #[allow(unsafe_code)]
- unsafe fn new(
- settings: Self::Settings,
- loader_function: impl FnMut(&str) -> *const c_void,
- ) -> Result<(Self, Self::Renderer), Error>;
-
- /// Returns the amount of samples that should be used when configuring
- /// an OpenGL context for this [`GLCompositor`].
- fn sample_count(settings: &Self::Settings) -> u32;
-
- /// Resizes the viewport of the [`GLCompositor`].
- fn resize_viewport(&mut self, physical_size: Size<u32>);
-
- /// Returns [`Information`] used by this [`GLCompositor`].
- fn fetch_information(&self) -> Information;
-
- /// Presents the primitives of the [`Renderer`] to the next frame of the
- /// [`GLCompositor`].
- ///
- /// [`Renderer`]: crate::Renderer
- fn present<T: AsRef<str>>(
- &mut self,
- renderer: &mut Self::Renderer,
- viewport: &Viewport,
- background_color: Color,
- overlay: &[T],
- );
-}