| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <body> | 3 <body> |
| 4 <script src="../resources/runner.js"></script> | 4 <script src="../resources/runner.js"></script> |
| 5 <script src="resources/canvas_runner.js"></script> | 5 <script src="resources/canvas_runner.js"></script> |
| 6 <script> | 6 <script> |
| 7 var canvas2D = document.createElement("canvas"); | 7 var canvas2D = document.createElement("canvas"); |
| 8 var ctx2D = canvas2D.getContext("2d"); | 8 var ctx2D = canvas2D.getContext("2d"); |
| 9 var canvas3D = document.createElement('canvas'); | 9 var canvas3D = document.createElement('canvas'); |
| 10 var gl = canvas3D.getContext('webgl'); | 10 var gl = canvas3D.getContext('webgl'); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 function doRun() { | 40 function doRun() { |
| 41 renderWebGL(gl); | 41 renderWebGL(gl); |
| 42 // draw dynamic WebGL | 42 // draw dynamic WebGL |
| 43 ctx2D.drawImage(canvas3D, 0, 0); | 43 ctx2D.drawImage(canvas3D, 0, 0); |
| 44 } | 44 } |
| 45 | 45 |
| 46 function ensureComplete() { | 46 function ensureComplete() { |
| 47 // Using destCanvas2D as a source image is just to flush out the content whe
n | 47 // Using destCanvas2D as a source image is just to flush out the content whe
n |
| 48 // accelerated 2D canvas is in use. | 48 // accelerated 2D canvas is in use. |
| 49 dummyCtx2D.drawImage(destCanvas2D, 0, 0, 1, 1, 0, 0, 1, 1); | 49 dummyCtx2D.drawImage(canvas2D, 0, 0, 1, 1, 0, 0, 1, 1); |
| 50 } | 50 } |
| 51 | 51 |
| 52 window.onload = function () { | 52 window.onload = function () { |
| 53 // It should use setMinimumAccelerated2dCanvasSize() to enable accelerated C
anvas for a specified size | 53 // It should use setMinimumAccelerated2dCanvasSize() to enable accelerated C
anvas for a specified size |
| 54 // but this API is not available in JS or WebPage. Assume the threshold size
is 256x257 | 54 // but this API is not available in JS or WebPage. Assume the threshold size
is 256x257 |
| 55 // and the dest canvas is HW accelerated Canvas when setting its size to 102
4x1024. | 55 // and the dest canvas is HW accelerated Canvas when setting its size to 102
4x1024. |
| 56 setSize(1024, 1024, 1024, 1024); | 56 setSize(1024, 1024, 1024, 1024); |
| 57 renderWebGL(gl); | 57 renderWebGL(gl); |
| 58 CanvasRunner.start({ | 58 CanvasRunner.start({ |
| 59 description: "This bench test checks the speed on drawing dynamic WebGL(
1024x1024) to HW accelerated Canvas2D(1024x1024).", | 59 description: "This bench test checks the speed on drawing dynamic WebGL(
1024x1024) to HW accelerated Canvas2D(1024x1024).", |
| 60 doRun: doRun, | 60 doRun: doRun, |
| 61 ensureComplete: ensureComplete}); | 61 ensureComplete: ensureComplete}); |
| 62 } | 62 } |
| 63 | 63 |
| 64 </script> | 64 </script> |
| 65 </body> | 65 </body> |
| 66 </html> | 66 </html> |
| OLD | NEW |