diff options
author | 2021-10-14 16:07:22 +0700 | |
---|---|---|
committer | 2021-10-14 16:07:22 +0700 | |
commit | 03b34931383e701c39c653a7662a616fe21a0947 (patch) | |
tree | 8c0773d50b615dbc62210db8919ecb97ca912bd9 /graphics/src/window | |
parent | 3aae45c1913e6a6f60b009f19d00d10add7ad11e (diff) | |
download | iced-03b34931383e701c39c653a7662a616fe21a0947.tar.gz iced-03b34931383e701c39c653a7662a616fe21a0947.tar.bz2 iced-03b34931383e701c39c653a7662a616fe21a0947.zip |
Remove trait-specific draw logic in `iced_native`
Diffstat (limited to 'graphics/src/window')
-rw-r--r-- | graphics/src/window/compositor.rs | 18 | ||||
-rw-r--r-- | graphics/src/window/gl_compositor.rs | 9 |
2 files changed, 11 insertions, 16 deletions
diff --git a/graphics/src/window/compositor.rs b/graphics/src/window/compositor.rs index 37edef1d..9ea040cd 100644 --- a/graphics/src/window/compositor.rs +++ b/graphics/src/window/compositor.rs @@ -1,7 +1,5 @@ use crate::{Color, Error, Viewport}; -use iced_native::mouse; - use raw_window_handle::HasRawWindowHandle; use thiserror::Error; @@ -30,9 +28,8 @@ pub trait Compositor: Sized { window: &W, ) -> Self::Surface; - /// Crates a new [`SwapChain`] for the given [`Surface`]. + /// Configures a new [`Surface`] with the given dimensions. /// - /// [`SwapChain`]: Self::SwapChain /// [`Surface`]: Self::Surface fn configure_surface( &mut self, @@ -41,18 +38,17 @@ pub trait Compositor: Sized { height: u32, ); - /// Draws the output primitives to the next frame of the given [`SwapChain`]. + /// Presents the [`Renderer`] primitives to the next frame of the given [`Surface`]. /// /// [`SwapChain`]: Self::SwapChain - fn draw<T: AsRef<str>>( + fn present<T: AsRef<str>>( &mut self, renderer: &mut Self::Renderer, surface: &mut Self::Surface, viewport: &Viewport, background_color: Color, - output: &<Self::Renderer as iced_native::Renderer>::Output, overlay: &[T], - ) -> Result<mouse::Interaction, SurfaceError>; + ) -> Result<(), SurfaceError>; } /// Result of an unsuccessful call to [`Compositor::draw`]. @@ -63,13 +59,13 @@ pub enum SurfaceError { "A timeout was encountered while trying to acquire the next frame" )] Timeout, - /// The underlying surface has changed, and therefore the swap chain must be updated. + /// The underlying surface has changed, and therefore the surface must be updated. #[error( - "The underlying surface has changed, and therefore the swap chain must be updated." + "The underlying surface has changed, and therefore the surface must be updated." )] Outdated, /// The swap chain has been lost and needs to be recreated. - #[error("The swap chain has been lost and needs to be recreated")] + #[error("The surface has been lost and needs to be recreated")] Lost, /// There is no more memory left to allocate a new frame. #[error("There is no more memory left to allocate a new frame")] diff --git a/graphics/src/window/gl_compositor.rs b/graphics/src/window/gl_compositor.rs index 34d70be3..b1b995f1 100644 --- a/graphics/src/window/gl_compositor.rs +++ b/graphics/src/window/gl_compositor.rs @@ -1,5 +1,4 @@ use crate::{Color, Error, Size, Viewport}; -use iced_native::mouse; use core::ffi::c_void; @@ -49,15 +48,15 @@ pub trait GLCompositor: Sized { /// Resizes the viewport of the [`GLCompositor`]. fn resize_viewport(&mut self, physical_size: Size<u32>); - /// Draws the provided output with the given [`Renderer`]. + /// Presents the primitives of the [`Renderer`] to the next frame of the + /// [`GLCompositor`]. /// /// [`Renderer`]: crate::Renderer - fn draw<T: AsRef<str>>( + fn present<T: AsRef<str>>( &mut self, renderer: &mut Self::Renderer, viewport: &Viewport, background_color: Color, - output: &<Self::Renderer as iced_native::Renderer>::Output, overlay: &[T], - ) -> mouse::Interaction; + ); } |