Bug 1667707 - Optimize clip image mask rendering for axis-aligned masks. r=jrmuizel
Bug 1667707 - Optimize clip image mask rendering for axis-aligned masks. r=jrmuizel

There is some complexity in rendering clip masks that contain tiled
images, when the transform is complex (getting edge AA correct etc).
To work around this, the existing implementation simply draws the
entire primitive region with each image tile of the clip mask. This
works but is slow on large clip masks.

We can apply a simple optimization when the clip is axis-aligned,
which is the common case for the vast majority of pages. When this
case occurs, calculate a device space sub-rect for each of the
image mask tiles, and only draw to that part of the clip mask.

This can drastically reduce the amount of overdraw on pages that
have tiled clip masks that take up a large portion of the screen.
In the long term, WR should handle the case of complex transform
+ tiled clip masks better too.

Differential Revision: https://phabricator.services.mozilla.com/D91540

[ghsync] From https://hg.mozilla.org/mozilla-central/rev/dc423cb83ba60d47c05c046598169fae9b386c08

servo/webrender,servo/webrender,servo/webrender,servo/webrender,servo/webrender,servo/webrender