Index: third_party/WebKit/PerformanceTests/Canvas/createImageBitmapFromImageData.html |
diff --git a/third_party/WebKit/PerformanceTests/Canvas/createImageBitmapFromImageData.html b/third_party/WebKit/PerformanceTests/Canvas/createImageBitmapFromImageData.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2be316c78773cc344639961d872542b5519e520b |
--- /dev/null |
+++ b/third_party/WebKit/PerformanceTests/Canvas/createImageBitmapFromImageData.html |
@@ -0,0 +1,32 @@ |
+<!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 setImageData() { |
Justin Novosad
2015/10/06 02:17:53
I would call this initializeImageData.
|
+ for(var i = 0; i < image.data.length; i+= 4) |
Justin Novosad
2015/10/06 02:17:53
if you just incremented i by 1, you would not need
|
+ for(var j = 0; j < 4; j++) |
+ image.data[i+j] = rand(255); |
Justin Novosad
2015/10/06 02:17:52
Not that it matters much, but to produce values be
|
+} |
+ |
+function imageBitmapFromImageData() { |
+ createImageBitmap(image, 0, 0, imgWidth, imgHeight); |
Justin Novosad
2015/10/06 02:17:53
Add a comment to explain that the return Promise i
|
+} |
+ |
+setImageData(); |
+PerfTestRunner.measureRunsPerSecond({run: imageBitmapFromImageData, description: "This bench test checks the speed on creating ImageBitmap from ImageData(1024x1024)."}); |
+</script> |
+</body> |
+</html> |