fix: allow negative values for rotating filter

This commit is contained in:
Pascal Engélibert 2022-08-29 09:54:23 +02:00
parent da1a8351ff
commit 160e881ba7
Signed by: tuxmain
GPG key ID: 3504BC6D362F7DCA

View file

@ -23,6 +23,10 @@ impl PassThroughFilter {
PassThroughFilter::Rotating(filter_angle) => {
let mut hsla = color.as_hsla_f32();
hsla[0] = (hsla[0] + filter_angle) % 360.;
// floating rem is not modulo!
if hsla[0] < 0. {
hsla[0] += 360.;
}
Color::hsla(hsla[0], hsla[1], hsla[2], hsla[3])
}
}