mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
7cb499d1d9
This adds the new infrastructure for rendering masked primitives and uses it for simple rectangle primitives. Follow up patches will port other primitives to it (and transformed rectangles). Instead of rendering an alpha mask and then applying that during picture cache rendering of content, the underlying content is drawn to an off-screen surface, and the mask is applied on top of that via multiplicative blending. This is particularly helpful for applying masks to dynamically rendered pictures in future, as we can apply the mask over the already rendered picture without allocating an extra surface. Since the content and mask is rendered together to a surface, we can take advantage of this in future by caching the result in the texture cache, rather than a temporary render target. This means we don't need to redraw clip masks for this content each time the surrounding area is invalidated. Since the clip-mask is rendered in to the off-screen surface, it is cheaper and simpler to composite the content in to the main scene, avoiding an extra texture fetch and some tricky fragment shader logic to sample the correct part of the mask. To reduce the number of off-screen pixels that get drawn, the system supports splitting the content up in to a series of segments. This can either be a 9-patch, for the simple and common case of a single rounded clip, or a tile grid across the primitive. The tile grid can make it much faster to apply large image masks, where there are often large areas that we can determine are not affected by the mask image. Differential Revision: https://phabricator.services.mozilla.com/D173095 |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |