platform: smart-leds: implement layer blending

This commit is contained in:
Victoria Fischer 2024-10-30 21:55:38 +01:00
parent b71a66146c
commit 0a28f9f5c6

View File

@ -1,6 +1,7 @@
use smart_leds_trait::SmartLedsWrite;
use running_average::RealTimeRunningAverage;
use crate::lib8::Rgb8Blend;
use crate::render::{Surface, SurfacePool, Display, Surfaces};
use crate::task::Task;
use crate::power::{brightness_for_mw, AsMilliwatts};
@ -79,7 +80,7 @@ impl<T: SmartLedsWrite<Color = Rgb<u8>>, S: Surface> Display<S> for SmartLedDisp
let mut pixel = Rgb::new(0, 0, 0);
for surface in self.surfaces.iter() {
surface.with_shader(|shader| {
pixel = shader.draw(virt_coords.clone());
pixel = pixel.saturating_add(shader.draw(virt_coords.clone()));
})
}
self.total_mw += pixel.as_milliwatts();