OLD | NEW |
(Empty) | |
| 1 <img id="png"/> |
| 2 <script type="text/javascript"> |
| 3 if (window.testRunner) { |
| 4 testRunner.waitUntilDone(); |
| 5 } |
| 6 |
| 7 // TODO: Add more image types to this test once the toImageData() for webgl |
| 8 // is completed. See crbug.com/657531. |
| 9 var pngImage = document.getElementById('png'); |
| 10 function imageLoaded() { |
| 11 if (window.testRunner) { |
| 12 window.testRunner.notifyDone(); |
| 13 } |
| 14 } |
| 15 pngImage.addEventListener('load', imageLoaded); |
| 16 |
| 17 var offCanvas = new OffscreenCanvas(50, 50); |
| 18 var gl = offCanvas.getContext('webgl'); |
| 19 gl.clearColor(0, 1, 0, 1); |
| 20 gl.clear(gl.COLOR_BUFFER_BIT); |
| 21 |
| 22 offCanvas.convertToBlob() |
| 23 .then(function(blob) { |
| 24 pngImage.src = URL.createObjectURL(blob); |
| 25 }); |
| 26 |
| 27 </script> |
| 28 |
OLD | NEW |