[whatwg] <canvas> drawing with singular transforms and zero-sized gradients

Consider this testcase:
http://people.mozilla.org/~roc/SingularCanvasMatrix.html
It sets up a rectangle to fill, then sets the current matrix to a singular
matrix (yy=0 in this case), then fills with different fillStyles. It's not
clear from the spec how this is supposed to behave, and there's not much
interop:
-- Firefox trunk and Chrome dev refuse to draw anything in all cases
(Firefox then refuses to ever draw to the canvas again, but let's agree
that's just a bug)
-- IE draws everything as if the current transform was the identity, which
is weird.
-- Opera (11.11) draws the solid color and the horizontal gradient normally
--- which makes sense; draws the vertical gradient as solid yellow, which
seems semi-reasonable but arbitrary; draws the radial gradient as solid
black, which seems semi-reasonably but differently arbitrary; and draws the
image as a band of yellow strips (perhaps the first row of pixels of the
image repeated vertically?), which seems odd.

For CanvasPatterns, I can't see any reasonable way to define any rendering,
so I suggest they should just paint nothing when the current transform is
singular. This needs a spec update I think.

For linear CanvasGradients, I think we can follow the spec and simply
transform the gradient points. That would mean drawing the horizontal
gradient normally and drawing nothing for the vertical gradient. This
wouldn't need a spec change.

I'm not sure what to do about radial CanvasGradients. We can transform the
center points but the effect on the radii can't be described by simply
transforming points. Perhaps the most logical approach would be to fill with
the "outside" color (black in my testcase). This needs a spec update.

For solid colors I think it's logical to just fill with the color. This
wouldn't need a spec change.

Rob
-- 
"If we claim to be without sin, we deceive ourselves and the truth is not in
us. If we confess our sins, he is faithful and just and will forgive us our
sins and purify us from all unrighteousness. If we claim we have not sinned,
we make him out to be a liar and his word is not in us." [1 John 1:8-10]

Received on Thursday, 23 June 2011 22:09:44 UTC