-
Notifications
You must be signed in to change notification settings - Fork 29.2k
Description
Sometimes the DisplayList is asked to record operations that can be demonstrated will have no effect. Much of the time this property can be easily determined up front while recording the DL, such as:
- The bounds of the primitive are empty
- The alpha of the color is zero
- The clip is empty
None of these conditions are tested which means we produce DisplayList objects that have extra Operation records that will perform no work.
This situation is important enough that some parts of the Flutter engine work around the problem by reading back the list of operations to see if any of them actually impact the destination surface. See:
- https://github.com/flutter/engine/blob/8b3966c1f47ecf5190a614b83a26e7bdf558e7b7/shell/common/canvas_spy.h#L58
- https://github.com/flutter/engine/blob/8b3966c1f47ecf5190a614b83a26e7bdf558e7b7/shell/common/dl_op_spy.h#L36
These classes could be eliminated if the DL performed the same tests as it was constructing the list of operations and could then return either or both of an empty bounds or a zero count of operations.
See: #125318 and flutter/engine#40578 for examples of where this deficiency had to be worked around.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status