OLD | NEW |
(Empty) | |
| 1 <!-- The letters in the right image should be crisp like the letters in the left
image. --> |
| 2 <canvas></canvas> |
| 3 <img id="result"> |
| 4 <pre id="error"></pre> |
| 5 |
| 6 <script> |
| 7 if (window.testRunner) { |
| 8 window.testRunner.dumpAsTextWithPixelResults(); |
| 9 window.testRunner.waitUntilDone(); |
| 10 } |
| 11 |
| 12 var image = new Image(); |
| 13 |
| 14 image.onload = function() { |
| 15 var canvas = document.querySelector('canvas'); |
| 16 canvas.width = this.width; |
| 17 canvas.height = this.height; |
| 18 canvas.getContext('2d').drawImage(this, 0, 0); |
| 19 |
| 20 var dataURL = canvas.toDataURL('image/webp', 1.0); // maximum quality |
| 21 |
| 22 if (!dataURL.match(/^data:image\/webp[;,]/)) |
| 23 error.textContent += "FAIL: the dataURL should have 'image/webp' type."; |
| 24 else |
| 25 result.src = dataURL; |
| 26 |
| 27 if (window.testRunner) |
| 28 window.testRunner.notifyDone(); |
| 29 }; |
| 30 |
| 31 image.src = "resources/letters.png"; |
| 32 </script> |
OLD | NEW |