W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2013

Re: [whatwg] remove resetClip from the Canvas 2D spec

From: Simon Sarris <simon.sarris@gmail.com>
Date: Tue, 13 Aug 2013 11:38:07 -0400
Message-ID: <CAA5isUZ4pX3gzMvDfHXVqyOJvHVWdcyGzEBYURxNdgFrAHYgUQ@mail.gmail.com>
To: Stephen White <senorblanco@chromium.org>
Cc: Justin Novosad <junov@google.com>, WHATWG List <whatwg@whatwg.org>, Ian Hickson <ian@hixie.ch>, Rik Cabanier <cabanier@gmail.com>
> If this is strictly a performance issue, then we definitely should fix
that before adding new API, IMHO. It would be great to get some reduced
test cases where save()/restore() is a bottleneck.

I'd argue its not strictly a performance issue. More generally its awkward
that you can reset any piece of the canvas context state except the
clipping region. The clipping region alone requires you to clobber all
state in order to reset it.

You can set the fillStyle back to black, you can set the transformation
matrix back to identity, etc. But you can't set the clipping region back to
the entire canvas area without save()/restore() or can.width=can.width.
It's the only thing like that.

That ought to be considered bad on principle I think. It makes clipping a
really odd operation compared to anything else, and at the least it makes
the one part of the API unintuitive.
Received on Tuesday, 13 August 2013 15:38:33 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:23 UTC