From 74a4ba65d6fea0c68dfbf721230c4abf36505e61 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 12 May 2024 13:44:13 +0200 Subject: Align images to the pixel grid in `iced_wgpu` This should fix some graphical glitches, at the expense of potential alignment issues with small icons / images. --- wgpu/src/shader/image.wgsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wgpu') diff --git a/wgpu/src/shader/image.wgsl b/wgpu/src/shader/image.wgsl index accefc17..0eeb100f 100644 --- a/wgpu/src/shader/image.wgsl +++ b/wgpu/src/shader/image.wgsl @@ -38,7 +38,7 @@ fn vs_main(input: VertexInput) -> VertexOutput { out.opacity = input.opacity; // Calculate the vertex position and move the center to the origin - v_pos = input.pos + v_pos * input.scale - input.center; + v_pos = round(input.pos) + v_pos * input.scale - input.center; // Apply the rotation around the center of the image let cos_rot = cos(input.rotation); -- cgit