Mercurial > pidgin.yaz
changeset 20042:d1d847810985
Make 200px the upper-bound for buddy icons. Prevents problems when people try using their 7megapixel digital camera images as custom icons. Fixes #105
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Fri, 14 Sep 2007 22:19:09 +0000 |
parents | e98404d74a24 |
children | 4d278e98b5ac 4be39781803b |
files | pidgin/gtkblist.c |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkblist.c Fri Sep 14 21:29:53 2007 +0000 +++ b/pidgin/gtkblist.c Fri Sep 14 22:19:09 2007 +0000 @@ -2264,18 +2264,19 @@ if (prpl_info && prpl_info->icon_spec.scale_rules & PURPLE_ICON_SCALE_DISPLAY) purple_buddy_icon_get_scale_size(&prpl_info->icon_spec, &scale_width, &scale_height); - if (scaled) { + if (scaled || scale_height > 200 || scale_width > 200) { + float scale_size = scaled ? 32.0 : 200.0; if(scale_height > scale_width) { - scale_width = 32.0 * (double)scale_width / (double)scale_height; - scale_height = 32; + scale_width = scale_size * (double)scale_width / (double)scale_height; + scale_height = scale_size; } else { - scale_height = 32.0 * (double)scale_height / (double)scale_width; - scale_width = 32; + scale_height = scale_size * (double)scale_height / (double)scale_width; + scale_width = scale_size; } - ret = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 32, 32); + ret = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, scale_size, scale_size); gdk_pixbuf_fill(ret, 0x00000000); - gdk_pixbuf_scale(buf, ret, (32-scale_width)/2, (32-scale_height)/2, scale_width, scale_height, (32-scale_width)/2, (32-scale_height)/2, (double)scale_width/(double)orig_width, (double)scale_height/(double)orig_height, GDK_INTERP_BILINEAR); + 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); } else {