Skip to content

Round positions to pixel grid when rendering

Arjen Hiemstra requested to merge work/ahiemstra/fractionalrounding into master

When using a fractional scale, we may end up with logical coordinates that do not map to an actual pixel coordinate but instead something like "10.5". This causes interpolation when rendering, leading to "blurry" results. To avoid this, round vertex and window positions to the nearest integer just before sending things off to be rendered.

Additionally, this currently implements the most simple of approaches to rounding. There's some discussion happening in upstream Wayland ( https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/143 ) regarding a more elaborate rounding method that works correctly when lots of subsurfaces are involved. For "simple" windows the current approach suffices however.

This also doesn't fully fix all fractional scaling problems as we are still rendering a scaled buffer rather than getting a buffer of the proper size from the application, for that to be resolved the above protocol and related KWin/Qt MRs need to be merged.

This depends on !2739 (merged) (and was the main reason for doing that MR).

Draft because Vlad had some concerns whether clipping works correctly with this.

Edited by Arjen Hiemstra

Merge request reports