Implement physical pixel rounding of Wayland surfaces for compliance with fractional-scale-v1
Implement toplevel surface rounding as required by fractional-scale-v1
. Properly rounded toplevel surfaces is the minimum requirement for pixel-perfect rendering with the fractional scaling protocol.
Additionally, implement the "stable rounding" mechanism for Wayland subsurface positions and sizes as described in Appendix A.
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/143#note_1343171)
Appendix A: The Stable Rounding Algorithm for Subsurfaces (from- Parent position independent subsurface position rounding: Scale and round subsurface positions and add the scaled and rounded parent position afterwards (
pos = round(subsurface_pos * scale) + round(parent_pos * scale)
, making subsurface position rounding independent of the position of its parent. - Subsurface position dependent subsurface dimension rounding: Scale and round subsurface dimensions after adding the position, then substracting the position in both compositor and client (
size = round((subsurface_size + subsurface_pos) * scale) - round(subsurface_pos * scale)
.