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.
This commit is contained in:
Héctor Ramón Jiménez 2024-05-12 13:44:13 +02:00
parent 718fe5b7de
commit 74a4ba65d6
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -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);