Skip to content

Opacity widget always assumes compositing #102179

@flar

Description

@flar

Most widgets that modify the rendering of their children, or rather the RenderObject associated with those widgets, have code that detects if the children need compositing. If the children need compositing then they inject themselves into the tree as a layer. If the children do not need compositing then they simply issue rendering commands (usually along with a save() or saveLayer()) to set the rendering modification into the current picture/display list.

See the way that the pushTransform method tests compositing and changes the way it applies itself to rendering the tree:

TransformLayer? pushTransform(bool needsCompositing, Offset offset, Matrix4 transform, PaintingContextCallback painter, { TransformLayer? oldLayer }) {

OpacityLayer does not have the same tests and always adds a layer, it could simply emit a saveLayer with a Paint object that has the opacity in it if the children don't need compositing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: performanceRelates to speed or footprint issues (see "perf:" labels)frameworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions