For https://github.com/flutter/flutter/pull/158881
The new Android m3 page transition animates a saveLayer w/ opacity + slide in animation. See example video from linked PR:
https://github.com/user-attachments/assets/1382374a-4e0c-4a0e-9d70-948ce12e6298
On each frame, we intersect the coverage rect of this saveLayer contents with the screen rect, and shrink it to a partial rectangle. But this changes each frame, which forces us to re-allocate a large texture each frame, causing performance issues.
Why not ignore the cull rect entirely? We sometimes ignore the cull rect for the image filter layer for similar reasons, but from observation, the sizes of these saveLayer can be slightly larger than the screen for flutter gallery. Instead, I attempted to use the cull rect size to shrink the saveLayer by shifting the origin before intersecting.
I think this should be safe to do, as I believe it could only leave the coverage as larger than it would have been and not smaller.