blob: 422e59351562c25b7cc82d3b37cea8ef5019b0fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
Handle large avatars. http://bugs.gentoo.org/show_bug.cgi?id=265813.
diff -abBU 1 -rP twitux-0.69/src/twitux-app.c twitux-0.69-r1/src/twitux-app.c
--- twitux-0.69/src/twitux-app.c 2009-01-25 01:24:00.000000000 +0000
+++ twitux-0.69-r1/src/twitux-app.c 2009-04-12 00:15:23.000000000 +0100
@@ -68,2 +68,3 @@
#define TYPE_TWITTER "twitter"
+#define MAX_SIZE 73
@@ -1472,4 +1473,20 @@
+ int height, width;
pixbuf = gdk_pixbuf_new_from_file (file, &error);
+ height = gdk_pixbuf_get_height(pixbuf);
+ width = gdk_pixbuf_get_width(pixbuf);
+ if (height > MAX_SIZE || width > MAX_SIZE)
+ {
+ double ratio;
+ GdkPixbuf *scaled;
+
+ ratio = width/(height*1.0);
+ if (ratio >= 1.0) /* width is bigger */
+ scaled = gdk_pixbuf_scale_simple(pixbuf, MAX_SIZE, MAX_SIZE/ratio,GDK_INTERP_BILINEAR);
+ else
+ scaled = gdk_pixbuf_scale_simple(pixbuf, MAX_SIZE*ratio, MAX_SIZE,GDK_INTERP_BILINEAR);
+ g_object_unref(pixbuf);
+ pixbuf = scaled;
+ }
if (!pixbuf){
|