diff --git a/src/embedded_graphics_lib.rs b/src/embedded_graphics_lib.rs index 096a15f..b64ca43 100644 --- a/src/embedded_graphics_lib.rs +++ b/src/embedded_graphics_lib.rs @@ -35,7 +35,7 @@ impl AsMilliwatts for T { pub struct EmbeddedDisplay where T: DrawTarget, -S: Surface + Default + Clone { +S: Surface { surfaces : SurfacePool, target: T, total_mw: u32, @@ -45,7 +45,7 @@ S: Surface + Default + Clone { fps_display: Periodically } -impl Task for EmbeddedDisplay, S> { +impl Task for EmbeddedDisplay, S> { fn start(&mut self) { self.target.set_brightness(0); } @@ -62,7 +62,7 @@ impl Task for EmbeddedDisplay EmbeddedDisplay 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 Surfaces for EmbeddedDisplay where T: DrawTarget, -S: Surface + Default + Clone { +S: Surface { fn new_surface(&mut self) -> Result { self.surfaces.new_surface() } } -impl Display for EmbeddedDisplay, S> { +impl Display for EmbeddedDisplay, S> { fn start_frame(&mut self) { self.total_mw = 0; diff --git a/src/render.rs b/src/render.rs index 84201e4..6b08682 100644 --- a/src/render.rs +++ b/src/render.rs @@ -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(&self, f: F); fn set_shader(&mut self, shader: Box); fn clear_shader(&mut self);