Skip to content

wlr_scene: Fix buffer transforms.

wlr_scene: Fix buffer transforms.

The order of operations needed to perform a transform between buffer
local coordinates and surface local are as follows:
1. apply source box translation
2. transform box based on source box size
3. scale to fit destination size

For step 3 we need to do something extra: In order to scale we need to
know two things: the source box and the destination size. We cannot simply
use the source box from step 1, since that box doesn't have the buffer
transform applied. Instead, conditionally flip the width/height division
calculations based on the buffer transform to correct this.

Admittedly, this is the first time I've sat down and actually studied this code for correctness. I believe I have a good understanding of this instead of just hoping things would work like how the previous logic was fabricated.

/cc @vyivel

Edited by Alexander Orzechowski

Merge request reports