[whatwg] remove resetClip from the Canvas 2D spec

Justin Novosad junov at google.com
Mon Aug 12 14:26:08 PDT 2013

Ok, so here is a simple proposal:

enum CanvasSaveMode { "all", "transform", "clip", "transform-and-clip" };
save(optional CanvasSaveMode mode);

all: save the entire rendering context state
transform: save only the current transform
clip: save only the current clip

if mode is not specified, the entire context state is saved (for backward

The restore method's interface does not change. It restores whatever state
was saved by the matching save call.

On Mon, Aug 12, 2013 at 4:56 PM, Simon Sarris <simon.sarris at gmail.com>wrote:

> > Good point, I think part of the problem has to do with the fact that save
> > is non-selective (saves all of the state).
> Yes, since save() and restore() save and restore everything, it creates
> the side effect of needing to set ctx.font/fillStyle/strokeStyle more often
> than otherwise, which are slow to set, probably because of some CSS parser
> activity, but I'm not wise enough to know.
> If there was merely a way to save and restore the context, or perhaps some
> other subset of state, that would probably work nicely too.

More information about the whatwg mailing list