[colobot] 34/145: Fix desktop SVG icon not resizing properly
Didier Raboud
odyx at moszumanska.debian.org
Mon Jul 11 12:56:14 UTC 2016
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch debian/master
in repository colobot.
commit 89389e82e8a6d999092497c68172c7d633a0fa88
Author: Piotr Dziwinski <piotrdz at gmail.com>
Date: Sun Apr 3 15:18:46 2016 +1200
Fix desktop SVG icon not resizing properly
Workaround for librsvg bug
---
desktop/CMakeLists.txt | 32 ++++++++++++++++++--------------
desktop/colobot.svg | 1 +
2 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/desktop/CMakeLists.txt b/desktop/CMakeLists.txt
index 93113ad..a452167 100644
--- a/desktop/CMakeLists.txt
+++ b/desktop/CMakeLists.txt
@@ -1,30 +1,34 @@
cmake_minimum_required(VERSION 2.8)
-set(COLOBOT_ICON_FILE colobot.svg)
+set(COLOBOT_ICON_FILE ${CMAKE_CURRENT_SOURCE_DIR}/colobot.svg)
# Render SVG icon in various sizes
find_program(RSVG_CONVERT rsvg-convert)
-if(RSVG_CONVERT AND (PLATFORM_GNU OR PLATFORM_MACOSX))
- add_custom_target(png-icons ALL)
- foreach(PNGSIZE 512 256 128 48 32 16)
+find_program(XMLSTARLET xmlstarlet)
+if(RSVG_CONVERT AND XMLSTARLET AND (PLATFORM_GNU OR PLATFORM_MACOSX))
+ add_custom_target(png-icons ALL DEPENDS ${COLOBOT_ICON_FILE})
+
+ foreach(PNG_SIZE 512 256 128 48 32 16)
+ # Using xmlstarlet to edit SVG file is a workaround for rsvg-convert bug (see: https://bugzilla.gnome.org/show_bug.cgi?id=762115)
add_custom_command(
- OUTPUT ${PNGSIZE}/colobot.png
- COMMAND mkdir -p ${PNGSIZE}
- COMMAND ${RSVG_CONVERT} -w ${PNGSIZE} -h ${PNGSIZE} ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE} > ${PNGSIZE}/colobot.png
+ OUTPUT ${PNG_SIZE}/colobot.png
+ COMMAND mkdir -p ${PNG_SIZE}
+ COMMAND ${XMLSTARLET} ed -u /*/@width -v ${PNG_SIZE} -u /*/@height -v ${PNG_SIZE} ${COLOBOT_ICON_FILE} > ${PNG_SIZE}/colobot.svg
+ COMMAND ${RSVG_CONVERT} ${PNG_SIZE}/colobot.svg -o ${PNG_SIZE}/colobot.png
)
- add_custom_target(png-icon-${PNGSIZE} ALL DEPENDS ${PNGSIZE}/colobot.png)
- add_dependencies(png-icons png-icon-${PNGSIZE})
+ add_custom_target(png-icon-${PNG_SIZE} ALL DEPENDS ${PNG_SIZE}/colobot.png)
+ add_dependencies(png-icons png-icon-${PNG_SIZE})
if(PLATFORM_GNU)
install(
- FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png
- DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/${PNGSIZE}x${PNGSIZE}/apps/
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNG_SIZE}/colobot.png
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/${PNG_SIZE}x${PNG_SIZE}/apps/
)
endif()
# Prepare the ICNS icon generation
- list(APPEND ICNS_SRCS "${PNGSIZE}/colobot.png")
+ list(APPEND ICNS_SRCS "${PNG_SIZE}/colobot.png")
endforeach()
-
+
# Pack icon for Mac OS
find_program(PNG2ICNS png2icns)
if(PNG2ICNS AND PLATFORM_MACOSX)
@@ -54,7 +58,7 @@ if(PLATFORM_GNU)
# Install Icon
install(
- FILES ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE}
+ FILES ${COLOBOT_ICON_FILE}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps/
)
diff --git a/desktop/colobot.svg b/desktop/colobot.svg
index c514d6b..cb3ca35 100644
--- a/desktop/colobot.svg
+++ b/desktop/colobot.svg
@@ -12,6 +12,7 @@
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="32"
height="32"
+ viewBox="0 0 32 32"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git
More information about the Pkg-games-commits
mailing list