[whatwg] inconsistent canvas implementations of destination-in compositing
David Karger
karger at mit.edu
Thu Dec 22 10:35:29 PST 2011
Firefox and chrome inconsistently handle "destination-in" compositing; I
suspect this may be due to a missing specification in the standard. The
inconsistency happens when I use the drawImage method to draw one canvas
onto another while the globalCompositionOperation is set to
"destination-in" . Under destination in, pixels in the destination
canvas should be left alone where the source canvas has a set pixel and
cleared where the source canvas has a cleared/transparent pixel.
Both browsers do this properly inside the range of the source canvas.
But if the source canvas has smaller dimensions than the destination
canvas, they inconsistently handle parts of the destination canvas
_outside_ the source canvas: firefox clears those pixels while chrome
leaves them alone. I believe the standard isn't clear on what should
happen in this case. I'd say that firefox's behavior is more
consistent with the intent of "destination-in", but obviously
cross-platform consistency is the most important consideration.
I enclose a small html document demonstrating the inconsistency. Just
open it in firefox and chrome.
More information about the whatwg
mailing list