diff options
author | 2019-11-07 06:51:42 +0100 | |
---|---|---|
committer | 2019-11-07 06:51:42 +0100 | |
commit | 5fd0c724b26c97e2df66c01b3924e31b141fa0f3 (patch) | |
tree | 1b77923138d02a162ae7dba0ead0f9310b42a6c1 /wgpu | |
parent | 8dc4bd5a1dc64b0a445a7451f622d5924dfeefa4 (diff) | |
download | iced-5fd0c724b26c97e2df66c01b3924e31b141fa0f3.tar.gz iced-5fd0c724b26c97e2df66c01b3924e31b141fa0f3.tar.bz2 iced-5fd0c724b26c97e2df66c01b3924e31b141fa0f3.zip |
Align text position to pixel grid in `iced_wgpu`
This avoids re-rasterizing glyphs and cache reuploads when the HiDPI factor is
nonintegral.
Diffstat (limited to 'wgpu')
-rw-r--r-- | wgpu/src/renderer.rs | 4 |
1 files changed, 2 insertions, 2 deletions
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 { |