From 90552e3e7f8f085919a39435a8a68b3a2f633e54 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Thu, 9 Jun 2022 19:31:08 +0300 Subject: Fix flickering during resize on Wayland This also fixes an issue of windows not being rendered while resizing. Fixes #6069. --- alacritty/src/renderer/text/gles2.rs | 2 +- alacritty/src/renderer/text/glyph_cache.rs | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'alacritty/src/renderer/text') 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. + /// . /// /// 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(&mut self, loader: &mut L) { + /// Reset currently cached data in both GL and the registry to default state. + pub fn reset_glyph_cache(&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( + /// 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(()) } -- cgit