render: force surfaces to implement default+clone, for now
This commit is contained in:
parent
e475d66842
commit
f264964ebb
@ -35,7 +35,7 @@ impl<T: RgbColor> AsMilliwatts for T {
|
||||
pub struct EmbeddedDisplay<T, S>
|
||||
where
|
||||
T: DrawTarget,
|
||||
S: Surface + Default + Clone {
|
||||
S: Surface {
|
||||
surfaces : SurfacePool<S>,
|
||||
target: T,
|
||||
total_mw: u32,
|
||||
@ -45,7 +45,7 @@ S: Surface + Default + Clone {
|
||||
fps_display: Periodically
|
||||
}
|
||||
|
||||
impl<T: LedPixelShape, S: Surface + Default + Clone> Task for EmbeddedDisplay<Ws2812DrawTarget<'_, T>, S> {
|
||||
impl<T: LedPixelShape, S: Surface> Task for EmbeddedDisplay<Ws2812DrawTarget<'_, T>, S> {
|
||||
fn start(&mut self) {
|
||||
self.target.set_brightness(0);
|
||||
}
|
||||
@ -62,7 +62,7 @@ impl<T: LedPixelShape, S: Surface + Default + Clone> Task for EmbeddedDisplay<Ws
|
||||
impl<T, S> EmbeddedDisplay<T, S>
|
||||
where
|
||||
T: DrawTarget,
|
||||
S: Surface + Default + Clone {
|
||||
S: Surface {
|
||||
pub fn new(target: T, max_mw: u32) -> Self {
|
||||
EmbeddedDisplay {
|
||||
surfaces: SurfacePool::new(),
|
||||
@ -79,13 +79,13 @@ S: Surface + Default + Clone {
|
||||
impl<T, S> Surfaces<S> for EmbeddedDisplay<T, S>
|
||||
where
|
||||
T: DrawTarget,
|
||||
S: Surface + Default + Clone {
|
||||
S: Surface {
|
||||
fn new_surface(&mut self) -> Result<S, io::Error> {
|
||||
self.surfaces.new_surface()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: LedPixelShape, S: Surface + Default + Clone> Display<S> for EmbeddedDisplay<Ws2812DrawTarget<'_, T>, S> {
|
||||
impl<T: LedPixelShape, S: Surface> Display<S> for EmbeddedDisplay<Ws2812DrawTarget<'_, T>, S> {
|
||||
|
||||
fn start_frame(&mut self) {
|
||||
self.total_mw = 0;
|
||||
|
@ -10,7 +10,7 @@ pub trait Shader: Send {
|
||||
fn draw(&self, surface_coords: VirtualCoordinates) -> RGB8;
|
||||
}
|
||||
|
||||
pub trait Surface {
|
||||
pub trait Surface: Default + Clone {
|
||||
fn with_shader<F: FnMut(&dyn Shader)>(&self, f: F);
|
||||
fn set_shader(&mut self, shader: Box<dyn Shader>);
|
||||
fn clear_shader(&mut self);
|
||||
|
Loading…
Reference in New Issue
Block a user