Open Bug 1756662 Opened 3 years ago Updated 11 months ago

Fast path axis-aligned rectangular SVG clip on a single element

Categories

(Core :: Graphics: WebRender, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: nical, Assigned: nical)

References

(Blocks 2 open bugs)

Details

Google slides has content of the form:

<clipPath id="foo" d="<actually a rectangle>">
<g clip-path= "url(#foo>)">
  <image> ... </image>
</g>

We want to avoid using blob images for this, and prefrably we want a solution in the short term.

If we make the image active we still end up rasterizing and uploading a large mask for the clip which we would like to avoid.

In principle it should not be too hard to render if we detect that the clip path is a rectangle. We have code to detect that that isn't used for this case yet. However the work to piece things together isn't trivial. Once we know the clip to be an axis-aligned rectangle we could either:

  • decide that antialiasing the clip isn't important and turn the clip into a webrender clip rect.
  • If we don't want to break the anti-aliasing: avoiding blob images could be don by detecting when the clip applies to a single paintable item that can be made active, and make sure the clip can be applied as a local clip rect on the primitive. I am a bit worried about adding overhead in the general case to detect this and end up only benefiting from the fast path on google slides.
  • Implement anti-aliased axis-alied clip rects in WebRender, handling both single and multiple items (A better long term solution but probably more work).
Blocks: wr-todos
You need to log in before you can comment on or make changes to this bug.