blob: 940ac0a3a3c1ed5b2cc6765974caeed2efeee1dd [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../resources/runner.js"></script>
<script>
var imgHeight = 1024;
var imgWidth = 1024;
var canvas = document.createElement("canvas");
canvas.width = imgWidth;
canvas.height = imgHeight;
var context = canvas.getContext('2d');
var image = context.createImageData(imgWidth, imgHeight);
function rand(range) {
return Math.floor(Math.random() * range);
}
function initializeImageData() {
for(var i = 0; i < image.data.length; i++)
image.data[i] = rand(256);
}
function imageBitmapFromImageData() {
/*The return Promise is not retained because this test
is meant to only measure the immediate run time of
createImageBitmap from an ImageData, which is known
to be implemented in a way that does all the work
synchronously, even though the API is technically async.*/
createImageBitmap(image, 0, 0, imgWidth, imgHeight);
}
initializeImageData();
PerfTestRunner.measureRunsPerSecond({run: imageBitmapFromImageData, description: "This bench test checks the speed on creating ImageBitmap from ImageData(1024x1024)."});
</script>
</body>
</html>