layout: Fix background color premultiplication

This commit is contained in:
Ivan Molodetskikh
2025-11-13 09:13:35 +03:00
parent 5b77107161
commit a52df533c4
3 changed files with 11 additions and 9 deletions
+6
View File
@@ -77,6 +77,12 @@ impl MulAssign<f32> for Color {
}
}
impl From<Color> for Color32F {
fn from(value: Color) -> Self {
Color32F::from(value.to_array_premul())
}
}
#[derive(knuffel::Decode, Debug, Clone, Copy, PartialEq)]
pub struct Gradient {
#[knuffel(property, str)]
+1 -1
View File
@@ -77,7 +77,7 @@ impl FocusRing {
};
for buf in &mut self.buffers {
buf.set_color(color.to_array_premul());
buf.set_color(color);
}
let radius = radius.fit_to(self.full_size.w as f32, self.full_size.h as f32);
+4 -8
View File
@@ -252,8 +252,6 @@ impl<W: LayoutElement> Workspace<W> {
let shadow_config =
compute_workspace_shadow_config(options.overview.workspace_shadow, view_size);
let background_color = options.layout.background_color.to_array_unpremul();
Self {
scrolling,
floating,
@@ -264,7 +262,7 @@ impl<W: LayoutElement> Workspace<W> {
view_size,
working_area,
shadow: Shadow::new(shadow_config),
background_buffer: SolidColorBuffer::new(view_size, background_color),
background_buffer: SolidColorBuffer::new(view_size, options.layout.background_color),
output: Some(output),
clock,
base_options,
@@ -318,8 +316,6 @@ impl<W: LayoutElement> Workspace<W> {
let shadow_config =
compute_workspace_shadow_config(options.overview.workspace_shadow, view_size);
let background_color = options.layout.background_color.to_array_unpremul();
Self {
scrolling,
floating,
@@ -331,7 +327,7 @@ impl<W: LayoutElement> Workspace<W> {
view_size,
working_area,
shadow: Shadow::new(shadow_config),
background_buffer: SolidColorBuffer::new(view_size, background_color),
background_buffer: SolidColorBuffer::new(view_size, options.layout.background_color),
clock,
base_options,
options,
@@ -421,8 +417,8 @@ impl<W: LayoutElement> Workspace<W> {
compute_workspace_shadow_config(options.overview.workspace_shadow, self.view_size);
self.shadow.update_config(shadow_config);
let background_color = options.layout.background_color.to_array_unpremul();
self.background_buffer.set_color(background_color);
self.background_buffer
.set_color(options.layout.background_color);
self.base_options = base_options;
self.options = options;