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