1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 22:01:47 +03:00

Avoid flickery erase in render_line

This also improves perf.  The issue was that the erase of the whole
line of the background may be observed by the X server when SHM is
enabled because we don't wait for the exposure/copy to the window
pixmap before updating the same row fractionally later.

Avoiding the unconditional erase and just painting the full cell
contents over means that there's no opportunity for a visible flash.

In addition, since we render the cells background individually, that
erase was not needed.

This should save us some work and take some load off the cpu.
This commit is contained in:
Wez Furlong 2018-02-11 08:59:56 -08:00
parent 9feb3bd0e7
commit 52ba033ea7

View File

@ -652,15 +652,6 @@ impl<'a> TerminalWindow<'a> {
&term::color::ColorAttribute::Background,
);
// Clear this dirty row
self.buffer_image.borrow_mut().clear_rect(
0,
y,
self.width as usize,
self.cell_height,
background_color.into(),
);
// Break the line into clusters of cells with the same attributes
let cell_clusters = line.cluster();
for cluster in cell_clusters {
@ -791,6 +782,15 @@ impl<'a> TerminalWindow<'a> {
}
}
// Clear anything remaining to the right of the line
self.buffer_image.borrow_mut().clear_rect(
x,
y,
self.width as usize - x as usize,
self.cell_height,
background_color.into(),
);
// If we have SHM available, we can send up just this changed line
match &*self.buffer_image.borrow() {
&BufferImage::Shared(ref shm) => {