diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-03 21:21:58 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-03 21:23:32 +0400 |
| commit | 8ab50f9d1ca5795f4eef84ad423dc0d63d990b98 (patch) | |
| tree | 547387d5d17f565791abf9ec3b5bd863a1257162 /src/layout/focus_ring.rs | |
| parent | 5c32031111223cdfb7ad5e9c2766204445ac6492 (diff) | |
| download | niri-8ab50f9d1ca5795f4eef84ad423dc0d63d990b98.tar.gz niri-8ab50f9d1ca5795f4eef84ad423dc0d63d990b98.tar.bz2 niri-8ab50f9d1ca5795f4eef84ad423dc0d63d990b98.zip | |
shader_element: Store program type instead of shader
Diffstat (limited to 'src/layout/focus_ring.rs')
| -rw-r--r-- | src/layout/focus_ring.rs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/layout/focus_ring.rs b/src/layout/focus_ring.rs index 155d3254..18b5d5ca 100644 --- a/src/layout/focus_ring.rs +++ b/src/layout/focus_ring.rs @@ -51,6 +51,13 @@ impl FocusRing { self.config = config; } + pub fn update_shaders(&mut self) { + let mut borders = self.borders.borrow_mut(); + for elem in &mut *borders { + elem.damage_all(); + } + } + pub fn update(&mut self, win_size: Size<i32, Logical>, is_border: bool, radius: CornerRadius) { let width = i32::from(self.config.width); self.full_size = win_size + Size::from((width * 2, width * 2)); @@ -138,9 +145,9 @@ impl FocusRing { self.is_active = is_active; } - pub fn render<R: NiriRenderer>( + pub fn render( &self, - renderer: &mut R, + renderer: &mut impl NiriRenderer, location: Point<i32, Logical>, scale: Scale<f64>, view_size: Size<i32, Logical>, @@ -180,18 +187,14 @@ impl FocusRing { } else { 0. }; - let shader = BorderRenderElement::shader(renderer); - + let has_border_shader = BorderRenderElement::has_shader(renderer); let mut borders = self.borders.borrow_mut(); - for elem in &mut *borders { - elem.update_shader(shader); - } let mut push = |buffer, border: &mut BorderRenderElement, location: Point<i32, Logical>, size: Size<i32, Logical>| { - let elem = if border.has_shader() { + let elem = if has_border_shader { if let Some(gradient) = gradient { let gradient_area = match gradient.relative_to { GradientRelativeTo::Window => full_rect, |
