Decorations may not line up properly with fractional scale

When an output uses a fractional scaling factor, rounding may cause some decoration pieces to not line up properly. This is because the decorations are not rendered to a single texture (and then scaled); instead they are rendered piecemeal using a texture for each of the image parts from the theme. Some themes will never show this problem if their images' pixel dimensions will always evenly divide by the scale factor.

To fix this properly, here are some options:

Pre-compute the physical pixel grid

Up front, we calculate the physical coordinates of all the decoration pieces' boundaries and ensure they all line up. Then convert those back into logical coordinates, in the same manner that Smithay does; these coordinates may not actually cause everything to line up, but the idea is that, once Smithay converts them back into physical coordinates, they'll line up properly on the monitor's actual physical pixels.

TextureRenderElement` takes its sizing information using integers, so we'd have to round there anyway, and that might re-introduce the original problem, so this might not work.

The tiling shader and source rect computations would have to be changed.

Single-buffer rendering

Instead of rendering all the various textures to the screen piecemeal, instead we could make a big offscreen buffer the size of the window + decorations, and render the decorations around the edges of this buffer. The areas where there aren't any decorations will be transparent so the client window area can be seen.

This method would mean that there won't be any issues rounding the locations of the different pieces at render time because there won't be any different pieces; it will all be a single piece.

The big downside here is that we'd need a ARGB8888 buffer per window, sized for the full window contents plus the decorations. This will waste a lot of RAM since most of the buffer will be transparent pixels, and the current rendering method only requires very small texture pieces that are the size of the source images (not even the full size of the decorations, since the source images are tiled at render-time directly into the final composited image).

Additionally, whenever the decorations change (due to a resize, title change, background or button state change, etc.), the entire buffer will need to be redrawn.

Conclusion

Frankly I'm not sure it's worth trying to fix this, as there are significant downsides to doing so. The compositor can even perhaps suggest a "better" fractional scale, based on the theme's image sizes, that won't result in rendering errors.

But we'll see.