changeset 22476:b5af505a7b02

merge of '0caa39824f21f7f7dd7abf1462fbc769730120de' and '6777479a003186b7b7e2e499eea0522c541b7a37'
author Mark Doliner <mark@kingant.net>
date Sun, 16 Mar 2008 20:37:49 +0000
parents 3225c99785b8 (current diff) ed786719b10a (diff)
children 82c4e6b589d0 f54a1f4f2963
files
diffstat 2 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Mar 16 20:36:52 2008 +0000
+++ b/ChangeLog	Sun Mar 16 20:37:49 2008 +0000
@@ -24,6 +24,8 @@
 	* Fix for displaying channel & buddy names in conversation window when
 	  they have '&' in them
 	* Some memory leak fixes, especially in the Text Replacement plugin
+	* Rectangular but non-square buddy icons have rounded corners in the buddy
+	  list
 
 	Finch:
 	* Fix compiling with Glib older than 2.6
--- a/pidgin/gtkblist.c	Sun Mar 16 20:36:52 2008 +0000
+++ b/pidgin/gtkblist.c	Sun Mar 16 20:37:49 2008 +0000
@@ -2498,6 +2498,7 @@
 			purple_buddy_icon_get_scale_size(&prpl_info->icon_spec, &scale_width, &scale_height);
 
 		if (scaled || scale_height > 200 || scale_width > 200) {
+			GdkPixbuf *tmpbuf;
 			float scale_size = scaled ? 32.0 : 200.0;
 			if(scale_height > scale_width) {
 				scale_width = scale_size * (double)scale_width / (double)scale_height;
@@ -2506,12 +2507,17 @@
 				scale_height = scale_size * (double)scale_height / (double)scale_width;
 				scale_width = scale_size;
 			}
-
+			/* scale & round before making square, so rectangular (but non-square)
+			 * images get rounded corners too */
+			tmpbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, scale_width, scale_height);
+			gdk_pixbuf_fill(tmpbuf, 0x00000000);
+			gdk_pixbuf_scale(buf, tmpbuf, 0, 0, scale_width, scale_height, 0, 0, (double)scale_width/(double)orig_width, (double)scale_height/(double)orig_height, GDK_INTERP_BILINEAR);
+			if (pidgin_gdk_pixbuf_is_opaque(tmpbuf))
+				pidgin_gdk_pixbuf_make_round(tmpbuf);
 			ret = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, scale_size, scale_size);
 			gdk_pixbuf_fill(ret, 0x00000000);
-			gdk_pixbuf_scale(buf, ret, (scale_size-scale_width)/2, (scale_size-scale_height)/2, scale_width, scale_height, (scale_size-scale_width)/2, (scale_size-scale_height)/2, (double)scale_width/(double)orig_width, (double)scale_height/(double)orig_height, GDK_INTERP_BILINEAR);
-			if (pidgin_gdk_pixbuf_is_opaque(ret))
-				pidgin_gdk_pixbuf_make_round(ret);
+			gdk_pixbuf_copy_area(tmpbuf, 0, 0, scale_width, scale_height, ret, (scale_size-scale_width)/2, (scale_size-scale_height)/2);
+			g_object_unref(G_OBJECT(tmpbuf));
 		} else {
 			ret = gdk_pixbuf_scale_simple(buf,scale_width,scale_height, GDK_INTERP_BILINEAR);
 		}