Merge pull request #47 from hecrj/improvement/text-performance

Improve text rendering performance in some scenarios
This commit is contained in:
Héctor Ramón 2019-11-08 22:40:16 +01:00 committed by GitHub
commit e66d38403d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -74,6 +74,7 @@ impl Renderer {
let glyph_brush =
GlyphBrushBuilder::using_fonts_bytes(vec![default_font, mono_font])
.initial_cache_size((2048, 2048))
.build(&mut device, TextureFormat::Bgra8UnormSrgb);
let quad_pipeline = quad::Pipeline::new(&mut device);
@ -365,8 +366,8 @@ impl Renderer {
// Target physical coordinates directly to avoid blurry text
let text = Section {
screen_position: (
text.screen_position.0 * dpi,
text.screen_position.1 * dpi,
(text.screen_position.0 * dpi).round(),
(text.screen_position.1 * dpi).round(),
),
bounds: (text.bounds.0 * dpi, text.bounds.1 * dpi),
scale: wgpu_glyph::Scale {