summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-07-10 17:52:02 +0100
committerRichard Hughes <richard@hughsie.com>2014-07-10 18:10:18 +0100
commite6d93c0adb1849299c83411adb10b8c423f49f5d (patch)
treed7071f24810be1627016007608167d798baebcb6
parentff600394eb182a795ea9017afaa500746ff962ed (diff)
downloadappstream-glib-e6d93c0adb1849299c83411adb10b8c423f49f5d.tar.gz
Save in the logs when icons are padded with alpha
-rw-r--r--libappstream-builder/asb-app.c7
-rw-r--r--libappstream-builder/plugins/asb-plugin-desktop.c30
2 files changed, 24 insertions, 13 deletions
diff --git a/libappstream-builder/asb-app.c b/libappstream-builder/asb-app.c
index a21a214..951525c 100644
--- a/libappstream-builder/asb-app.c
+++ b/libappstream-builder/asb-app.c
@@ -198,13 +198,6 @@ asb_app_set_pixbuf (AsbApp *app, GdkPixbuf *pixbuf)
if (priv->pixbuf != NULL)
g_object_ref (priv->pixbuf);
priv->pixbuf = g_object_ref (pixbuf);
-
- /* does the icon not have an alpha channel */
- if (!gdk_pixbuf_get_has_alpha (priv->pixbuf)) {
- asb_package_log (priv->pkg,
- ASB_PACKAGE_LOG_LEVEL_WARNING,
- "icon does not have an alpha channel");
- }
}
/**
diff --git a/libappstream-builder/plugins/asb-plugin-desktop.c b/libappstream-builder/plugins/asb-plugin-desktop.c
index 1a9c38f..4beb97c 100644
--- a/libappstream-builder/plugins/asb-plugin-desktop.c
+++ b/libappstream-builder/plugins/asb-plugin-desktop.c
@@ -77,7 +77,10 @@ asb_plugin_check_filename (AsbPlugin *plugin, const gchar *filename)
* asb_app_load_icon:
*/
static GdkPixbuf *
-asb_app_load_icon (const gchar *filename, const gchar *logfn, GError **error)
+asb_app_load_icon (AsbPackage *pkg,
+ const gchar *filename,
+ const gchar *logfn,
+ GError **error)
{
GdkPixbuf *pixbuf = NULL;
guint pixbuf_height;
@@ -111,6 +114,14 @@ asb_app_load_icon (const gchar *filename, const gchar *logfn, GError **error)
return NULL;
}
+ /* does the icon not have an alpha channel */
+ if (!gdk_pixbuf_get_has_alpha (pixbuf_src)) {
+ asb_package_log (pkg,
+ ASB_PACKAGE_LOG_LEVEL_INFO,
+ "icon %s does not have an alpha channel",
+ logfn);
+ }
+
/* don't do anything to an icon with the perfect size */
pixbuf_width = gdk_pixbuf_get_width (pixbuf_src);
pixbuf_height = gdk_pixbuf_get_height (pixbuf_src);
@@ -119,6 +130,10 @@ asb_app_load_icon (const gchar *filename, const gchar *logfn, GError **error)
/* never scale up, just pad */
if (pixbuf_width < 64 && pixbuf_height < 64) {
+ asb_package_log (pkg,
+ ASB_PACKAGE_LOG_LEVEL_INFO,
+ "icon %s padded to 64x64 as size %ix%i",
+ logfn, pixbuf_width, pixbuf_height);
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, 64, 64);
gdk_pixbuf_fill (pixbuf, 0x00000000);
gdk_pixbuf_copy_area (pixbuf_src,
@@ -164,7 +179,10 @@ asb_app_load_icon (const gchar *filename, const gchar *logfn, GError **error)
* asb_app_find_icon:
*/
static GdkPixbuf *
-asb_app_find_icon (const gchar *tmpdir, const gchar *something, GError **error)
+asb_app_find_icon (AsbPackage *pkg,
+ const gchar *tmpdir,
+ const gchar *something,
+ GError **error)
{
guint i;
guint j;
@@ -198,7 +216,7 @@ asb_app_find_icon (const gchar *tmpdir, const gchar *something, GError **error)
something);
return NULL;
}
- return asb_app_load_icon (tmp, something, error);
+ return asb_app_load_icon (pkg, tmp, something, error);
}
/* hicolor apps */
@@ -212,7 +230,7 @@ asb_app_find_icon (const gchar *tmpdir, const gchar *something, GError **error)
supported_ext[j]);
tmp = g_build_filename (tmpdir, log, NULL);
if (g_file_test (tmp, G_FILE_TEST_EXISTS))
- return asb_app_load_icon (tmp, log, error);
+ return asb_app_load_icon (pkg, tmp, log, error);
}
}
@@ -227,7 +245,7 @@ asb_app_find_icon (const gchar *tmpdir, const gchar *something, GError **error)
supported_ext[j]);
tmp = g_build_filename (tmpdir, log, NULL);
if (g_file_test (tmp, G_FILE_TEST_EXISTS))
- return asb_app_load_icon (tmp, log, error);
+ return asb_app_load_icon (pkg, tmp, log, error);
}
}
@@ -297,7 +315,7 @@ asb_plugin_process_filename (AsbPlugin *plugin,
asb_app_add_veto (app, "Uses ICO icon: %s", key);
/* find icon */
- pixbuf = asb_app_find_icon (tmpdir, key, error);
+ pixbuf = asb_app_find_icon (pkg, tmpdir, key, error);
if (pixbuf == NULL)
return FALSE;