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

Re: [whatwg] [Canvas] Behavior on non-invertable CTM

From: Ian Hickson <ian@hixie.ch>
Date: Thu, 18 Jul 2013 17:49:14 +0000 (UTC)
To: Dirk Schulze <dschulze@adobe.com>
Message-ID: <alpine.DEB.2.00.1307181744000.9685@ps20323.dreamhostps.com>
Cc: WHATWG List <whatwg@whatwg.org>
On Tue, 29 Jan 2013, Dirk Schulze wrote:
> The spec doesn't have any wording about the behavior on non-invertible 
> CTMs on Canvas contexts. Is it still possible to add segments to the 
> current path once a CTM is not invertible anymore? Does the path get 
> rejected completely then? Implementations are fairly different.
> Here are two examples (code attached at the end of the mail as well):
> http://jsfiddle.net/Dghuh/1/
> http://jsfiddle.net/Dghuh/2/
> Note that the path is stroked after restoring the initial CTM in both 
> examples.
> The first one does scale(0), which should make the CTM non-invertibe, 
> WebKit still applies lineTo and closePath for some reason. IE and FF 
> refuse to draw anything.

scale(0) is invalid, and should throw an exception.

If you do scale(0,0), the browsers act the same as with your second test 
that uses setTransform() with 6 zeros.

> The second does setTransform(0,0,0,0,0,0), which should reset the CTM to 
> a zero matrix (again, not invertible). IE, Opera and FF draw a line to 
> 0,0 and close the path afterwards (which kind of makes sense, since the 
> universe is convoluted to one point). WebKit refuses the lineTo command 
> and closes the path as expected.

WebKit seems to just be wrong here, and the others right.

> This is an edge case, but should still be clarified in the spec.

I don't understand what there is to clarify. In both cases, the behaviour 
seems well-defined: if you're transforming everything to zero, that's what 
the result will be. Zero. Firefox's behaviour is the right one.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 18 July 2013 17:49:38 UTC

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