Align text position to pixel grid in iced_wgpu

This avoids re-rasterizing glyphs and cache reuploads when the HiDPI factor is
nonintegral.
This commit is contained in:
Héctor Ramón Jiménez 2019-11-07 06:51:42 +01:00
parent 8dc4bd5a1d
commit 5fd0c724b2

View file

@ -365,8 +365,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 {