Skip to content

Reduce use of save / restore? #518

Open
@gskinner

Description

@gskinner

We switched to a save / restore model for drawing the display list in order to facilitate certain advanced features (masks being the primary example), and simplify the draw model. This works great, but is a bit more expensive.

It may be possible to support two parallel streams for drawing: one using save / restore when a mask is set, and a faster one avoiding it if not. Considering the performance work we've done in this build, it may be a good time to test.

Immediate thoughts on implementation: add a restoreContext() (name TBD) method to DisplayObject in addition to the existing updateContext() method. Container would no longer use save/restore explicitly (it would live in the DO methods):

child.updateContext(ctx);
child.draw(ctx);
child.restoreContext(ctx);

Alternately, we could introduce a drawTransformed() method or similar on DisplayObject that merged all of the above.

Requires some testing to see if the performance benefit is at all significant.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions