render: require more rendering primitives to have Sync and/or Send
This commit is contained in:
parent
15308ecd76
commit
06a527a552
@ -73,7 +73,7 @@ impl<P: Pixbuf<Pixel=T::Color>, T: FastWrite> Output for StrideOutput<P, T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait FastWrite {
|
pub trait FastWrite: Send {
|
||||||
type Target: SmartLedsWrite;
|
type Target: SmartLedsWrite;
|
||||||
type Color: HardwarePixel;
|
type Color: HardwarePixel;
|
||||||
type Error;
|
type Error;
|
||||||
|
@ -23,18 +23,17 @@ 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 + Debug {
|
|
||||||
fn draw(&self, surface_coords: &VirtualCoordinates, frame: usize) -> Rgb<u8>;
|
fn draw(&self, surface_coords: &VirtualCoordinates, frame: usize) -> Rgb<u8>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Surfaces: Debug {
|
pub trait Surfaces: Send + Sync {
|
||||||
type Surface: Surface;
|
type Surface: Surface;
|
||||||
fn new_surface(&mut self, area: &Rectangle<Virtual>) -> Result<Self::Surface, io::Error>;
|
fn new_surface(&mut self, area: &Rectangle<Virtual>) -> Result<Self::Surface, io::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: Default + Clone + Debug {
|
pub trait Surface: Send + Sync {
|
||||||
fn with_shader<F: FnMut(&dyn Shader)>(&self, f: F);
|
fn with_shader<F: FnMut(&dyn Shader)>(&self, f: F);
|
||||||
fn set_shader(&mut self, shader: Box<dyn Shader>);
|
fn set_shader(&mut self, shader: Box<dyn Shader>);
|
||||||
fn clear_shader(&mut self);
|
fn clear_shader(&mut self);
|
||||||
@ -45,7 +44,7 @@ pub trait Surface: Default + Clone + Debug {
|
|||||||
fn set_opacity(&mut self, opacity: u8);
|
fn set_opacity(&mut self, opacity: u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Output: Sample {
|
pub trait Output: Sample + Send {
|
||||||
fn blank(&mut self);
|
fn blank(&mut self);
|
||||||
fn commit(&mut self);
|
fn commit(&mut self);
|
||||||
}
|
}
|
||||||
@ -71,7 +70,7 @@ impl<T: Output, S: Surfaces> Renderer<T, S> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Output + Debug, S: Surfaces> Task for Renderer<T, S> {
|
impl<T: Output, S: Surfaces> Task for Renderer<T, S> {
|
||||||
fn name(&self) -> &'static str { "Renderer" }
|
fn name(&self) -> &'static str { "Renderer" }
|
||||||
|
|
||||||
fn tick(&mut self) {
|
fn tick(&mut self) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user