3
0
Fork 0
forked from mirrors/nixpkgs

desktopToDarwinBundle: Drop 48x48 size

On macOS 10.13 the 48x48 icon size is not supported. It results in a
corrupted image being displayed. I suspect the image data is being
truncated to what it expects for 32x32 or maybe data is read for
128x128, which would be a buffer overflow.
This commit is contained in:
toonn 2022-03-21 12:41:52 +01:00
parent 7a40437bdd
commit 21fe5d3b8b
No known key found for this signature in database
GPG key ID: 44FF902A66DF4576

View file

@ -18,7 +18,9 @@ convertIconTheme() {
local -r iconName=$3
local -r theme=${4:-hicolor}
local -ra iconSizes=(16 32 48 128 256 512)
# Sizes based on archived Apple documentation:
# https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/app-icon#app-icon-sizes
local -ra iconSizes=(16 32 128 256 512)
local -ra scales=([1]="" [2]="@2")
# Based loosely on the algorithm at:
@ -31,13 +33,6 @@ convertIconTheme() {
local scaleSuffix=${scales[$scale]}
local exactSize=${iconSize}x${iconSize}${scaleSuffix}
if [[ $exactSize = '48x48@2' ]]; then
# macOS does not support a 2x scale variant of 48x48 icons
# See: https://en.wikipedia.org/wiki/Apple_Icon_Image_format#Icon_types
echo "unsupported"
return 0
fi
local -a validSizes=(
${exactSize}
$((iconSize + 1))x$((iconSize + 1))${scaleSuffix}