aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/renderer/text
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2022-06-09 19:31:08 +0300
committerGitHub <noreply@github.com>2022-06-09 16:31:08 +0000
commit90552e3e7f8f085919a39435a8a68b3a2f633e54 (patch)
tree711534a54f813a8aad9fe2c3015478ba5ad03d31 /alacritty/src/renderer/text
parent6dc670cde0c136e28c71d4ebe67c5c8bb9df65b1 (diff)
downloadr-alacritty-90552e3e7f8f085919a39435a8a68b3a2f633e54.tar.gz
r-alacritty-90552e3e7f8f085919a39435a8a68b3a2f633e54.tar.bz2
r-alacritty-90552e3e7f8f085919a39435a8a68b3a2f633e54.zip
Fix flickering during resize on Wayland
This also fixes an issue of windows not being rendered while resizing. Fixes #6069.
Diffstat (limited to 'alacritty/src/renderer/text')
-rw-r--r--alacritty/src/renderer/text/gles2.rs2
-rw-r--r--alacritty/src/renderer/text/glyph_cache.rs15
2 files changed, 9 insertions, 8 deletions
diff --git a/alacritty/src/renderer/text/gles2.rs b/alacritty/src/renderer/text/gles2.rs
index 32aaa173..01470813 100644
--- a/alacritty/src/renderer/text/gles2.rs
+++ b/alacritty/src/renderer/text/gles2.rs
@@ -463,7 +463,7 @@ pub struct TextShaderProgram {
///
/// If GL_EXT_blend_func_extended is not available, the rendering is split into 4 passes.
/// One is used for the background and the rest to perform subpixel text rendering according to
- /// https://github.com/servo/webrender/blob/master/webrender/doc/text-rendering.md.
+ /// <https://github.com/servo/webrender/blob/master/webrender/doc/text-rendering.md>.
///
/// Rendering is split into three passes.
u_rendering_pass: GLint,
diff --git a/alacritty/src/renderer/text/glyph_cache.rs b/alacritty/src/renderer/text/glyph_cache.rs
index b57b10b7..72415900 100644
--- a/alacritty/src/renderer/text/glyph_cache.rs
+++ b/alacritty/src/renderer/text/glyph_cache.rs
@@ -264,19 +264,22 @@ impl GlyphCache {
loader.load_glyph(&glyph)
}
- /// Clear currently cached data in both GL and the registry.
- pub fn clear_glyph_cache<L: LoadGlyph>(&mut self, loader: &mut L) {
+ /// Reset currently cached data in both GL and the registry to default state.
+ pub fn reset_glyph_cache<L: LoadGlyph>(&mut self, loader: &mut L) {
loader.clear();
- self.cache = HashMap::default();
+ self.cache = Default::default();
self.load_common_glyphs(loader);
}
- pub fn update_font_size<L: LoadGlyph>(
+ /// Update the inner font size.
+ ///
+ /// NOTE: To reload the renderers's fonts [`Self::reset_glyph_cache`] should be called
+ /// afterwards.
+ pub fn update_font_size(
&mut self,
font: &Font,
scale_factor: f64,
- loader: &mut L,
) -> Result<(), crossfont::Error> {
// Update dpi scaling.
self.rasterizer.update_dpr(scale_factor as f32);
@@ -304,8 +307,6 @@ impl GlyphCache {
self.metrics = metrics;
self.builtin_box_drawing = font.builtin_box_drawing;
- self.clear_glyph_cache(loader);
-
Ok(())
}