summaryrefslogtreecommitdiff
path: root/libappstream-builder/plugins/asb-plugin-desktop.c
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-07-10 16:58:03 +0100
committerRichard Hughes <richard@hughsie.com>2014-07-10 16:58:05 +0100
commitd3d34038f6a4335885dc453295ad22fe8a84a9db (patch)
tree7dccbc27377c381150b21d67d50195887992e85c /libappstream-builder/plugins/asb-plugin-desktop.c
parent0e76cdad9754fb157e720c9d71c7d46892981c99 (diff)
downloadappstream-glib-d3d34038f6a4335885dc453295ad22fe8a84a9db.tar.gz
Never load SVG files at the native size
SVGs can have a set DPI, but can of course be rescaled up and down. Manually specify the ideal minimum size (but preserving aspect ratios) when opening scalable files. Resolves: https://github.com/hughsie/appstream-glib/issues/11
Diffstat (limited to 'libappstream-builder/plugins/asb-plugin-desktop.c')
-rw-r--r--libappstream-builder/plugins/asb-plugin-desktop.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libappstream-builder/plugins/asb-plugin-desktop.c b/libappstream-builder/plugins/asb-plugin-desktop.c
index a83ba91..1a9c38f 100644
--- a/libappstream-builder/plugins/asb-plugin-desktop.c
+++ b/libappstream-builder/plugins/asb-plugin-desktop.c
@@ -88,7 +88,13 @@ asb_app_load_icon (const gchar *filename, const gchar *logfn, GError **error)
_cleanup_object_unref_ GdkPixbuf *pixbuf_tmp = NULL;
/* open file in native size */
- pixbuf_src = gdk_pixbuf_new_from_file (filename, error);
+ if (g_str_has_suffix (filename, ".svg")) {
+ pixbuf_src = gdk_pixbuf_new_from_file_at_scale (filename,
+ 64, 64, TRUE,
+ error);
+ } else {
+ pixbuf_src = gdk_pixbuf_new_from_file (filename, error);
+ }
if (pixbuf_src == NULL)
return NULL;