forge
Explore
Log in

Don't you dare go Hollow

layout: Fix background color premultiplication

Browse files at this commit

a52df533c4694b5ed0a04140af60fd26146df911Ivan MolodetskikhParent: 5b77107
niri-config/src/appearance.rsmodified+6 -0
@@ -77,6 +77,12 @@ impl MulAssign<f32> for Color {
7777 }
7878 }
7979
80+impl From<Color> for Color32F {
81+ fn from(value: Color) -> Self {
82+ Color32F::from(value.to_array_premul())
83+ }
84+}
85+
8086 #[derive(knuffel::Decode, Debug, Clone, Copy, PartialEq)]
8187 pub struct Gradient {
8288 #[knuffel(property, str)]
src/layout/focus_ring.rsmodified+1 -1
@@ -77,7 +77,7 @@ impl FocusRing {
7777 };
7878
7979 for buf in &mut self.buffers {
80- buf.set_color(color.to_array_premul());
80+ buf.set_color(color);
8181 }
8282
8383 let radius = radius.fit_to(self.full_size.w as f32, self.full_size.h as f32);
src/layout/workspace.rsmodified+4 -8
@@ -252,8 +252,6 @@ impl<W: LayoutElement> Workspace<W> {
252252 let shadow_config =
253253 compute_workspace_shadow_config(options.overview.workspace_shadow, view_size);
254254
255- let background_color = options.layout.background_color.to_array_unpremul();
256-
257255 Self {
258256 scrolling,
259257 floating,
@@ -264,7 +262,7 @@ impl<W: LayoutElement> Workspace<W> {
264262 view_size,
265263 working_area,
266264 shadow: Shadow::new(shadow_config),
267- background_buffer: SolidColorBuffer::new(view_size, background_color),
265+ background_buffer: SolidColorBuffer::new(view_size, options.layout.background_color),
268266 output: Some(output),
269267 clock,
270268 base_options,
@@ -318,8 +316,6 @@ impl<W: LayoutElement> Workspace<W> {
318316 let shadow_config =
319317 compute_workspace_shadow_config(options.overview.workspace_shadow, view_size);
320318
321- let background_color = options.layout.background_color.to_array_unpremul();
322-
323319 Self {
324320 scrolling,
325321 floating,
@@ -331,7 +327,7 @@ impl<W: LayoutElement> Workspace<W> {
331327 view_size,
332328 working_area,
333329 shadow: Shadow::new(shadow_config),
334- background_buffer: SolidColorBuffer::new(view_size, background_color),
330+ background_buffer: SolidColorBuffer::new(view_size, options.layout.background_color),
335331 clock,
336332 base_options,
337333 options,
@@ -421,8 +417,8 @@ impl<W: LayoutElement> Workspace<W> {
421417 compute_workspace_shadow_config(options.overview.workspace_shadow, self.view_size);
422418 self.shadow.update_config(shadow_config);
423419
424- let background_color = options.layout.background_color.to_array_unpremul();
425- self.background_buffer.set_color(background_color);
420+ self.background_buffer
421+ .set_color(options.layout.background_color);
426422
427423 self.base_options = base_options;
428424 self.options = options;