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