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

Re: [whatwg] Canvas resetClip() API

From: Simon Fraser <smfr@me.com>
Date: Tue, 08 Oct 2013 16:53:43 -0700
Message-id: <0EE7ACF8-93BA-48C8-952B-B404C5CDF7F4@me.com>
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:

// Ö 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.

Received on Tuesday, 8 October 2013 23:54:14 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:11 UTC