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 {
77 }77 }
78 }78 }
79 79
80+impl From<Color> for Color32F {
81+ fn from(value: Color) -> Self {
82+ Color32F::from(value.to_array_premul())
83+ }
84+}
85+
80 #[derive(knuffel::Decode, Debug, Clone, Copy, PartialEq)]86 #[derive(knuffel::Decode, Debug, Clone, Copy, PartialEq)]
81 pub struct Gradient {87 pub struct Gradient {
82 #[knuffel(property, str)]88 #[knuffel(property, str)]
src/layout/focus_ring.rsmodified+1 -1
@@ -77,7 +77,7 @@ impl FocusRing {
77 };77 };
78 78
79 for buf in &mut self.buffers {79 for buf in &mut self.buffers {
80- buf.set_color(color.to_array_premul());80+ buf.set_color(color);
81 }81 }
82 82
83 let radius = radius.fit_to(self.full_size.w as f32, self.full_size.h as f32);83 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> {
252 let shadow_config =252 let shadow_config =
253 compute_workspace_shadow_config(options.overview.workspace_shadow, view_size);253 compute_workspace_shadow_config(options.overview.workspace_shadow, view_size);
254 254
255- let background_color = options.layout.background_color.to_array_unpremul();
256-
257 Self {255 Self {
258 scrolling,256 scrolling,
259 floating,257 floating,
@@ -264,7 +262,7 @@ impl<W: LayoutElement> Workspace<W> {
264 view_size,262 view_size,
265 working_area,263 working_area,
266 shadow: Shadow::new(shadow_config),264 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),
268 output: Some(output),266 output: Some(output),
269 clock,267 clock,
270 base_options,268 base_options,
@@ -318,8 +316,6 @@ impl<W: LayoutElement> Workspace<W> {
318 let shadow_config =316 let shadow_config =
319 compute_workspace_shadow_config(options.overview.workspace_shadow, view_size);317 compute_workspace_shadow_config(options.overview.workspace_shadow, view_size);
320 318
321- let background_color = options.layout.background_color.to_array_unpremul();
322-
323 Self {319 Self {
324 scrolling,320 scrolling,
325 floating,321 floating,
@@ -331,7 +327,7 @@ impl<W: LayoutElement> Workspace<W> {
331 view_size,327 view_size,
332 working_area,328 working_area,
333 shadow: Shadow::new(shadow_config),329 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),
335 clock,331 clock,
336 base_options,332 base_options,
337 options,333 options,
@@ -421,8 +417,8 @@ impl<W: LayoutElement> Workspace<W> {
421 compute_workspace_shadow_config(options.overview.workspace_shadow, self.view_size);417 compute_workspace_shadow_config(options.overview.workspace_shadow, self.view_size);
422 self.shadow.update_config(shadow_config);418 self.shadow.update_config(shadow_config);
423 419
424- let background_color = options.layout.background_color.to_array_unpremul();420+ self.background_buffer
425- self.background_buffer.set_color(background_color);421+ .set_color(options.layout.background_color);
426 422
427 self.base_options = base_options;423 self.base_options = base_options;
428 self.options = options;424 self.options = options;