Add alpha parameter to shaders
Browse files at this commit4f05a74aa84bca74b650cffdc7ad889413f621cfParent: c30f52222 changed files +50 -4
- niri-visual-tests/src/cases/gradient_angle.rs +1 -0
- niri-visual-tests/src/cases/gradient_area.rs +2 -0
- niri-visual-tests/src/cases/gradient_oklab.rs +1 -0
- niri-visual-tests/src/cases/gradient_oklab_alpha.rs +1 -0
- niri-visual-tests/src/cases/gradient_oklch_alpha.rs +1 -0
- niri-visual-tests/src/cases/gradient_oklch_decreasing.rs +1 -0
- niri-visual-tests/src/cases/gradient_oklch_increasing.rs +1 -0
- niri-visual-tests/src/cases/gradient_oklch_longer.rs +1 -0
- niri-visual-tests/src/cases/gradient_oklch_shorter.rs +1 -0
- niri-visual-tests/src/cases/gradient_srgb.rs +1 -0
- niri-visual-tests/src/cases/gradient_srgb_alpha.rs +1 -0
- niri-visual-tests/src/cases/gradient_srgblinear.rs +1 -0
- niri-visual-tests/src/cases/gradient_srgblinear_alpha.rs +1 -0
- src/layer/mapped.rs +1 -1
- src/layout/focus_ring.rs +8 -2
- src/layout/insert_hint_element.rs +1 -1
- src/layout/shadow.rs +3 -0
- src/layout/tile.rs +4 -0
- src/render_helpers/border.rs +8 -0
- src/render_helpers/shader_element.rs +2 -0
- src/render_helpers/shadow.rs +8 -0
- src/window/mapped.rs +1 -0
niri-visual-tests/src/cases/gradient_angle.rsmodified+1 -0
| @@ -63,6 +63,7 @@ impl TestCase for GradientAngle { | |||
| 63 | 0., | 63 | 0., |
| 64 | CornerRadius::default(), | 64 | CornerRadius::default(), |
| 65 | 1., | 65 | 1., |
| 66 | + 1., | ||
| 66 | ) | 67 | ) |
| 67 | .with_location(area.loc)] | 68 | .with_location(area.loc)] |
| 68 | .into_iter() | 69 | .into_iter() |
niri-visual-tests/src/cases/gradient_area.rsmodified+2 -0
| @@ -84,6 +84,7 @@ impl TestCase for GradientArea { | |||
| 84 | Rectangle::default(), | 84 | Rectangle::default(), |
| 85 | CornerRadius::default(), | 85 | CornerRadius::default(), |
| 86 | 1., | 86 | 1., |
| 87 | + 1., | ||
| 87 | ); | 88 | ); |
| 88 | rv.extend( | 89 | rv.extend( |
| 89 | self.border | 90 | self.border |
| @@ -103,6 +104,7 @@ impl TestCase for GradientArea { | |||
| 103 | 0., | 104 | 0., |
| 104 | CornerRadius::default(), | 105 | CornerRadius::default(), |
| 105 | 1., | 106 | 1., |
| 107 | + 1., | ||
| 106 | ) | 108 | ) |
| 107 | .with_location(area.loc)] | 109 | .with_location(area.loc)] |
| 108 | .into_iter() | 110 | .into_iter() |
niri-visual-tests/src/cases/gradient_oklab.rsmodified+1 -0
| @@ -44,6 +44,7 @@ impl TestCase for GradientOklab { | |||
| 44 | 0., | 44 | 0., |
| 45 | CornerRadius::default(), | 45 | CornerRadius::default(), |
| 46 | 1., | 46 | 1., |
| 47 | + 1., | ||
| 47 | ) | 48 | ) |
| 48 | .with_location(area.loc)] | 49 | .with_location(area.loc)] |
| 49 | .into_iter() | 50 | .into_iter() |
niri-visual-tests/src/cases/gradient_oklab_alpha.rsmodified+1 -0
| @@ -42,6 +42,7 @@ impl TestCase for GradientOklabAlpha { | |||
| 42 | 0., | 42 | 0., |
| 43 | CornerRadius::default(), | 43 | CornerRadius::default(), |
| 44 | 1., | 44 | 1., |
| 45 | + 1., | ||
| 45 | ) | 46 | ) |
| 46 | .with_location(area.loc)] | 47 | .with_location(area.loc)] |
| 47 | .into_iter() | 48 | .into_iter() |
niri-visual-tests/src/cases/gradient_oklch_alpha.rsmodified+1 -0
| @@ -44,6 +44,7 @@ impl TestCase for GradientOklchAlpha { | |||
| 44 | 0., | 44 | 0., |
| 45 | CornerRadius::default(), | 45 | CornerRadius::default(), |
| 46 | 1., | 46 | 1., |
| 47 | + 1., | ||
| 47 | ) | 48 | ) |
| 48 | .with_location(area.loc)] | 49 | .with_location(area.loc)] |
| 49 | .into_iter() | 50 | .into_iter() |
niri-visual-tests/src/cases/gradient_oklch_decreasing.rsmodified+1 -0
| @@ -44,6 +44,7 @@ impl TestCase for GradientOklchDecreasing { | |||
| 44 | 0., | 44 | 0., |
| 45 | CornerRadius::default(), | 45 | CornerRadius::default(), |
| 46 | 1., | 46 | 1., |
| 47 | + 1., | ||
| 47 | ) | 48 | ) |
| 48 | .with_location(area.loc)] | 49 | .with_location(area.loc)] |
| 49 | .into_iter() | 50 | .into_iter() |
niri-visual-tests/src/cases/gradient_oklch_increasing.rsmodified+1 -0
| @@ -44,6 +44,7 @@ impl TestCase for GradientOklchIncreasing { | |||
| 44 | 0., | 44 | 0., |
| 45 | CornerRadius::default(), | 45 | CornerRadius::default(), |
| 46 | 1., | 46 | 1., |
| 47 | + 1., | ||
| 47 | ) | 48 | ) |
| 48 | .with_location(area.loc)] | 49 | .with_location(area.loc)] |
| 49 | .into_iter() | 50 | .into_iter() |
niri-visual-tests/src/cases/gradient_oklch_longer.rsmodified+1 -0
| @@ -44,6 +44,7 @@ impl TestCase for GradientOklchLonger { | |||
| 44 | 0., | 44 | 0., |
| 45 | CornerRadius::default(), | 45 | CornerRadius::default(), |
| 46 | 1., | 46 | 1., |
| 47 | + 1., | ||
| 47 | ) | 48 | ) |
| 48 | .with_location(area.loc)] | 49 | .with_location(area.loc)] |
| 49 | .into_iter() | 50 | .into_iter() |
niri-visual-tests/src/cases/gradient_oklch_shorter.rsmodified+1 -0
| @@ -44,6 +44,7 @@ impl TestCase for GradientOklchShorter { | |||
| 44 | 0., | 44 | 0., |
| 45 | CornerRadius::default(), | 45 | CornerRadius::default(), |
| 46 | 1., | 46 | 1., |
| 47 | + 1., | ||
| 47 | ) | 48 | ) |
| 48 | .with_location(area.loc)] | 49 | .with_location(area.loc)] |
| 49 | .into_iter() | 50 | .into_iter() |
niri-visual-tests/src/cases/gradient_srgb.rsmodified+1 -0
| @@ -44,6 +44,7 @@ impl TestCase for GradientSrgb { | |||
| 44 | 0., | 44 | 0., |
| 45 | CornerRadius::default(), | 45 | CornerRadius::default(), |
| 46 | 1., | 46 | 1., |
| 47 | + 1., | ||
| 47 | ) | 48 | ) |
| 48 | .with_location(area.loc)] | 49 | .with_location(area.loc)] |
| 49 | .into_iter() | 50 | .into_iter() |
niri-visual-tests/src/cases/gradient_srgb_alpha.rsmodified+1 -0
| @@ -42,6 +42,7 @@ impl TestCase for GradientSrgbAlpha { | |||
| 42 | 0., | 42 | 0., |
| 43 | CornerRadius::default(), | 43 | CornerRadius::default(), |
| 44 | 1., | 44 | 1., |
| 45 | + 1., | ||
| 45 | ) | 46 | ) |
| 46 | .with_location(area.loc)] | 47 | .with_location(area.loc)] |
| 47 | .into_iter() | 48 | .into_iter() |
niri-visual-tests/src/cases/gradient_srgblinear.rsmodified+1 -0
| @@ -44,6 +44,7 @@ impl TestCase for GradientSrgbLinear { | |||
| 44 | 0., | 44 | 0., |
| 45 | CornerRadius::default(), | 45 | CornerRadius::default(), |
| 46 | 1., | 46 | 1., |
| 47 | + 1., | ||
| 47 | ) | 48 | ) |
| 48 | .with_location(area.loc)] | 49 | .with_location(area.loc)] |
| 49 | .into_iter() | 50 | .into_iter() |
niri-visual-tests/src/cases/gradient_srgblinear_alpha.rsmodified+1 -0
| @@ -42,6 +42,7 @@ impl TestCase for GradientSrgbLinearAlpha { | |||
| 42 | 0., | 42 | 0., |
| 43 | CornerRadius::default(), | 43 | CornerRadius::default(), |
| 44 | 1., | 44 | 1., |
| 45 | + 1., | ||
| 45 | ) | 46 | ) |
| 46 | .with_location(area.loc)] | 47 | .with_location(area.loc)] |
| 47 | .into_iter() | 48 | .into_iter() |
src/layer/mapped.rsmodified+1 -1
| @@ -74,7 +74,7 @@ impl MappedLayer { | |||
| 74 | let radius = self.rules.geometry_corner_radius.unwrap_or_default(); | 74 | let radius = self.rules.geometry_corner_radius.unwrap_or_default(); |
| 75 | // FIXME: is_active based on keyboard focus? | 75 | // FIXME: is_active based on keyboard focus? |
| 76 | self.shadow | 76 | self.shadow |
| 77 | - .update_render_elements(size, true, radius, scale.x); | 77 | + .update_render_elements(size, true, radius, scale.x, 1.); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | pub fn surface(&self) -> &LayerSurface { | 80 | pub fn surface(&self) -> &LayerSurface { |
src/layout/focus_ring.rsmodified+8 -2
| @@ -2,7 +2,7 @@ use std::iter::zip; | |||
| 2 | 2 | ||
| 3 | use arrayvec::ArrayVec; | 3 | use arrayvec::ArrayVec; |
| 4 | use niri_config::{CornerRadius, Gradient, GradientRelativeTo}; | 4 | use niri_config::{CornerRadius, Gradient, GradientRelativeTo}; |
| 5 | -use smithay::backend::renderer::element::Kind; | 5 | +use smithay::backend::renderer::element::{Element as _, Kind}; |
| 6 | use smithay::utils::{Logical, Point, Rectangle, Size}; | 6 | use smithay::utils::{Logical, Point, Rectangle, Size}; |
| 7 | 7 | ||
| 8 | use crate::niri_render_elements; | 8 | use crate::niri_render_elements; |
| @@ -53,6 +53,7 @@ impl FocusRing { | |||
| 53 | } | 53 | } |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | + #[allow(clippy::too_many_arguments)] | ||
| 56 | pub fn update_render_elements( | 57 | pub fn update_render_elements( |
| 57 | &mut self, | 58 | &mut self, |
| 58 | win_size: Size<f64, Logical>, | 59 | win_size: Size<f64, Logical>, |
| @@ -61,6 +62,7 @@ impl FocusRing { | |||
| 61 | view_rect: Rectangle<f64, Logical>, | 62 | view_rect: Rectangle<f64, Logical>, |
| 62 | radius: CornerRadius, | 63 | radius: CornerRadius, |
| 63 | scale: f64, | 64 | scale: f64, |
| 65 | + alpha: f32, | ||
| 64 | ) { | 66 | ) { |
| 65 | let width = self.config.width.0; | 67 | let width = self.config.width.0; |
| 66 | self.full_size = win_size + Size::from((width, width)).upscale(2.); | 68 | self.full_size = win_size + Size::from((width, width)).upscale(2.); |
| @@ -181,6 +183,7 @@ impl FocusRing { | |||
| 181 | rounded_corner_border_width, | 183 | rounded_corner_border_width, |
| 182 | radius, | 184 | radius, |
| 183 | scale as f32, | 185 | scale as f32, |
| 186 | + alpha, | ||
| 184 | ); | 187 | ); |
| 185 | } | 188 | } |
| 186 | } else { | 189 | } else { |
| @@ -199,6 +202,7 @@ impl FocusRing { | |||
| 199 | rounded_corner_border_width, | 202 | rounded_corner_border_width, |
| 200 | radius, | 203 | radius, |
| 201 | scale as f32, | 204 | scale as f32, |
| 205 | + alpha, | ||
| 202 | ); | 206 | ); |
| 203 | } | 207 | } |
| 204 | 208 | ||
| @@ -229,7 +233,9 @@ impl FocusRing { | |||
| 229 | let elem = if self.use_border_shader && has_border_shader { | 233 | let elem = if self.use_border_shader && has_border_shader { |
| 230 | border.clone().with_location(location).into() | 234 | border.clone().with_location(location).into() |
| 231 | } else { | 235 | } else { |
| 232 | - SolidColorRenderElement::from_buffer(buffer, location, 1., Kind::Unspecified).into() | 236 | + let alpha = border.alpha(); |
| 237 | + SolidColorRenderElement::from_buffer(buffer, location, alpha, Kind::Unspecified) | ||
| 238 | + .into() | ||
| 233 | }; | 239 | }; |
| 234 | rv.push(elem); | 240 | rv.push(elem); |
| 235 | }; | 241 | }; |
src/layout/insert_hint_element.rsmodified+1 -1
| @@ -48,7 +48,7 @@ impl InsertHintElement { | |||
| 48 | scale: f64, | 48 | scale: f64, |
| 49 | ) { | 49 | ) { |
| 50 | self.inner | 50 | self.inner |
| 51 | - .update_render_elements(size, true, false, view_rect, radius, scale); | 51 | + .update_render_elements(size, true, false, view_rect, radius, scale, 1.); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | pub fn render( | 54 | pub fn render( |
src/layout/shadow.rsmodified+3 -0
| @@ -38,6 +38,7 @@ impl Shadow { | |||
| 38 | is_active: bool, | 38 | is_active: bool, |
| 39 | radius: CornerRadius, | 39 | radius: CornerRadius, |
| 40 | scale: f64, | 40 | scale: f64, |
| 41 | + alpha: f32, | ||
| 41 | ) { | 42 | ) { |
| 42 | let ceil = |logical: f64| (logical * scale).ceil() / scale; | 43 | let ceil = |logical: f64| (logical * scale).ceil() / scale; |
| 43 | 44 | ||
| @@ -129,6 +130,7 @@ impl Shadow { | |||
| 129 | scale as f32, | 130 | scale as f32, |
| 130 | Rectangle::new(window_geo.loc - offset - rect.loc, window_geo.size), | 131 | Rectangle::new(window_geo.loc - offset - rect.loc, window_geo.size), |
| 131 | win_radius, | 132 | win_radius, |
| 133 | + alpha, | ||
| 132 | ); | 134 | ); |
| 133 | 135 | ||
| 134 | rect.loc += offset; | 136 | rect.loc += offset; |
| @@ -147,6 +149,7 @@ impl Shadow { | |||
| 147 | scale as f32, | 149 | scale as f32, |
| 148 | Rectangle::zero(), | 150 | Rectangle::zero(), |
| 149 | Default::default(), | 151 | Default::default(), |
| 152 | + alpha, | ||
| 150 | ); | 153 | ); |
| 151 | 154 | ||
| 152 | self.shader_rects[0].loc += offset; | 155 | self.shader_rects[0].loc += offset; |
src/layout/tile.rsmodified+4 -0
| @@ -336,6 +336,7 @@ impl<W: LayoutElement> Tile<W> { | |||
| 336 | ), | 336 | ), |
| 337 | radius, | 337 | radius, |
| 338 | self.scale, | 338 | self.scale, |
| 339 | + 1., | ||
| 339 | ); | 340 | ); |
| 340 | 341 | ||
| 341 | let radius = if self.is_fullscreen { | 342 | let radius = if self.is_fullscreen { |
| @@ -350,6 +351,7 @@ impl<W: LayoutElement> Tile<W> { | |||
| 350 | is_active, | 351 | is_active, |
| 351 | radius, | 352 | radius, |
| 352 | self.scale, | 353 | self.scale, |
| 354 | + 1., | ||
| 353 | ); | 355 | ); |
| 354 | 356 | ||
| 355 | let draw_focus_ring_with_background = if self.effective_border_width().is_some() { | 357 | let draw_focus_ring_with_background = if self.effective_border_width().is_some() { |
| @@ -365,6 +367,7 @@ impl<W: LayoutElement> Tile<W> { | |||
| 365 | view_rect, | 367 | view_rect, |
| 366 | radius, | 368 | radius, |
| 367 | self.scale, | 369 | self.scale, |
| 370 | + 1., | ||
| 368 | ); | 371 | ); |
| 369 | } | 372 | } |
| 370 | 373 | ||
| @@ -880,6 +883,7 @@ impl<W: LayoutElement> Tile<W> { | |||
| 880 | 0., | 883 | 0., |
| 881 | radius, | 884 | radius, |
| 882 | scale.x as f32, | 885 | scale.x as f32, |
| 886 | + 1., | ||
| 883 | ) | 887 | ) |
| 884 | .with_location(geo.loc) | 888 | .with_location(geo.loc) |
| 885 | .into(); | 889 | .into(); |
src/render_helpers/border.rsmodified+8 -0
| @@ -39,6 +39,7 @@ struct Parameters { | |||
| 39 | corner_radius: CornerRadius, | 39 | corner_radius: CornerRadius, |
| 40 | // Should only be used for visual improvements, i.e. corner radius anti-aliasing. | 40 | // Should only be used for visual improvements, i.e. corner radius anti-aliasing. |
| 41 | scale: f32, | 41 | scale: f32, |
| 42 | + alpha: f32, | ||
| 42 | } | 43 | } |
| 43 | 44 | ||
| 44 | impl BorderRenderElement { | 45 | impl BorderRenderElement { |
| @@ -54,6 +55,7 @@ impl BorderRenderElement { | |||
| 54 | border_width: f32, | 55 | border_width: f32, |
| 55 | corner_radius: CornerRadius, | 56 | corner_radius: CornerRadius, |
| 56 | scale: f32, | 57 | scale: f32, |
| 58 | + alpha: f32, | ||
| 57 | ) -> Self { | 59 | ) -> Self { |
| 58 | let inner = ShaderRenderElement::empty(ProgramType::Border, Kind::Unspecified); | 60 | let inner = ShaderRenderElement::empty(ProgramType::Border, Kind::Unspecified); |
| 59 | let mut rv = Self { | 61 | let mut rv = Self { |
| @@ -69,6 +71,7 @@ impl BorderRenderElement { | |||
| 69 | border_width, | 71 | border_width, |
| 70 | corner_radius, | 72 | corner_radius, |
| 71 | scale, | 73 | scale, |
| 74 | + alpha, | ||
| 72 | }, | 75 | }, |
| 73 | }; | 76 | }; |
| 74 | rv.update_inner(); | 77 | rv.update_inner(); |
| @@ -90,6 +93,7 @@ impl BorderRenderElement { | |||
| 90 | border_width: 0., | 93 | border_width: 0., |
| 91 | corner_radius: Default::default(), | 94 | corner_radius: Default::default(), |
| 92 | scale: 1., | 95 | scale: 1., |
| 96 | + alpha: 1., | ||
| 93 | }, | 97 | }, |
| 94 | } | 98 | } |
| 95 | } | 99 | } |
| @@ -111,6 +115,7 @@ impl BorderRenderElement { | |||
| 111 | border_width: f32, | 115 | border_width: f32, |
| 112 | corner_radius: CornerRadius, | 116 | corner_radius: CornerRadius, |
| 113 | scale: f32, | 117 | scale: f32, |
| 118 | + alpha: f32, | ||
| 114 | ) { | 119 | ) { |
| 115 | let params = Parameters { | 120 | let params = Parameters { |
| 116 | size, | 121 | size, |
| @@ -123,6 +128,7 @@ impl BorderRenderElement { | |||
| 123 | border_width, | 128 | border_width, |
| 124 | corner_radius, | 129 | corner_radius, |
| 125 | scale, | 130 | scale, |
| 131 | + alpha, | ||
| 126 | }; | 132 | }; |
| 127 | if self.params == params { | 133 | if self.params == params { |
| 128 | return; | 134 | return; |
| @@ -144,6 +150,7 @@ impl BorderRenderElement { | |||
| 144 | border_width, | 150 | border_width, |
| 145 | corner_radius, | 151 | corner_radius, |
| 146 | scale, | 152 | scale, |
| 153 | + alpha, | ||
| 147 | } = self.params; | 154 | } = self.params; |
| 148 | 155 | ||
| 149 | let grad_offset = geometry.loc - gradient_area.loc; | 156 | let grad_offset = geometry.loc - gradient_area.loc; |
| @@ -189,6 +196,7 @@ impl BorderRenderElement { | |||
| 189 | size, | 196 | size, |
| 190 | None, | 197 | None, |
| 191 | scale, | 198 | scale, |
| 199 | + alpha, | ||
| 192 | vec![ | 200 | vec![ |
| 193 | Uniform::new("colorspace", colorspace), | 201 | Uniform::new("colorspace", colorspace), |
| 194 | Uniform::new("hue_interpolation", hue_interpolation), | 202 | Uniform::new("hue_interpolation", hue_interpolation), |
src/render_helpers/shader_element.rsmodified+2 -0
| @@ -227,12 +227,14 @@ impl ShaderRenderElement { | |||
| 227 | size: Size<f64, Logical>, | 227 | size: Size<f64, Logical>, |
| 228 | opaque_regions: Option<Vec<Rectangle<f64, Logical>>>, | 228 | opaque_regions: Option<Vec<Rectangle<f64, Logical>>>, |
| 229 | scale: f32, | 229 | scale: f32, |
| 230 | + alpha: f32, | ||
| 230 | uniforms: Vec<Uniform<'static>>, | 231 | uniforms: Vec<Uniform<'static>>, |
| 231 | textures: HashMap<String, GlesTexture>, | 232 | textures: HashMap<String, GlesTexture>, |
| 232 | ) { | 233 | ) { |
| 233 | self.area.size = size; | 234 | self.area.size = size; |
| 234 | self.opaque_regions = opaque_regions.unwrap_or_default(); | 235 | self.opaque_regions = opaque_regions.unwrap_or_default(); |
| 235 | self.scale = scale; | 236 | self.scale = scale; |
| 237 | + self.alpha = alpha; | ||
| 236 | self.additional_uniforms = uniforms; | 238 | self.additional_uniforms = uniforms; |
| 237 | self.textures = textures; | 239 | self.textures = textures; |
| 238 | 240 | ||
src/render_helpers/shadow.rsmodified+8 -0
| @@ -28,6 +28,7 @@ struct Parameters { | |||
| 28 | corner_radius: CornerRadius, | 28 | corner_radius: CornerRadius, |
| 29 | // Should only be used for visual improvements, i.e. corner radius anti-aliasing. | 29 | // Should only be used for visual improvements, i.e. corner radius anti-aliasing. |
| 30 | scale: f32, | 30 | scale: f32, |
| 31 | + alpha: f32, | ||
| 31 | 32 | ||
| 32 | window_geometry: Rectangle<f64, Logical>, | 33 | window_geometry: Rectangle<f64, Logical>, |
| 33 | window_corner_radius: CornerRadius, | 34 | window_corner_radius: CornerRadius, |
| @@ -44,6 +45,7 @@ impl ShadowRenderElement { | |||
| 44 | scale: f32, | 45 | scale: f32, |
| 45 | window_geometry: Rectangle<f64, Logical>, | 46 | window_geometry: Rectangle<f64, Logical>, |
| 46 | window_corner_radius: CornerRadius, | 47 | window_corner_radius: CornerRadius, |
| 48 | + alpha: f32, | ||
| 47 | ) -> Self { | 49 | ) -> Self { |
| 48 | let inner = ShaderRenderElement::empty(ProgramType::Shadow, Kind::Unspecified); | 50 | let inner = ShaderRenderElement::empty(ProgramType::Shadow, Kind::Unspecified); |
| 49 | let mut rv = Self { | 51 | let mut rv = Self { |
| @@ -55,6 +57,7 @@ impl ShadowRenderElement { | |||
| 55 | sigma, | 57 | sigma, |
| 56 | corner_radius, | 58 | corner_radius, |
| 57 | scale, | 59 | scale, |
| 60 | + alpha, | ||
| 58 | window_geometry, | 61 | window_geometry, |
| 59 | window_corner_radius, | 62 | window_corner_radius, |
| 60 | }, | 63 | }, |
| @@ -74,6 +77,7 @@ impl ShadowRenderElement { | |||
| 74 | sigma: 0., | 77 | sigma: 0., |
| 75 | corner_radius: Default::default(), | 78 | corner_radius: Default::default(), |
| 76 | scale: 1., | 79 | scale: 1., |
| 80 | + alpha: 1., | ||
| 77 | window_geometry: Default::default(), | 81 | window_geometry: Default::default(), |
| 78 | window_corner_radius: Default::default(), | 82 | window_corner_radius: Default::default(), |
| 79 | }, | 83 | }, |
| @@ -95,12 +99,14 @@ impl ShadowRenderElement { | |||
| 95 | scale: f32, | 99 | scale: f32, |
| 96 | window_geometry: Rectangle<f64, Logical>, | 100 | window_geometry: Rectangle<f64, Logical>, |
| 97 | window_corner_radius: CornerRadius, | 101 | window_corner_radius: CornerRadius, |
| 102 | + alpha: f32, | ||
| 98 | ) { | 103 | ) { |
| 99 | let params = Parameters { | 104 | let params = Parameters { |
| 100 | size, | 105 | size, |
| 101 | geometry, | 106 | geometry, |
| 102 | color, | 107 | color, |
| 103 | sigma, | 108 | sigma, |
| 109 | + alpha, | ||
| 104 | corner_radius, | 110 | corner_radius, |
| 105 | scale, | 111 | scale, |
| 106 | window_geometry, | 112 | window_geometry, |
| @@ -120,6 +126,7 @@ impl ShadowRenderElement { | |||
| 120 | geometry, | 126 | geometry, |
| 121 | color, | 127 | color, |
| 122 | sigma, | 128 | sigma, |
| 129 | + alpha, | ||
| 123 | corner_radius, | 130 | corner_radius, |
| 124 | scale, | 131 | scale, |
| 125 | window_geometry, | 132 | window_geometry, |
| @@ -145,6 +152,7 @@ impl ShadowRenderElement { | |||
| 145 | size, | 152 | size, |
| 146 | None, | 153 | None, |
| 147 | scale, | 154 | scale, |
| 155 | + alpha, | ||
| 148 | vec![ | 156 | vec![ |
| 149 | Uniform::new("shadow_color", color.to_array_premul()), | 157 | Uniform::new("shadow_color", color.to_array_premul()), |
| 150 | Uniform::new("sigma", sigma), | 158 | Uniform::new("sigma", sigma), |
src/window/mapped.rsmodified+1 -0
| @@ -403,6 +403,7 @@ impl Mapped { | |||
| 403 | 0., | 403 | 0., |
| 404 | radius, | 404 | radius, |
| 405 | scale.x as f32, | 405 | scale.x as f32, |
| 406 | + 1., | ||
| 406 | ) | 407 | ) |
| 407 | .with_location(geo.loc) | 408 | .with_location(geo.loc) |
| 408 | .into(); | 409 | .into(); |