summaryrefslogtreecommitdiffstats
path: root/wgpu/src/renderer.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2019-11-14 06:48:32 +0100
committerLibravatar GitHub <noreply@github.com>2019-11-14 06:48:32 +0100
commitc8d4774704f970bb26eb5d9903b7a741b1c225e3 (patch)
tree1ceabb28d98c4f4cc9a556d2a5328ce8b7163130 /wgpu/src/renderer.rs
parentaf5ec4941270c832557994d9b4cc70ce5feac911 (diff)
parent2c8ba652a7929ac6c2af28ac60a8bd4b8e8e2f10 (diff)
downloadiced-c8d4774704f970bb26eb5d9903b7a741b1c225e3.tar.gz
iced-c8d4774704f970bb26eb5d9903b7a741b1c225e3.tar.bz2
iced-c8d4774704f970bb26eb5d9903b7a741b1c225e3.zip
Merge pull request #56 from hecrj/example/filter-todos
Draw checkmark icon and filter todos
Diffstat (limited to 'wgpu/src/renderer.rs')
-rw-r--r--wgpu/src/renderer.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/wgpu/src/renderer.rs b/wgpu/src/renderer.rs
index d3bdc878..52764248 100644
--- a/wgpu/src/renderer.rs
+++ b/wgpu/src/renderer.rs
@@ -344,11 +344,27 @@ impl Renderer {
for text in layer.text.iter() {
// Target physical coordinates directly to avoid blurry text
let text = wgpu_glyph::Section {
+ // TODO: We `round` here to avoid rerasterizing text when
+ // its position changes slightly. This can make text feel a
+ // bit "jumpy". We may be able to do better once we improve
+ // our text rendering/caching pipeline.
screen_position: (
(text.screen_position.0 * dpi).round(),
(text.screen_position.1 * dpi).round(),
),
- bounds: (text.bounds.0 * dpi, text.bounds.1 * dpi),
+ // TODO: Fix precision issues with some DPI factors.
+ //
+ // The `ceil` here can cause some words to render on the
+ // same line when they should not.
+ //
+ // Ideally, `wgpu_glyph` should be able to compute layout
+ // using logical positions, and then apply the proper
+ // DPI scaling. This would ensure that both measuring and
+ // rendering follow the same layout rules.
+ bounds: (
+ (text.bounds.0 * dpi).ceil(),
+ (text.bounds.1 * dpi).ceil(),
+ ),
scale: wgpu_glyph::Scale {
x: text.scale.x * dpi,
y: text.scale.y * dpi,