https://github.com/web-platform-tests/wpt
Raw File
Tip revision: bd350d7475c9eaf667a254ee7f49f25a06146b52 authored by Mike Pennisi on 10 December 2018, 20:43:57 UTC
Explicitly fetch test manifest
Tip revision: bd350d7
drawimage_canvas_self.html
<link rel="match" href="drawimage_canvas_self_ref.html">
<canvas id="dest" height="100" width="100"></canvas>
<script>
var canvasWidth = canvasHeight = 100;
var destWidth = canvasWidth / 4;
var destHeight = canvasHeight / 4;
var destCanvas = document.getElementById('dest');
var destCtx = destCanvas.getContext('2d');

destCtx.fillStyle = 'red';
destCtx.fillRect(0, 0,  canvasWidth, canvasHeight);
destCtx.fillStyle = 'green';
destCtx.fillRect(0, 0, canvasWidth / 2, canvasHeight / 2);
destCtx.drawImage(destCanvas,
                  0, 0, destWidth, destHeight,
                  canvasWidth / 2, canvasHeight / 2, destWidth, destHeight);
</script>
back to top