| <!DOCTYPE html> |
| <html> |
| <body> |
| <script src="../resources/runner.js"></script> |
| <script> |
| |
| var canvas2D = document.createElement("canvas"); |
| var ctx2D = canvas2D.getContext("2d"); |
| |
| function setSize(width, height) { |
| canvas2D.width = width; |
| canvas2D.height = height; |
| } |
| |
| function rand(range) { |
| return Math.floor(Math.random() * range); |
| } |
| |
| function fillCanvas(ctx2d, canvas2d) { |
| ctx2d.fillStyle = "rgba(" + rand(255) + "," + rand(255) + "," + rand(255) + "," + rand(255) + ")"; |
| ctx2d.fillRect(0, 0, canvas2d.width, canvas2d.height); |
| } |
| |
| function getImageDataFromCanvas2D() { |
| ctx2D.getImageData(0, 0, canvas2D.width, canvas2D.height); |
| } |
| |
| setSize(1024, 1024); |
| fillCanvas(ctx2D, canvas2D); |
| |
| PerfTestRunner.measureRunsPerSecond({run: getImageDataFromCanvas2D, description: "This bench test checks the speed on getting ImageData from Canvas2D(1024x1024)."}); |
| |
| </script> |
| </body> |
| </html> |