Skip to content

Migrate EmbedderExternalView to use DisplayListEmbedderViewSlice #123349

@cyanglaz

Description

@cyanglaz

DisplayListEmbedderViewSlice contains the RTree, which is used to determine if a embedded platform view is obstructed by any Flutter rendered pixels.

The generic embedder does not currently fully support unobstructed PlatformView, it has a HasEngineRenderedContents check to determine whether an overlay surface is necessary. The check is binary, if there are any non-transparent pixels drawn on the canvas, it will create a surface.

For the generic embedder to support unobstructed platform views, the DisplayListEmbedderViewSlice is necessary to replace the SkPictureRecorder in EmbedderExternalView.

The challenge of upgrading to DisplayListEmbedderViewSlice is that DisplayList does not support NWayCanvas, thus an identical support of CanvasSpy is not trivial. Creating an SkPicture version of EmbedderViewSlice is possible, but it will pull the engine back from fully migrating to impeller.

DisplayList does have a bounds() method that checks if there are content drawn on the surface. It is very similar to CanvasSpy with one difference. CanvasSpy takes transparent surface as "no content", while DisplayList::bounds() would consider a transparent surface as valid. For example, if the app draws a completely transparent surface, canvas_spy_->DidDrawIntoCanvas() would return false while !DisplayList::bounds().isEmpty() would return true. It theoretically causes a regression, but do we really need to cover this use case?

If we want to cover this use case, one solution seems to be implement a DLOpReceiver, the receiver would ideally listen to all the draw command and decide whether the canvas is empty.

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work liste: embedderUsers of the Embedder APIengineflutter/engine related. See also e: labels.

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions