[whatwg] Canvas resetClip() API
smfr at me.com
Tue Oct 8 16:53:43 PDT 2013
On Oct 7, 2013, at 8:55 PM, Rashmi Shyamasundar <rashmi.shyam at 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:
// … set up a path to clip to
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.
More information about the whatwg