- From: Simon Fraser <smfr@me.com>
- Date: Tue, 08 Oct 2013 16:53:43 -0700
- To: Rashmi Shyamasundar <rashmi.shyam@gmail.com>
- Cc: "whatwg@lists.whatwg.org Group" <whatwg@lists.whatwg.org>
On Oct 7, 2013, at 8:55 PM, Rashmi Shyamasundar <rashmi.shyam@gmail.com> wrote: > Hi All, > > This is regarding the resetClip() API for canvas. Please take a look at my > patches to the bug https://bugs.webkit.org/show_bug.cgi?id=82801. > resetClip() can be implemented in Cairo, without any overhead, since Cairo > supports resetClip. > > I tried to implement the API in CG, using the below approach :- (Please > check https://bugs.webkit.org/show_bug.cgi?id=82801#c9 ) I don’t like the resetClip() API, and don’t think it should be added to canvas. The reason resetClip() is a bad API is that it breaks the ability to robustly modularize drawing code. For example, say that you have the following code: context.save(); // … set up a path to clip to context.clip(); someJSLibrary.drawSomething(); context.restore(); In the absence of resetClip(), you are guaranteed that someJSLibrary.drawSomething() can’t draw outside of the clip you specified. With resetClip(), that JS library can draw wherever the heck it wants, which may totally break your canvas drawing. If you really need resetClip() in your own drawing code, you’re probably doing it wrong. Simon
Received on Tuesday, 8 October 2013 23:54:14 UTC