Open Bug 1610409 Opened 5 years ago Updated 2 years ago

Add support for luminance masking in PushLayer

Categories

(Core :: Graphics, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: jrmuizel, Unassigned)

References

(Blocks 2 open bugs)

Details

Today the process for applying an svg mask looks roughly like:

  • CreateClippedDrawTarget(mask_size, RGBA32);
  • Draw mask content
  • call IntoLuminanceSource() on mask DrawTarget
  • call PushLayer() with the result of IntoLuminanceSource()

If we instead add an API like PushLayerWithLuminance() we'll be convey the luminance conversion directly to Skia and have Skia do it in a single pass along with masking operation.

For the record here's what Chrome does.

  • beginLayer (content layer, srcOver mode)
    • draw content
    • beginLayer (mask layer, dstIn mode + luminance-to-alpha filter)
      • draw mask
    • endLayer: dstIn(luma(mask layer), content layer)
  • endLayer: srcOver(content layer, backdrop)

We draw things in a different order so it might look like something more like:

  • PushLayerWithLuminance();
    • SkCanvas::saveLayer();
  • draw content
  • PopLayer()
    • draw mask with dstIn into layer
    • SkCanvas::restore() to do final composite
Blocks: 1594768
Blocks: wr-perf
Priority: -- → P3
Blocks: blob-perf
No longer blocks: wr-perf
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.