Merge pull request #47 from hecrj/improvement/text-performance
Improve text rendering performance in some scenarios
This commit is contained in:
commit
e66d38403d
1 changed files with 3 additions and 2 deletions
|
|
@ -74,6 +74,7 @@ impl Renderer {
|
||||||
|
|
||||||
let glyph_brush =
|
let glyph_brush =
|
||||||
GlyphBrushBuilder::using_fonts_bytes(vec![default_font, mono_font])
|
GlyphBrushBuilder::using_fonts_bytes(vec![default_font, mono_font])
|
||||||
|
.initial_cache_size((2048, 2048))
|
||||||
.build(&mut device, TextureFormat::Bgra8UnormSrgb);
|
.build(&mut device, TextureFormat::Bgra8UnormSrgb);
|
||||||
|
|
||||||
let quad_pipeline = quad::Pipeline::new(&mut device);
|
let quad_pipeline = quad::Pipeline::new(&mut device);
|
||||||
|
|
@ -365,8 +366,8 @@ impl Renderer {
|
||||||
// Target physical coordinates directly to avoid blurry text
|
// Target physical coordinates directly to avoid blurry text
|
||||||
let text = Section {
|
let text = Section {
|
||||||
screen_position: (
|
screen_position: (
|
||||||
text.screen_position.0 * dpi,
|
(text.screen_position.0 * dpi).round(),
|
||||||
text.screen_position.1 * dpi,
|
(text.screen_position.1 * dpi).round(),
|
||||||
),
|
),
|
||||||
bounds: (text.bounds.0 * dpi, text.bounds.1 * dpi),
|
bounds: (text.bounds.0 * dpi, text.bounds.1 * dpi),
|
||||||
scale: wgpu_glyph::Scale {
|
scale: wgpu_glyph::Scale {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue