Test case details

Preparation Code

<canvas id="cnv" width="185" height="70"> </canvas> <img id="img" src="http://mozilla.org/media/img/firefox/template/header-logo-inverse.png" style="display: none" />
function createCanvas(w, h) { var canvas = document.createElement('canvas'); canvas.setAttribute('width', w); canvas.setAttribute('height', h); return canvas; } // globals var g_ctx = document.getElementById('cnv').getContext('2d'); var g_img = document.getElementById('img'); var g_offscreenCanvas = createCanvas(185, 70); g_offscreenCanvas.getContext('2d').drawImage(g_img, 0, 0, 185, 70);

Test cases

Test #1

g_ctx.clearRect(0, 0, 185, 70); g_ctx.drawImage(g_img, 0, 0, 185, 70, 0, 0, 185, 70);

Test #2

g_ctx.clearRect(0, 0, 185, 70); g_ctx.drawImage(g_offscreenCanvas, 0, 0, 185, 70, 0, 0, 185, 70);

Test #3

g_ctx.clearRect(0, 0, 185, 70); g_ctx.drawImage(g_offscreenCanvas, 0, 0);