OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <body> |
| 4 <script src="../resources/runner.js"></script> |
| 5 <script src="resources/canvas_runner.js"></script> |
| 6 <script> |
| 7 var source = new OffscreenCanvas(2000, 1000); |
| 8 var ctx = source.getContext("2d"); |
| 9 var destination = document.createElement('canvas'); |
| 10 var destinationCtx = destination.getContext('bitmaprenderer') |
| 11 |
| 12 window.onload = function () { |
| 13 CanvasRunner.start({ |
| 14 description: "This bench test checks the speed of tranferring 2D context con
tent to a 'bitmaprenderer' context.", |
| 15 doRun: doRun |
| 16 }); |
| 17 } |
| 18 |
| 19 function doRun() { |
| 20 ctx.fillRect(0, 0, 1, 1); |
| 21 var img = source.transferToImageBitmap(); |
| 22 destinationCtx.transferFromImageBitmap(img); |
| 23 } |
| 24 </script> |
| 25 </body> |
| 26 </html> |
OLD | NEW |