drawImage from different sources (v21)

Revision 21 of this benchmark created on


Preparation HTML

<img id="onscreenImage" src="http://icons.iconarchive.com/icons/visualpharm/icons8-metro-style/512/Sciences-Classes-Test-tube-icon.png"/>
<canvas id="onscreenCanvas" width="1024" height="1024">
</canvas>

<script>
// globals
var onscreenImage = document.getElementById('onscreenImage');
var offscreenImage = document.createElement('img');

var offscreenCanvasSource = document.createElement('canvas');
offscreenCanvasSource.width = 512;
offscreenCanvasSource.height = 512;
var offscreenCanvasSource2d = offscreenCanvasSource.getContext('2d');



var onscreenCanvas = document.getElementById('onscreenCanvas');
var onscreenCanvas2d = onscreenCanvas.getContext('2d');

var offscreenCanvas = document.createElement('canvas');
offscreenCanvas.width = 1024;
offscreenCanvas.height = 1024;
var offscreenCanvas2d = offscreenCanvas.getContext('2d');

offscreenImage.onload = function ()
{
offscreenCanvasSource2d.drawImage(offscreenImage, 0, 0,512, 512, 0, 0, 512, 512);
// preview
onscreenCanvas2d.drawImage(offscreenImage, 0, 0, 512, 512, 0, 0, 512, 512);
onscreenCanvas2d.drawImage(offscreenCanvasSource, 0, 0, 512, 512, 512, 512, 512, 512);
};
offscreenImage.src = "http://icons.iconarchive.com/icons/visualpharm/icons8-metro-style/512/Sciences-Classes-Test-tube-icon.png";

</script>

Test runner

Ready to run.

Testing in
TestOps/sec
offscreenImage
offscreenCanvas2d.drawImage(offscreenImage, 0, 0, 512, 512, 0, 0, 512, 512);
ready
offscreenCanvasSource
offscreenCanvas2d.drawImage(offscreenCanvasSource, 0, 0, 512, 512, 0, 0, 512, 512);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.