diff options
-rw-r--r-- | libappstream-glib/as-image.c | 11 | ||||
-rw-r--r-- | libappstream-glib/as-image.h | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/libappstream-glib/as-image.c b/libappstream-glib/as-image.c index f62aef5..6949e71 100644 --- a/libappstream-glib/as-image.c +++ b/libappstream-glib/as-image.c @@ -620,6 +620,17 @@ as_image_load_filename_full (AsImage *image, return TRUE; } + /* this makes icons look blurry, but allows the software center to look + * good as icons are properly aligned in the UI layout */ + if (flags & AS_IMAGE_LOAD_FLAG_ALWAYS_RESIZE) { + pixbuf = gdk_pixbuf_scale_simple (pixbuf_src, + (gint) dest_size, + (gint) dest_size, + GDK_INTERP_HYPER); + as_image_set_pixbuf (image, pixbuf); + return TRUE; + } + /* never scale up, just pad */ if (pixbuf_width < dest_size && pixbuf_height < dest_size) { g_debug ("icon padded to %ux%u as size %ux%u", diff --git a/libappstream-glib/as-image.h b/libappstream-glib/as-image.h index 2ec046f..9f3a3d7 100644 --- a/libappstream-glib/as-image.h +++ b/libappstream-glib/as-image.h @@ -89,6 +89,7 @@ typedef enum { * @AS_IMAGE_LOAD_FLAG_SET_BASENAME: Set the image basename * @AS_IMAGE_LOAD_FLAG_SET_CHECKSUM: Set the image checksum * @AS_IMAGE_LOAD_FLAG_ONLY_SUPPORTED: Only load supported formats like PNG and JPG + * @AS_IMAGE_LOAD_FLAG_ALWAYS_RESIZE: Always resize the source icon to the perfect size * * The flags used for loading images. **/ @@ -98,6 +99,7 @@ typedef enum { AS_IMAGE_LOAD_FLAG_SET_BASENAME = 2, /* Since: 0.5.6 */ AS_IMAGE_LOAD_FLAG_SET_CHECKSUM = 4, /* Since: 0.5.6 */ AS_IMAGE_LOAD_FLAG_ONLY_SUPPORTED = 8, /* Since: 0.5.6 */ + AS_IMAGE_LOAD_FLAG_ALWAYS_RESIZE = 16, /* Since: 0.7.7 */ /*< private >*/ AS_IMAGE_LOAD_FLAG_LAST } AsImageLoadFlags; |