@@ -7,7 +7,7 @@ use std::process::{Child, Command, Stdio};
7
7
8
8
use anyhow:: { Context , Result , bail} ;
9
9
use icns:: { IconFamily , IconType , Image , PixelFormat } ;
10
- use image:: imageops:: FilterType :: Gaussian ;
10
+ use image:: imageops:: FilterType :: Lanczos3 ;
11
11
use image:: imageops:: resize;
12
12
use image:: { DynamicImage , Rgba , RgbaImage } ;
13
13
use log:: { debug, error, warn} ;
@@ -21,7 +21,7 @@ use crate::components::site::Site;
21
21
use crate :: integrations:: categories:: MACOS_CATEGORIES ;
22
22
use crate :: integrations:: utils:: {
23
23
download_icon,
24
- generate_icon ,
24
+ generate_fallback_icon ,
25
25
normalize_category_name,
26
26
sanitize_name,
27
27
} ;
@@ -44,7 +44,7 @@ const STORE_ICONS_ERROR: &str = "Failed to store icons";
44
44
const LAUNCH_APPLICATION_BUNDLE : & str = "Failed to launch web app via system integration" ;
45
45
const APP_BUNDLE_NAME_ERROR : & str = "Failed to get name of app bundle" ;
46
46
const APP_BUNDLE_UNICODE_ERROR : & str = "Failed to check name of app bundle for Unicode validity" ;
47
- const GENERATE_ICON_ERROR : & str = "Failed to generate icon" ;
47
+ const GENERATE_FALLBACK_ICON_ERROR : & str = "Failed to generate fallback icon" ;
48
48
const GET_LETTER_ERROR : & str = "Failed to get first letter" ;
49
49
50
50
const ICON_SAFE_ZONE_FACTOR : f64 = 0.697265625 ;
@@ -221,7 +221,8 @@ fn store_icons(target: &Path, name: &str, icons: &[IconResource], client: &Clien
221
221
222
222
for size in & icon_sizes {
223
223
let image_size = ImageSize :: Fixed ( size. size ( ) , size. size ( ) ) ;
224
- let image_data = generate_icon ( letter, & image_size) . context ( GENERATE_ICON_ERROR ) ?;
224
+ let image_data = generate_fallback_icon ( letter, & image_size)
225
+ . context ( GENERATE_FALLBACK_ICON_ERROR ) ?;
225
226
226
227
let mut img = DynamicImage :: ImageRgb8 ( image_data) . into_rgba8 ( ) ;
227
228
mask_icon ( & mut img, true ) . context ( MASK_ICON_ERROR ) ?;
@@ -270,7 +271,7 @@ fn load_icon(content: &[u8], content_type: &str, size: u32) -> Result<RgbaImage>
270
271
// Parse raster icons using the `image` crate and resize it to the correct size
271
272
debug ! ( "Processing as raster icon" ) ;
272
273
let img = image:: load_from_memory ( content) . context ( "Failed to load raster icon" ) ?;
273
- let img = img. resize_to_fill ( size, size, Gaussian ) . into_rgba8 ( ) ;
274
+ let img = img. resize_to_fill ( size, size, Lanczos3 ) . into_rgba8 ( ) ;
274
275
Ok ( img)
275
276
}
276
277
@@ -286,8 +287,8 @@ fn mask_icon(icon: &mut RgbaImage, maskable: bool) -> Result<()> {
286
287
let icon_size = Point { x : icon. width ( ) , y : icon. height ( ) } ;
287
288
let mask = image:: load_from_memory ( include_bytes ! ( "../../../assets/icon-mask-macos.png" ) ) ?;
288
289
let shadow = image:: load_from_memory ( include_bytes ! ( "../../../assets/icon-shadow-macos.png" ) ) ?;
289
- let scaled_mask = mask. resize ( icon_size. x , icon_size. y , Gaussian ) ; // This is really slow in debug builds, up to ~1s
290
- let scaled_shadow = shadow. resize ( icon_size. x , icon_size. y , Gaussian ) ; // This is really slow in debug builds, up to ~1s
290
+ let scaled_mask = mask. resize ( icon_size. x , icon_size. y , Lanczos3 ) ; // This is really slow in debug builds, up to ~1s
291
+ let scaled_shadow = shadow. resize ( icon_size. x , icon_size. y , Lanczos3 ) ; // This is really slow in debug builds, up to ~1s
291
292
let mask_data = scaled_mask. into_rgba8 ( ) ;
292
293
let shadow_data = scaled_shadow. into_rgba8 ( ) ;
293
294
@@ -308,7 +309,7 @@ fn mask_icon(icon: &mut RgbaImage, maskable: bool) -> Result<()> {
308
309
let scaled_icon_data: RgbaImage = if maskable {
309
310
icon. clone ( )
310
311
} else {
311
- resize ( icon, scaled_icon_size. x , scaled_icon_size. y , Gaussian )
312
+ resize ( icon, scaled_icon_size. x , scaled_icon_size. y , Lanczos3 )
312
313
} ;
313
314
314
315
let background = RgbaImage :: from_pixel ( icon_size. x , icon_size. y , Rgba ( [ 255 , 255 , 255 , 255 ] ) ) ;
0 commit comments