| <!DOCTYPE html> |
| <html> |
| <body> |
| <script src="../resources/runner.js"></script> |
| <script src="resources/canvas_runner.js"></script> |
| <script> |
| var source = new OffscreenCanvas(2000, 1000); |
| var ctx = source.getContext("2d"); |
| var destination = document.createElement('canvas'); |
| var destinationCtx = destination.getContext('bitmaprenderer') |
| |
| window.onload = function () { |
| CanvasRunner.start({ |
| description: "This bench test checks the speed of tranferring 2D context content to a 'bitmaprenderer' context.", |
| doRun: doRun |
| }); |
| } |
| |
| function doRun() { |
| ctx.fillRect(0, 0, 1, 1); |
| var img = source.transferToImageBitmap(); |
| destinationCtx.transferFromImageBitmap(img); |
| } |
| </script> |
| </body> |
| </html> |