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

Side by Side Diff: LayoutTests/fast/canvas/canvas-toDataURL-png-compression.html

Issue 290893002: [wip] Add canvas.toDataURL("image/png") compression control Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update after https://src.chromium.org/viewvc/blink?view=rev&revision=175387 Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/canvas/canvas-toDataURL-png-compression-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <pre id="result"></pre>
5 <canvas id="canvas" width="100" height="50"></canvas>
6 <script>
7 if (window.testRunner)
8 testRunner.dumpAsText();
9
10 var canvas = document.getElementById('canvas');
11 var ctx = canvas.getContext("2d");
12 for (var i = 0; i < 30; i += 5) {
13 ctx.fillStyle = 'rgba(1, 3, 254, 1)';
14 ctx.fillRect( 0 + i, i, 25, 25);
15 ctx.fillStyle = 'rgba(8, 252, 248, 0.75)';
16 ctx.fillRect(25 + i, i, 25, 25);
17 ctx.fillStyle = 'rgba(6, 10, 250, 0.502)';
18 ctx.fillRect(50 - i, i, 25, 25);
19 ctx.fillRect(50 + i, i, 25, 25);
20 ctx.fillStyle = 'rgba(12, 16, 244, 0.25)';
21 ctx.fillRect(75 - i, i, 25, 25);
22 ctx.fillRect(75 + i, i, 25, 25);
23 }
24
25 function dataURLLength(compression) {
26 var length = canvas.toDataURL("image/png", compression).length;
27 result.textContent += compression.toFixed(1) + ' ';
28 result.textContent += 'toDataURL image/png length ' + length + '\n';
29 return length;
30 }
31
32 var length3 = dataURLLength(0.3);
33 var length9 = dataURLLength(0.9);
34
35 result.textContent += (length9 < length3 * 0.7) ? "\nPASS" : "\nFAIL";
36 </script>
37 </body>
38 <html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/canvas/canvas-toDataURL-png-compression-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698