pidgin: 6777479a: scale Subject: im.pidgin.pidgin: 6777479a003186b7b7e2e499eea0522c541b7a37 round the buddy icon in the budd...
nosnilmot at pidgin.im
nosnilmot at pidgin.im
Sun Mar 16 15:00:54 EDT 2008
-----------------------------------------------------------------
Revision: 6777479a003186b7b7e2e499eea0522c541b7a37
Ancestor: 6d7c3abd2d7bce2089371a61f62aa7b22e59f889
Author: nosnilmot at pidgin.im
Date: 2008-03-16T18:55:07
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/6777479a003186b7b7e2e499eea0522c541b7a37
Modified files:
ChangeLog pidgin/gtkblist.c
ChangeLog:
scale & round the buddy icon in the buddy list before making it square, so
rectangular (but non-square) images get rounded corners too. Fixes #2110
-------------- next part --------------
============================================================
--- ChangeLog b11a2e144f4121fdae98a7cc5abd9ed4187c569b
+++ ChangeLog 4b665a6f776c1315d035ad109f16e8431933169f
@@ -24,6 +24,8 @@ version 2.4.1 ():
* 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
============================================================
--- pidgin/gtkblist.c 51d4ecd45a0eb750ef09161369199396b2b1edde
+++ pidgin/gtkblist.c 85d8f8fefcf4e6b9ac48e4c4b359e15506b1af09
@@ -2498,6 +2498,7 @@ static GdkPixbuf *pidgin_blist_get_buddy
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 @@ static GdkPixbuf *pidgin_blist_get_buddy
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);
}
More information about the Commits
mailing list