changeset 28241:a6cfb7bf8c88

Only scale down larger smileys (more than 22 px width or height) in the smiley manager. This avoids getting smaller smileys being blurry. Refs #7140
author Marcus Lundblad <ml@update.uu.se>
date Mon, 07 Sep 2009 19:22:32 +0000
parents 60ab4bdea3c3
children f200f7628962
files pidgin/gtksmiley.c
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtksmiley.c	Sun Sep 06 01:46:42 2009 +0000
+++ b/pidgin/gtksmiley.c	Mon Sep 07 19:22:32 2009 +0000
@@ -601,10 +601,17 @@
 		GdkPixbuf *smiley_image = pidgin_pixbuf_from_imgstore(img);
 		purple_imgstore_unref(img);
 
-		if (smiley_image != NULL)
-			sized_smiley = gdk_pixbuf_scale_simple(smiley_image,
+		if (smiley_image != NULL) {
+			if (gdk_pixbuf_get_width(smiley_image) > 22 ||
+				gdk_pixbuf_get_height(smiley_image) > 22) {
+				sized_smiley = gdk_pixbuf_scale_simple(smiley_image,
 					22, 22, GDK_INTERP_HYPER);
-		g_object_unref(G_OBJECT(smiley_image));
+				g_object_unref(G_OBJECT(smiley_image));
+			} else {
+				/* don't scale up smaller smileys, avoid blurryness */
+				sized_smiley = smiley_image;
+			}
+		}
 	}