render: drop Sync from some traits

This commit is contained in:
Torrie Fischer 2024-12-15 17:53:42 +01:00
parent e0643e3fad
commit 7b03c06c29

View File

@ -23,19 +23,19 @@ pub trait Sample {
fn sample(&mut self, rect: &Rectangle<Virtual>) -> impl PixelView<Pixel = Self::Pixel>; fn sample(&mut self, rect: &Rectangle<Virtual>) -> impl PixelView<Pixel = Self::Pixel>;
} }
pub trait Shader: Send + Sync { pub trait Shader: Send {
fn draw(&self, surface_coords: &VirtualCoordinates, frame: usize) -> Rgb<u8>; fn draw(&self, surface_coords: &VirtualCoordinates, frame: usize) -> Rgb<u8>;
} }
pub trait Surfaces: Send + Sync { pub trait Surfaces: Send {
type Surface: Surface; type Surface: Surface;
type Error: Debug; type Error: Debug;
fn new_surface(&mut self, area: Rectangle<Virtual>) -> Result<Self::Surface, Self::Error>; fn new_surface(&mut self, area: Rectangle<Virtual>) -> Result<Self::Surface, Self::Error>;
fn render_to<S: Sample>(&self, output: &mut S, frame: usize); fn render_to<S: Sample>(&self, output: &mut S, frame: usize);
} }
pub trait Surface: Send + Sync { pub trait Surface: Send {
fn set_shader(&mut self, shader: Box<dyn Shader>); fn set_shader<T: Shader + 'static>(&mut self, shader: T);
fn clear_shader(&mut self); fn clear_shader(&mut self);
fn set_rect(&mut self, rect: Rectangle<Virtual>); fn set_rect(&mut self, rect: Rectangle<Virtual>);