Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: LayoutTests/fast/canvas/canvas-toDataURL-webp-alpha.html

Issue 1302423004: Support lossy and lossless <canvas>.toDataURL for webp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <canvas id="canvas" width="64px" height="64px" style="display: none"></canvas> 1 <canvas id="canvas" width="64px" height="64px" style="display: none"></canvas>
2 <!-- The <img> background color should be visible behind the html5.png test imag e (the test
3 image has an alpha channel, which should be preserved by the webp toDataURL en coder). -->
4 <img id="result" style="background-color: green">
2 <pre id="log"></pre> 5 <pre id="log"></pre>
3 <img id="result"> 6
4 <script> 7 <script>
5 if (window.testRunner) { 8 if (window.testRunner) {
6 window.testRunner.dumpAsTextWithPixelResults(); 9 window.testRunner.dumpAsTextWithPixelResults();
7 window.testRunner.waitUntilDone(); 10 window.testRunner.waitUntilDone();
8 } 11 }
9 12
10 function webpDataURLTest() 13 var image = new Image();
11 { 14 image.onload = function() {
12 var canvas = document.getElementById('canvas'); 15 var canvas = document.getElementById('canvas');
13 var context = canvas.getContext('2d'); 16 canvas.getContext('2d').drawImage(this, 0, 0, canvas.width, canvas.height);
14 context.drawImage(window.image, 0, 0, canvas.width, canvas.height);
15 17
16 var dataURL = canvas.toDataURL('image/webp', 0.8); 18 var dataURL = canvas.toDataURL('image/webp', 0.8);
19
17 if (!dataURL.match(/^data:image\/webp[;,]/)) 20 if (!dataURL.match(/^data:image\/webp[;,]/))
18 document.getElementById('log').textContent += "FAIL: canvas.toDataURL('i mage/webp') not supported"; 21 document.getElementById('log').textContent += "FAIL: the dataURL should have 'image/webp' type.";
19 else 22 else
20 document.getElementById('result').src = dataURL; 23 document.getElementById('result').src = dataURL;
21 24
22 if (window.testRunner) 25 if (window.testRunner)
23 window.testRunner.notifyDone(); 26 window.testRunner.notifyDone();
24 } 27 };
25 28
26 var image = new Image();
27 image.onload = webpDataURLTest;
28 image.src = 'resources/html5.png'; 29 image.src = 'resources/html5.png';
29 </script> 30 </script>
OLDNEW
« no previous file with comments | « LayoutTests/fast/canvas/canvas-toDataURL-webp.html ('k') | LayoutTests/fast/canvas/canvas-toDataURL-webp-lossless.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698