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

Side by Side Diff: lib/icon.js

Issue 29997602: Issue 7256 - Stop using 19x19 and 38x38 icons (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created Feb. 3, 2019, 8:45 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « icons/abp-38-whitelisted.png ('k') | metadata.chrome » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 if (canUpdateIcon) 81 if (canUpdateIcon)
82 setIcon(page); 82 setIcon(page);
83 }); 83 });
84 84
85 function renderFrames(notificationType) 85 function renderFrames(notificationType)
86 { 86 {
87 return Promise.all([ 87 return Promise.all([
88 loadImage("icons/abp-16.png"), 88 loadImage("icons/abp-16.png"),
89 loadImage("icons/abp-16-whitelisted.png"), 89 loadImage("icons/abp-16-whitelisted.png"),
90 loadImage("icons/abp-16-notification-" + notificationType + ".png"), 90 loadImage("icons/abp-16-notification-" + notificationType + ".png"),
91 loadImage("icons/abp-19.png"),
92 loadImage("icons/abp-19-whitelisted.png"),
93 loadImage("icons/abp-19-notification-" + notificationType + ".png"),
94 loadImage("icons/abp-20.png"), 91 loadImage("icons/abp-20.png"),
95 loadImage("icons/abp-20-whitelisted.png"), 92 loadImage("icons/abp-20-whitelisted.png"),
96 loadImage("icons/abp-20-notification-" + notificationType + ".png"), 93 loadImage("icons/abp-20-notification-" + notificationType + ".png"),
97 loadImage("icons/abp-32.png"), 94 loadImage("icons/abp-32.png"),
98 loadImage("icons/abp-32-whitelisted.png"), 95 loadImage("icons/abp-32-whitelisted.png"),
99 loadImage("icons/abp-32-notification-" + notificationType + ".png"), 96 loadImage("icons/abp-32-notification-" + notificationType + ".png"),
100 loadImage("icons/abp-38.png"),
101 loadImage("icons/abp-38-whitelisted.png"),
102 loadImage("icons/abp-38-notification-" + notificationType + ".png"),
103 loadImage("icons/abp-40.png"), 97 loadImage("icons/abp-40.png"),
104 loadImage("icons/abp-40-whitelisted.png"), 98 loadImage("icons/abp-40-whitelisted.png"),
105 loadImage("icons/abp-40-notification-" + notificationType + ".png") 99 loadImage("icons/abp-40-notification-" + notificationType + ".png")
106 ]).then(images => 100 ]).then(images =>
107 { 101 {
108 let imageMap = { 102 let imageMap = {
109 16: {base: [images[0], images[1]], overlay: images[2]}, 103 16: {base: [images[0], images[1]], overlay: images[2]},
110 19: {base: [images[3], images[4]], overlay: images[5]}, 104 20: {base: [images[3], images[4]], overlay: images[5]},
111 20: {base: [images[6], images[7]], overlay: images[8]}, 105 32: {base: [images[6], images[7]], overlay: images[8]},
112 32: {base: [images[9], images[10]], overlay: images[11]}, 106 40: {base: [images[9], images[10]], overlay: images[11]}
113 38: {base: [images[12], images[13]], overlay: images[14]},
114 40: {base: [images[15], images[16]], overlay: images[17]}
115 }; 107 };
116 108
117 let frames = {}; 109 let frames = {};
118 let canvas = document.createElement("canvas"); 110 let canvas = document.createElement("canvas");
119 let context = canvas.getContext("2d"); 111 let context = canvas.getContext("2d");
120 112
121 for (let whitelisted of [false, true]) 113 for (let whitelisted of [false, true])
122 { 114 {
123 for (let i = 0, opacity = 0; i <= 10; opacity = ++i / 10) 115 for (let i = 0, opacity = 0; i <= 10; opacity = ++i / 10)
124 { 116 {
125 let imageData = {}; 117 let imageData = {};
126 let sizes = [16, 19, 20, 32, 38, 40]; 118 let sizes = [16, 20, 32, 40];
127 for (let size of sizes) 119 for (let size of sizes)
128 { 120 {
129 canvas.width = size; 121 canvas.width = size;
130 canvas.height = size; 122 canvas.height = size;
131 context.globalAlpha = 1; 123 context.globalAlpha = 1;
132 context.drawImage(imageMap[size]["base"][whitelisted | 0], 0, 0); 124 context.drawImage(imageMap[size]["base"][whitelisted | 0], 0, 0);
133 context.globalAlpha = opacity; 125 context.globalAlpha = opacity;
134 context.drawImage(imageMap[size]["overlay"], 0, 0); 126 context.drawImage(imageMap[size]["overlay"], 0, 0);
135 imageData[size] = context.getImageData(0, 0, size, size); 127 imageData[size] = context.getImageData(0, 0, size, size);
136 } 128 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 clearInterval(interval); 222 clearInterval(interval);
231 resolve(); 223 resolve();
232 return; 224 return;
233 } 225 }
234 226
235 animateIcon(type, frames); 227 animateIcon(type, frames);
236 }, 10000); 228 }, 10000);
237 }); 229 });
238 }); 230 });
239 }; 231 };
OLDNEW
« no previous file with comments | « icons/abp-38-whitelisted.png ('k') | metadata.chrome » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld