canvas-drawImage-transform-restored.html (815B)
1 <html> 2 <head> 3 <title>Test that drawImage() calls don't reset the canvas' transform</title> 4 <script type="text/javascript"> 5 function go() { 6 var canvas = document.getElementById("canvas"); 7 var ctx = canvas.getContext("2d"); 8 9 ctx.setTransform(2, 0, 0, 2, 0, 0); 10 11 // SVG image that draws nothing 12 ctx.drawImage(document.getElementById("image"), 0, 0); 13 14 // Check that ctx's transform wasn't reset by the drawImage call 15 ctx.fillStyle = "blue"; 16 ctx.fillRect(20, 20, 50, 50); 17 } 18 </script> 19 </head> 20 <body onload="go()"> 21 <canvas id="canvas" width="200" height="200"></canvas> 22 <img id="image" src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='1' height='1'></svg>" style="display: none"> 23 </body> 24 </html>