1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 23:21:08 +03:00

render: remove redundant extra quad buffer

I can't think of a good reason for this being here.  I think I
may have been lazy about resolving the lifetime annotations
and just stuck in an extra buffer while building the original
version of this logic, and then forgot about it.

This commit resolves the lifetime annotations and directly
references the passed in buffer.

refs: https://github.com/wez/wezterm/issues/2626
This commit is contained in:
Wez Furlong 2022-10-22 19:51:52 -07:00
parent 35ce2fe74d
commit 4f05e2e1f1

View File

@ -1624,7 +1624,7 @@ impl super::TermWindow {
pos.pane
.apply_hyperlinks(stable_range.clone(), &self.config.hyperlink_rules);
struct LineRender<'a> {
struct LineRender<'a, 'b> {
term_window: &'a mut super::TermWindow,
selrange: Option<SelectionRange>,
rectangular: bool,
@ -1646,7 +1646,7 @@ impl super::TermWindow {
white_space: TextureRect,
filled_box: TextureRect,
window_is_transparent: bool,
layers: HeapQuadAllocator,
layers: &'a mut TripleLayerQuadAllocator<'b>,
error: Option<anyhow::Error>,
}
@ -1676,11 +1676,11 @@ impl super::TermWindow {
white_space,
filled_box,
window_is_transparent,
layers: HeapQuadAllocator::default(),
layers,
error: None,
};
impl<'a> LineRender<'a> {
impl<'a, 'b> LineRender<'a, 'b> {
fn render_line(
&mut self,
stable_top: StableRowIndex,
@ -1763,9 +1763,7 @@ impl super::TermWindow {
false
};
if !expired && !hover_changed {
cached_quad
.layers
.apply_to(&mut TripleLayerQuadAllocator::Heap(&mut self.layers))?;
cached_quad.layers.apply_to(self.layers)?;
self.term_window.update_next_frame_time(cached_quad.expires);
return Ok(());
}
@ -1832,7 +1830,7 @@ impl super::TermWindow {
let expires = self.term_window.has_animation.borrow().as_ref().cloned();
self.term_window.update_next_frame_time(next_due);
buf.apply_to(&mut TripleLayerQuadAllocator::Heap(&mut self.layers))?;
buf.apply_to(self.layers)?;
let quad_value = LineQuadCacheValue {
layers: buf,
@ -1855,7 +1853,7 @@ impl super::TermWindow {
}
}
impl<'a> WithPaneLines for LineRender<'a> {
impl<'a, 'b> WithPaneLines for LineRender<'a, 'b> {
fn with_lines_mut(&mut self, stable_top: StableRowIndex, lines: &mut [&mut Line]) {
for (line_idx, line) in lines.iter().enumerate() {
if let Err(err) = self.render_line(stable_top, line_idx, line) {
@ -1870,7 +1868,6 @@ impl super::TermWindow {
if let Some(error) = render.error.take() {
return Err(error);
}
render.layers.apply_to(layers)?;
}
/*
@ -1881,11 +1878,6 @@ impl super::TermWindow {
metrics::histogram!("paint_pane_opengl.lines", start.elapsed());
log::trace!("lines elapsed {:?}", start.elapsed());
let start = Instant::now();
drop(layers);
metrics::histogram!("paint_pane_opengl.drop.quads", start.elapsed());
log::trace!("quad drop elapsed {:?}", start.elapsed());
Ok(())
}