render: make surfaces own rectangles, to drop a clone

This commit is contained in:
2024-12-14 14:48:31 +01:00
parent f180171ee7
commit e9bbdd13c2
3 changed files with 14 additions and 15 deletions

View File

@@ -58,9 +58,9 @@ impl Shader for ThinkingShader {
impl<T: Surface> IdleTask<T> {
pub fn new<S: Surfaces<Surface = T>>(surfaces: &mut S) -> Self {
IdleTask {
solid: surfaces.new_surface(&Rectangle::everything()).unwrap(),
surface: surfaces.new_surface(&Rectangle::everything()).unwrap(),
shimmer: surfaces.new_surface(&Rectangle::everything()).unwrap(),
solid: surfaces.new_surface(Rectangle::everything()).unwrap(),
surface: surfaces.new_surface(Rectangle::everything()).unwrap(),
shimmer: surfaces.new_surface(Rectangle::everything()).unwrap(),
}
}
}
@@ -183,8 +183,7 @@ impl<T: Surface> Task for TestPattern<T> {
self.stepper.run(|| {
self.frame = self.frame.wrapping_add(1);
self.surface.set_opacity(sin8(self.frame));
//log::info!("Step {}", self.frame);
self.surface.set_rect( &match self.pattern {
self.surface.set_rect( match self.pattern {
TestShader::SweepX => Rectangle::new(
Coordinates::new(self.frame, 0),
Coordinates::new(self.frame, 255)