Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: lib/icon.js

Issue 29349240: Issue 4218 - Browser icons for newer Chrome + Edge (Closed)
Left Patch Set: Created Aug. 9, 2016, 11:10 a.m.
Right Patch Set: Avoid JSHydra generating inefficient code Created Aug. 9, 2016, 1:54 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « chrome/icons/abp-40-whitelisted.png ('k') | metadata.chrome » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 let frames = {}; 117 let frames = {};
118 let canvas = document.createElement("canvas"); 118 let canvas = document.createElement("canvas");
119 let context = canvas.getContext("2d"); 119 let context = canvas.getContext("2d");
120 120
121 for (let whitelisted of [false, true]) 121 for (let whitelisted of [false, true])
122 { 122 {
123 for (let i = 0, opacity = 0; i <= 10; opacity = ++i / 10) 123 for (let i = 0, opacity = 0; i <= 10; opacity = ++i / 10)
124 { 124 {
125 let imageData = {}; 125 let imageData = {};
126 for (let size of [16, 19, 20, 32, 38, 40]) 126 let sizes = [16, 19, 20, 32, 38, 40];
Sebastian Noack 2016/08/09 13:46:47 As mentioned before, please don't use for..of with
127 for (let size of sizes)
127 { 128 {
128 canvas.width = size; 129 canvas.width = size;
129 canvas.height = size; 130 canvas.height = size;
130 context.globalAlpha = 1; 131 context.globalAlpha = 1;
131 context.drawImage(images[size]["base"][whitelisted | 0], 0, 0); 132 context.drawImage(images[size]["base"][whitelisted | 0], 0, 0);
132 context.globalAlpha = opacity; 133 context.globalAlpha = opacity;
133 context.drawImage(images[size]["overlay"], 0, 0); 134 context.drawImage(images[size]["overlay"], 0, 0);
134 imageData[size] = context.getImageData(0, 0, size, size); 135 imageData[size] = context.getImageData(0, 0, size, size);
135 } 136 }
136 frames["" + opacity + whitelisted] = imageData; 137 frames["" + opacity + whitelisted] = imageData;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 clearInterval(interval); 227 clearInterval(interval);
227 resolve(); 228 resolve();
228 return; 229 return;
229 } 230 }
230 231
231 animateIcon(type, frames); 232 animateIcon(type, frames);
232 }, 10000); 233 }, 10000);
233 }); 234 });
234 }); 235 });
235 }; 236 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld