From 5fd0c724b26c97e2df66c01b3924e31b141fa0f3 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 7 Nov 2019 06:51:42 +0100 Subject: Align text position to pixel grid in `iced_wgpu` This avoids re-rasterizing glyphs and cache reuploads when the HiDPI factor is nonintegral. --- wgpu/src/renderer.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'wgpu/src/renderer.rs') diff --git a/wgpu/src/renderer.rs b/wgpu/src/renderer.rs index c8e1e10d..a7628bf4 100644 --- a/wgpu/src/renderer.rs +++ b/wgpu/src/renderer.rs @@ -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 { -- cgit