On Wed, Jul 28, 2010 at 2:46 PM, Tab Atkins Jr. <span dir="ltr"><<a href="mailto:jackalmage@gmail.com">jackalmage@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Wed, Jul 28, 2010 at 2:43 PM, David Flanagan <<a href="mailto:david@davidflanagan.com">david@davidflanagan.com</a>> wrote:<br>
> Firefox and Chrome disagree about the implementation of the<br>
> destination-atop, source-in, destination-in, and source-out compositing<br>
> operators. Test code is attached.<br></div></div></blockquote><div><br></div><div>I don't think your attachment made it through. <a href="https://developer.mozilla.org/samples/canvas-tutorial/6_1_canvas_composite.html">https://developer.mozilla.org/samples/canvas-tutorial/6_1_canvas_composite.html</a> shows some of the differences, although it does not cover all cases.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div class="h5">
><br>
> Chrome doesn't touch any destination pixels that are not underneath the<br>
> source pixels. Firefox, on the other hand, treats the entire canvas (inside<br>
> the clipping region) as the destination and if you use the destination-in<br>
> operator, for example, will erase any pixels outside of whatever you are<br>
> drawing.<br>
><br>
> I suspect, based on the reference to an "infinite transparent black bitmap"<br>
> in 4.8.11.1.13 Drawing model that Firefox gets this right and Chrome gets it<br>
> wrong, but it would be nice to have that confirmed.<br>
><br>
> I suggest clarifying 4.8.11.1.3 Compositing to mention that the compositing<br>
> operation takes place on all pixels within the clipping region, and that<br>
> some compositing operators clear large portions of the canvas.<br>
<br>
</div></div>The spec is completely clear on this matter - Firefox is right,<br>
Chrome/Safari are wrong. They do it wrongly because that's how<br>
CoreGraphics, their graphics library, does things natively.<br></blockquote><div><br></div><div>The spec is certainly clear but that does not make the behavior it specifies good. I find the spec's behavior pretty bizarre and Microsoft has expressed a preference for the Safari/Chrome interpretation: <a href="http://lists.w3.org/Archives/Public/public-canvas-api/2010AprJun/0046.html">http://lists.w3.org/Archives/Public/public-canvas-api/2010AprJun/0046.html</a> - although that thread did not get much discussion. For example, I think drawing a 20x20 image into a 500x500 canvas without scaling with a globalCompositeOperation of 'copy' should result in only the 20x20 region being cleared out, not the entire canvas.</div>
<div><br></div><div>In informal discussions I got the impression that most folks would be happy to standardize on something closer to the Safari/Chrome model if it could be specified exactly. In particular, there has to be a precise definition of what region the compositing operation should apply in.</div>
<div><br></div><div>- James</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<font color="#888888"><br>
~TJ<br>
</font></blockquote></div><br>