[debian-edu-commits] debian-edu/upstream/ 07/26: Adjust cache population strategy to copy PNG and SVG files unchanged to the cache, while converting XPM files to PNG. Make sure to prefer SVG files over PNG and XPM files. This ensure no quality loss for PNG and SVG icons.

Petter Reinholdtsen pere at moszumanska.debian.org
Mon Mar 31 07:28:16 UTC 2014


This is an automated email from the git hooks/post-receive script.

pere pushed a commit to branch master
in repository kde-icon-cache.

commit e74d7abf88dd408202b545e95aff5426d5fa4357
Author: pere <pere at 2f71faf1-f021-45ab-956e-ee25d755e2f5>
Date:   Wed Apr 4 20:47:24 2012 +0000

    Adjust cache population strategy to copy PNG and SVG files
    unchanged to the cache, while converting XPM files to PNG.  Make
    sure to prefer SVG files over PNG and XPM files.  This ensure no
    quality loss for PNG and SVG icons.
    
    git-svn-id: svn+ssh://svn.slxdrift.no/svnroot/oslo/trunk/src/kde-icon-cache@2460 2f71faf1-f021-45ab-956e-ee25d755e2f5
---
 debian/changelog      |  9 +++++++++
 update-kde-icon-cache | 28 +++++++++++++++++++++-------
 2 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 68fdaee..a69c5b4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+kde-icon-cache (0.0.2) UNRELEASED; urgency=low
+
+  * Adjust cache population strategy to copy PNG and SVG files
+    unchanged to the cache, while converting XPM files to PNG.  Make
+    sure to prefer SVG files over PNG and XPM files.  This ensure no
+    quality loss for PNG and SVG icons.
+
+ -- Petter Reinholdtsen <pere at debian.org>  Wed, 04 Apr 2012 22:43:44 +0200
+
 kde-icon-cache (0.0.1) lenny; urgency=low
 
   * Initial package targeted against Lenny.
diff --git a/update-kde-icon-cache b/update-kde-icon-cache
index 86a415b..86c69a2 100755
--- a/update-kde-icon-cache
+++ b/update-kde-icon-cache
@@ -860,21 +860,36 @@ add_to_iconcache() {
 	    curprefix=.xpm
 	    ;;
     esac
-    for d in $icondirs ; do
 
-        # KDE will look for .png, .svgz, .svg and .xpm in that order.
-	for prefix in  "" .png .svgz .svg .xpm ; do
+    # KDE will look for .png, .svgz, .svg and .xpm in that order.
+    # We prefer vector versions before bitmaps
+    for prefix in  "" .svgz .svg .png .xpm ; do
+	for d in $icondirs ; do
 	    file="$d/$iconname$prefix"
 #	    echo "Checking $file" 1>&2
 	    if [ -e "$file" ] ; then
+		case "$file" in
+		    *.xpm)
+			cacheprefix=.png
+			;;
+		esac
+
 		if [ ! "$prefix" ] && [ "$curprefix" ]; then
 		    prefix="$curprefix"
 		fi
 		
-		cachefile="$(basename "$file" $prefix).png"
+		if [ "$cacheprefix" ] ; then
+		    cachefile="$(basename "$file" "$prefix")$cacheprefix"
+		else
+		    cachefile="$(basename "$file")"
+		fi
 		if [ ! -e "$cachedir/$cachefile" ] && \
 		    [ ! -e "$earlydir/$cachefile" ]; then
-		    convert -resize 16x16 "$file" "$cachedir/$cachefile"
+		    if [ "$cacheprefix" ] ; then
+			convert -resize 16x16 "$file" "$cachedir/$cachefile"
+		    else
+			cp "$file" "$cachedir/$cachefile"
+		    fi
 		fi
 		echo "$file"
 		return
@@ -890,9 +905,8 @@ populate_cache() {
     for d in $(find $menudir -name '*.desktop' -type f) ; do
 	iconname="$(grep -i ^Icon $d | cut -d= -f2)"
 	if [ "$iconname" ] ; then
-	    echo $iconname
 	    file="$(add_to_iconcache "$iconname")"
-	    echo "-> $file"
+	    echo "$iconname -> $file"
 	else
 	    echo missing: $d
 	fi

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/upstream/kde-icon-cache.git



More information about the debian-edu-commits mailing list