swaywm / swaylock

Screen locker for Wayland
MIT License
853 stars 202 forks source link

Fix loss of clarity with odd-sized centered image #253

Closed jlindgren90 closed 2 years ago

jlindgren90 commented 2 years ago

When using scaling=center, an image with an odd width or height is currently shifted by 0.5 pixel relative to display pixels, resulting in a loss of detail when rendered. This is particular noticeable with an image containing text, which becomes noticeably blurry.

It's true that the current code is "accurate" in that it exactly centers the image on the display, but I think most users would probably prefer to live with the image being off-center by 0.5 pixel in return for pixel-perfect rendering.

emersion commented 2 years ago

Yup, indeed. Can we round() instead of truncate?

jlindgren90 commented 2 years ago

round() works too; I wasn't sure if there would be concerns about the -lm dependency.