Skip to content

Instantly share code, notes, and snippets.

@tkihira
Created April 3, 2012 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkihira/2292457 to your computer and use it in GitHub Desktop.
Save tkihira/2292457 to your computer and use it in GitHub Desktop.
Chrome's bug code
var canvas = document.createElement("canvas");
canvas.width = canvas.height = 300;
document.body.appendChild(canvas);
var ctx = canvas.getContext("2d");
var m = document.createElement("canvas");
m.width = m.height = 100;
var mctx = m.getContext("2d");
mctx.fillStyle = "#f00";
mctx.fillRect(0, 0, 100, 100);
ctx.transform(1, 0, 0, 1, 1, 0); // problem!
ctx.fillStyle = ctx.createPattern(m, "");
ctx.fillRect(100, 100, 100, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment