aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-02-01 18:53:45 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-02-01 18:53:45 +0400
commit2036116f169369e31f4fd8a280788c4267a7024b (patch)
tree3f053ea281ac613414a405da22bd0b8ab9f66cfa
parent9afd728ae98059c9405fe2430399ecb89fd1a7a9 (diff)
downloadniri-2036116f169369e31f4fd8a280788c4267a7024b.tar.gz
niri-2036116f169369e31f4fd8a280788c4267a7024b.tar.bz2
niri-2036116f169369e31f4fd8a280788c4267a7024b.zip
config: Premultiply alpha in Color when converting to f32
Smithay wants premultiplied alpha.
-rw-r--r--niri-config/src/lib.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs
index 736f976e..f00eed9c 100644
--- a/niri-config/src/lib.rs
+++ b/niri-config/src/lib.rs
@@ -348,7 +348,8 @@ impl Color {
impl From<Color> for [f32; 4] {
fn from(c: Color) -> Self {
- [c.r, c.g, c.b, c.a].map(|x| x as f32 / 255.)
+ let [r, g, b, a] = [c.r, c.g, c.b, c.a].map(|x| x as f32 / 255.);
+ [r * a, g * a, b * a, a]
}
}