mirror of
https://github.com/wez/wezterm.git
synced 2024-12-24 22:01:47 +03:00
gui: make a separate quad allocation pass for image cells
This should help to avoid artifacts in the case where glyphs render outside their nominal terminal cell (happens when the shaper tweaks positioning, and/or when ligatures are involved). Previously we'd render the layers in z-index order for cell N before the layers in z-index order for cell N+1. If N had an image that overlayed the text (nominally z-index 0.5!) and the glyph in N+1 (z-index 0) was slightly to the left of its border, then it could layer incorrectly over the cell to the left.
This commit is contained in:
parent
3ea13fb530
commit
aac4d36d6e
@ -783,6 +783,8 @@ impl super::TermWindow {
|
||||
|
||||
current_idx = 0;
|
||||
|
||||
let mut overlay_images = vec![];
|
||||
|
||||
for cluster in &cell_clusters {
|
||||
if !matches!(last_style.as_ref(), Some(ClusterStyleCache{attrs,..}) if *attrs == &cluster.attrs)
|
||||
{
|
||||
@ -1050,11 +1052,7 @@ impl super::TermWindow {
|
||||
}
|
||||
|
||||
if !did_custom {
|
||||
let texture = glyph
|
||||
.texture
|
||||
.as_ref()
|
||||
.unwrap_or(&gl_state.util_sprites.white_space);
|
||||
|
||||
if let Some(texture) = glyph.texture.as_ref() {
|
||||
let left = info.pos.x_offset.get() as f32 + info.pos.bearing_x;
|
||||
let slice = SpriteSlice {
|
||||
cell_idx: glyph_idx,
|
||||
@ -1105,18 +1103,11 @@ impl super::TermWindow {
|
||||
quad.set_has_color(glyph.has_color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for img in &images {
|
||||
for img in images {
|
||||
if img.z_index() >= 0 {
|
||||
self.populate_image_quad(
|
||||
&img,
|
||||
gl_state,
|
||||
quads,
|
||||
cell_idx,
|
||||
¶ms,
|
||||
hsv,
|
||||
glyph_color,
|
||||
)?;
|
||||
overlay_images.push((cell_idx, img, glyph_color));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1124,6 +1115,10 @@ impl super::TermWindow {
|
||||
}
|
||||
}
|
||||
|
||||
for (cell_idx, img, glyph_color) in overlay_images {
|
||||
self.populate_image_quad(&img, gl_state, quads, cell_idx, ¶ms, hsv, glyph_color)?;
|
||||
}
|
||||
|
||||
// If the clusters don't extend to the full physical width of the display,
|
||||
// we have a little bit more work to do to ensure that we correctly paint:
|
||||
// * Selection
|
||||
|
Loading…
Reference in New Issue
Block a user