mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
Remove Vec from Shadow::render()
This commit is contained in:
+3
-3
@@ -3994,12 +3994,12 @@ impl<W: LayoutElement> Layout<W> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn render_floating_for_output<R: NiriRenderer>(
|
||||
&self,
|
||||
pub fn render_floating_for_output<'a, R: NiriRenderer + 'a>(
|
||||
&'a self,
|
||||
renderer: &mut R,
|
||||
output: &Output,
|
||||
target: RenderTarget,
|
||||
) -> impl Iterator<Item = TileRenderElement<R>> {
|
||||
) -> impl Iterator<Item = TileRenderElement<R>> + 'a {
|
||||
if self.update_render_elements_time != self.clock.now() {
|
||||
error!("clock moved between updating render elements and rendering");
|
||||
}
|
||||
|
||||
+6
-13
@@ -157,26 +157,19 @@ impl Shadow {
|
||||
&self,
|
||||
renderer: &mut impl NiriRenderer,
|
||||
location: Point<f64, Logical>,
|
||||
) -> impl Iterator<Item = ShadowRenderElement> {
|
||||
let mut rv = Vec::new();
|
||||
|
||||
) -> impl Iterator<Item = ShadowRenderElement> + '_ {
|
||||
if !self.config.on {
|
||||
return rv.into_iter();
|
||||
return None.into_iter().flatten();
|
||||
}
|
||||
|
||||
let has_shadow_shader = ShadowRenderElement::has_shader(renderer);
|
||||
if !has_shadow_shader {
|
||||
return rv.into_iter();
|
||||
return None.into_iter().flatten();
|
||||
}
|
||||
|
||||
let mut push = |shader: &ShadowRenderElement, location: Point<f64, Logical>| {
|
||||
rv.push(shader.clone().with_location(location));
|
||||
};
|
||||
let rv = zip(&self.shaders, &self.shader_rects)
|
||||
.map(move |(shader, rect)| shader.clone().with_location(location + rect.loc));
|
||||
|
||||
for (shader, rect) in zip(&self.shaders, &self.shader_rects) {
|
||||
push(shader, location + rect.loc);
|
||||
}
|
||||
|
||||
rv.into_iter()
|
||||
Some(rv).into_iter().flatten()
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -710,14 +710,14 @@ impl<W: LayoutElement> Tile<W> {
|
||||
.unwrap_or_else(|| !self.window.has_ssd())
|
||||
}
|
||||
|
||||
fn render_inner<R: NiriRenderer>(
|
||||
&self,
|
||||
fn render_inner<'a, R: NiriRenderer + 'a>(
|
||||
&'a self,
|
||||
renderer: &mut R,
|
||||
location: Point<f64, Logical>,
|
||||
scale: Scale<f64>,
|
||||
focus_ring: bool,
|
||||
target: RenderTarget,
|
||||
) -> impl Iterator<Item = TileRenderElement<R>> {
|
||||
) -> impl Iterator<Item = TileRenderElement<R>> + 'a {
|
||||
let _span = tracy_client::span!("Tile::render_inner");
|
||||
|
||||
let alpha = if self.is_fullscreen {
|
||||
@@ -926,14 +926,14 @@ impl<W: LayoutElement> Tile<W> {
|
||||
rv.chain(self.shadow.render(renderer, location).map(Into::into))
|
||||
}
|
||||
|
||||
pub fn render<R: NiriRenderer>(
|
||||
&self,
|
||||
pub fn render<'a, R: NiriRenderer + 'a>(
|
||||
&'a self,
|
||||
renderer: &mut R,
|
||||
location: Point<f64, Logical>,
|
||||
scale: Scale<f64>,
|
||||
focus_ring: bool,
|
||||
target: RenderTarget,
|
||||
) -> impl Iterator<Item = TileRenderElement<R>> {
|
||||
) -> impl Iterator<Item = TileRenderElement<R>> + 'a {
|
||||
let _span = tracy_client::span!("Tile::render");
|
||||
|
||||
let mut open_anim_elem = None;
|
||||
|
||||
Reference in New Issue
Block a user