summaryrefslogtreecommitdiffstats
path: root/wgpu
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-07 06:51:42 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-07 06:51:42 +0100
commit5fd0c724b26c97e2df66c01b3924e31b141fa0f3 (patch)
tree1b77923138d02a162ae7dba0ead0f9310b42a6c1 /wgpu
parent8dc4bd5a1dc64b0a445a7451f622d5924dfeefa4 (diff)
downloadiced-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.rs4
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 {