summaryrefslogtreecommitdiff
path: root/libappstream-glib/as-image.c
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-07-03 10:48:34 +0100
committerRichard Hughes <richard@hughsie.com>2014-07-03 10:48:34 +0100
commit3f72cfe0c9fe74fcdec4e5f71ac8ac4cf8610c3f (patch)
tree3175306526d4b94d3b2fab4f78b2c0b29b118fb3 /libappstream-glib/as-image.c
parent31adfccbae977ca7d476e028081c95a780000260 (diff)
downloadappstream-glib-3f72cfe0c9fe74fcdec4e5f71ac8ac4cf8610c3f.tar.gz
Never sharpen or scale images exactly the correct size
Diffstat (limited to 'libappstream-glib/as-image.c')
-rw-r--r--libappstream-glib/as-image.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libappstream-glib/as-image.c b/libappstream-glib/as-image.c
index c2575b3..b810d64 100644
--- a/libappstream-glib/as-image.c
+++ b/libappstream-glib/as-image.c
@@ -515,9 +515,13 @@ as_image_save_pixbuf (AsImage *image,
if (height == 0)
height = gdk_pixbuf_get_height (priv->pixbuf);
- /* never scale up, just pad */
+ /* don't do anything to an image with the correct size */
pixbuf_width = gdk_pixbuf_get_width (priv->pixbuf);
pixbuf_height = gdk_pixbuf_get_height (priv->pixbuf);
+ if (width == pixbuf_width && height == pixbuf_height)
+ return g_object_ref (priv->pixbuf);
+
+ /* never scale up, just pad */
if (pixbuf_width < width && pixbuf_height < height) {
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
TRUE, 8, width, height);