Thu, 11 Nov 2021 20:12:05 -0600
Ran codespell on the libpurple docs that were converted to gi-docgen
Testing Done:
Ran codespell again.
Reviewed at https://reviews.imfreedom.org/r/1127/
|
39568
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* pidgin |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * source distribution. |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * This program is free software; you can redistribute it and/or modify |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * it under the terms of the GNU General Public License as published by |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * the Free Software Foundation; either version 2 of the License, or |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * (at your option) any later version. |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * This program is distributed in the hope that it will be useful, |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * GNU General Public License for more details. |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * You should have received a copy of the GNU General Public License |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * along with this program; if not, write to the Free Software |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | */ |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | #include "pidgin/pidgingdkpixbuf.h" |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | GdkPixbuf * |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | pidgin_gdk_pixbuf_new_from_image(PurpleImage *image, GError **error) { |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | GdkPixbufLoader *loader = NULL; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | GdkPixbuf *pixbuf = NULL; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | GBytes *data = NULL; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | gboolean success = FALSE; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | g_return_val_if_fail(PURPLE_IS_IMAGE(image), NULL); |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | data = purple_image_get_contents(image); |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | success = gdk_pixbuf_loader_write_bytes(loader, data, error); |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | g_bytes_unref(data); |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | if(success) { |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | if(error != NULL && *error != NULL) { |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | g_object_unref(G_OBJECT(loader)); |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | return NULL; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | } |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | if(gdk_pixbuf_loader_close(loader, error)) { |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | pixbuf = gdk_pixbuf_loader_get_pixbuf(loader); |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | if(pixbuf != NULL) { |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | pixbuf = g_object_ref(pixbuf); |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | } |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | } |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | g_object_unref(G_OBJECT(loader)); |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | } |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | return pixbuf; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | } |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | void pidgin_gdk_pixbuf_make_round(GdkPixbuf *pixbuf) { |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | gint width, height, rowstride; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | guchar *pixels; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | if (!gdk_pixbuf_get_has_alpha(pixbuf)) { |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | return; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | } |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | width = gdk_pixbuf_get_width(pixbuf); |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | height = gdk_pixbuf_get_height(pixbuf); |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | rowstride = gdk_pixbuf_get_rowstride(pixbuf); |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | pixels = gdk_pixbuf_get_pixels(pixbuf); |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | |
|
39571
b88f466a4a4d
Add some missing braces and fix some errant spaces
Gary Kramlich <grim@reaperworld.com>
parents:
39568
diff
changeset
|
70 | if (width < 6 || height < 6) { |
|
39568
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | return; |
|
39571
b88f466a4a4d
Add some missing braces and fix some errant spaces
Gary Kramlich <grim@reaperworld.com>
parents:
39568
diff
changeset
|
72 | } |
|
39568
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | |
|
41086
631e6cba8635
Fix typos in Pidgin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39571
diff
changeset
|
74 | /* The following code will convert the alpha of the pixel data in all |
|
39568
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | * corners to look something like the following diagram. |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | * |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | * 00 80 c0 FF FF c0 80 00 |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | * 80 FF FF FF FF FF FF 80 |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | * c0 FF FF FF FF FF FF c0 |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | * FF FF FF FF FF FF FF FF |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | * FF FF FF FF FF FF FF FF |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | * c0 FF FF FF FF FF FF c0 |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | * 80 FF FF FF FF FF FF 80 |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | * 00 80 c0 FF FF c0 80 00 |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | */ |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | /* Top left */ |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | pixels[3] = 0; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | pixels[7] = 0x80; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | pixels[11] = 0xC0; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | pixels[rowstride + 3] = 0x80; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | pixels[rowstride * 2 + 3] = 0xC0; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | /* Top right */ |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | pixels[width * 4 - 1] = 0; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | pixels[width * 4 - 5] = 0x80; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | pixels[width * 4 - 9] = 0xC0; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | pixels[rowstride + (width * 4) - 1] = 0x80; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | pixels[(2 * rowstride) + (width * 4) - 1] = 0xC0; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | /* Bottom left */ |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | pixels[(height - 1) * rowstride + 3] = 0; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | pixels[(height - 1) * rowstride + 7] = 0x80; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | pixels[(height - 1) * rowstride + 11] = 0xC0; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | pixels[(height - 2) * rowstride + 3] = 0x80; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | pixels[(height - 3) * rowstride + 3] = 0xC0; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | /* Bottom right */ |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | pixels[height * rowstride - 1] = 0; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | pixels[(height - 1) * rowstride - 1] = 0x80; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | pixels[(height - 2) * rowstride - 1] = 0xC0; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | pixels[height * rowstride - 5] = 0x80; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | pixels[height * rowstride - 9] = 0xC0; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | } |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | gboolean |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | pidgin_gdk_pixbuf_is_opaque(GdkPixbuf *pixbuf) { |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | gint height, rowstride, i; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | guchar *pixels; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | guchar *row; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | |
|
39571
b88f466a4a4d
Add some missing braces and fix some errant spaces
Gary Kramlich <grim@reaperworld.com>
parents:
39568
diff
changeset
|
122 | if (!gdk_pixbuf_get_has_alpha(pixbuf)) { |
|
39568
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | return TRUE; |
|
39571
b88f466a4a4d
Add some missing braces and fix some errant spaces
Gary Kramlich <grim@reaperworld.com>
parents:
39568
diff
changeset
|
124 | } |
|
39568
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | height = gdk_pixbuf_get_height (pixbuf); |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | rowstride = gdk_pixbuf_get_rowstride (pixbuf); |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | pixels = gdk_pixbuf_get_pixels (pixbuf); |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | /* check the top row */ |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | row = pixels; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | for (i = 3; i < rowstride; i+=4) { |
|
39571
b88f466a4a4d
Add some missing braces and fix some errant spaces
Gary Kramlich <grim@reaperworld.com>
parents:
39568
diff
changeset
|
133 | if (row[i] < 0xfe) { |
|
39568
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | return FALSE; |
|
39571
b88f466a4a4d
Add some missing braces and fix some errant spaces
Gary Kramlich <grim@reaperworld.com>
parents:
39568
diff
changeset
|
135 | } |
|
39568
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | } |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | /* check the left and right sides */ |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | for (i = 1; i < height - 1; i++) { |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | row = pixels + (i * rowstride); |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | if (row[3] < 0xfe || row[rowstride - 1] < 0xfe) { |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | return FALSE; |
|
39571
b88f466a4a4d
Add some missing braces and fix some errant spaces
Gary Kramlich <grim@reaperworld.com>
parents:
39568
diff
changeset
|
143 | } |
|
39568
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | } |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | /* check the bottom */ |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | row = pixels + ((height - 1) * rowstride); |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | for (i = 3; i < rowstride; i += 4) { |
|
39571
b88f466a4a4d
Add some missing braces and fix some errant spaces
Gary Kramlich <grim@reaperworld.com>
parents:
39568
diff
changeset
|
149 | if (row[i] < 0xfe) { |
|
39568
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | return FALSE; |
|
39571
b88f466a4a4d
Add some missing braces and fix some errant spaces
Gary Kramlich <grim@reaperworld.com>
parents:
39568
diff
changeset
|
151 | } |
|
39568
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | } |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | return TRUE; |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | } |
|
f4714f1de6d0
Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | |
|
41144
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
157 | static GObject *pidgin_pixbuf_from_data_helper(const guchar *buf, gsize count, gboolean animated) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
158 | { |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
159 | GObject *pixbuf; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
160 | GdkPixbufLoader *loader; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
161 | GError *error = NULL; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
162 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
163 | loader = gdk_pixbuf_loader_new(); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
164 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
165 | if (!gdk_pixbuf_loader_write(loader, buf, count, &error) || error) { |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
166 | purple_debug_warning("gtkutils", "gdk_pixbuf_loader_write() " |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
167 | "failed with size=%" G_GSIZE_FORMAT ": %s\n", count, |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
168 | error ? error->message : "(no error message)"); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
169 | if (error) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
170 | g_error_free(error); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
171 | g_object_unref(G_OBJECT(loader)); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
172 | return NULL; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
173 | } |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
174 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
175 | if (!gdk_pixbuf_loader_close(loader, &error) || error) { |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
176 | purple_debug_warning("gtkutils", "gdk_pixbuf_loader_close() " |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
177 | "failed for image of size %" G_GSIZE_FORMAT ": %s\n", count, |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
178 | error ? error->message : "(no error message)"); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
179 | if (error) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
180 | g_error_free(error); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
181 | g_object_unref(G_OBJECT(loader)); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
182 | return NULL; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
183 | } |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
184 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
185 | if (animated) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
186 | pixbuf = G_OBJECT(gdk_pixbuf_loader_get_animation(loader)); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
187 | else |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
188 | pixbuf = G_OBJECT(gdk_pixbuf_loader_get_pixbuf(loader)); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
189 | if (!pixbuf) { |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
190 | purple_debug_warning("gtkutils", "%s() returned NULL for image " |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
191 | "of size %" G_GSIZE_FORMAT "\n", |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
192 | animated ? "gdk_pixbuf_loader_get_animation" |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
193 | : "gdk_pixbuf_loader_get_pixbuf", count); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
194 | g_object_unref(G_OBJECT(loader)); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
195 | return NULL; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
196 | } |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
197 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
198 | g_object_ref(pixbuf); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
199 | g_object_unref(G_OBJECT(loader)); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
200 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
201 | return pixbuf; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
202 | } |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
203 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
204 | GdkPixbuf *pidgin_pixbuf_from_data(const guchar *buf, gsize count) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
205 | { |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
206 | return GDK_PIXBUF(pidgin_pixbuf_from_data_helper(buf, count, FALSE)); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
207 | } |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
208 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
209 | GdkPixbufAnimation *pidgin_pixbuf_anim_from_data(const guchar *buf, gsize count) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
210 | { |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
211 | return GDK_PIXBUF_ANIMATION(pidgin_pixbuf_from_data_helper(buf, count, TRUE)); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
212 | } |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
213 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
214 | GdkPixbuf * |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
215 | pidgin_pixbuf_from_image(PurpleImage *image) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
216 | { |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
217 | return pidgin_pixbuf_from_data(purple_image_get_data(image), |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
218 | purple_image_get_data_size(image)); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
219 | } |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
220 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
221 | GdkPixbuf *pidgin_pixbuf_new_from_file(const gchar *filename) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
222 | { |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
223 | GdkPixbuf *pixbuf; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
224 | GError *error = NULL; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
225 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
226 | g_return_val_if_fail(filename != NULL, NULL); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
227 | g_return_val_if_fail(filename[0] != '\0', NULL); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
228 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
229 | pixbuf = gdk_pixbuf_new_from_file(filename, &error); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
230 | if (!pixbuf || error) { |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
231 | purple_debug_warning("gtkutils", "gdk_pixbuf_new_from_file() " |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
232 | "returned %s for file %s: %s\n", |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
233 | pixbuf ? "something" : "nothing", |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
234 | filename, |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
235 | error ? error->message : "(no error message)"); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
236 | if (error) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
237 | g_error_free(error); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
238 | if (pixbuf) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
239 | g_object_unref(G_OBJECT(pixbuf)); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
240 | return NULL; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
241 | } |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
242 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
243 | return pixbuf; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
244 | } |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
245 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
246 | GdkPixbuf *pidgin_pixbuf_new_from_file_at_size(const char *filename, int width, int height) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
247 | { |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
248 | GdkPixbuf *pixbuf; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
249 | GError *error = NULL; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
250 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
251 | g_return_val_if_fail(filename != NULL, NULL); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
252 | g_return_val_if_fail(filename[0] != '\0', NULL); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
253 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
254 | pixbuf = gdk_pixbuf_new_from_file_at_size(filename, |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
255 | width, height, &error); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
256 | if (!pixbuf || error) { |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
257 | purple_debug_warning("gtkutils", "gdk_pixbuf_new_from_file_at_size() " |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
258 | "returned %s for file %s: %s\n", |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
259 | pixbuf ? "something" : "nothing", |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
260 | filename, |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
261 | error ? error->message : "(no error message)"); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
262 | if (error) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
263 | g_error_free(error); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
264 | if (pixbuf) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
265 | g_object_unref(G_OBJECT(pixbuf)); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
266 | return NULL; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
267 | } |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
268 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
269 | return pixbuf; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
270 | } |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
271 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
272 | GdkPixbuf *pidgin_pixbuf_new_from_file_at_scale(const char *filename, int width, int height, gboolean preserve_aspect_ratio) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
273 | { |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
274 | GdkPixbuf *pixbuf; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
275 | GError *error = NULL; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
276 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
277 | g_return_val_if_fail(filename != NULL, NULL); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
278 | g_return_val_if_fail(filename[0] != '\0', NULL); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
279 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
280 | pixbuf = gdk_pixbuf_new_from_file_at_scale(filename, |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
281 | width, height, preserve_aspect_ratio, &error); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
282 | if (!pixbuf || error) { |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
283 | purple_debug_warning("gtkutils", "gdk_pixbuf_new_from_file_at_scale() " |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
284 | "returned %s for file %s: %s\n", |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
285 | pixbuf ? "something" : "nothing", |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
286 | filename, |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
287 | error ? error->message : "(no error message)"); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
288 | if (error) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
289 | g_error_free(error); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
290 | if (pixbuf) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
291 | g_object_unref(G_OBJECT(pixbuf)); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
292 | return NULL; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
293 | } |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
294 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
295 | return pixbuf; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
296 | } |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
297 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
298 | GdkPixbuf * |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
299 | pidgin_pixbuf_scale_down(GdkPixbuf *src, guint max_width, guint max_height, |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
300 | GdkInterpType interp_type, gboolean preserve_ratio) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
301 | { |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
302 | guint cur_w, cur_h; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
303 | GdkPixbuf *dst; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
304 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
305 | g_return_val_if_fail(src != NULL, NULL); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
306 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
307 | if (max_width == 0 || max_height == 0) { |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
308 | g_object_unref(src); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
309 | g_return_val_if_reached(NULL); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
310 | } |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
311 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
312 | cur_w = gdk_pixbuf_get_width(src); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
313 | cur_h = gdk_pixbuf_get_height(src); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
314 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
315 | if (cur_w <= max_width && cur_h <= max_height) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
316 | return src; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
317 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
318 | /* cur_ratio = cur_w / cur_h |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
319 | * max_ratio = max_w / max_h |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
320 | */ |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
321 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
322 | if (!preserve_ratio) { |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
323 | cur_w = MIN(cur_w, max_width); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
324 | cur_h = MIN(cur_h, max_height); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
325 | } else if ((guint64)cur_w * max_height > (guint64)max_width * cur_h) { |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
326 | /* cur_w / cur_h > max_width / max_height */ |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
327 | cur_h = (guint64)max_width * cur_h / cur_w; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
328 | cur_w = max_width; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
329 | } else { |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
330 | cur_w = (guint64)max_height * cur_w / cur_h; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
331 | cur_h = max_height; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
332 | } |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
333 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
334 | if (cur_w <= 0) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
335 | cur_w = 1; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
336 | if (cur_h <= 0) |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
337 | cur_h = 1; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
338 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
339 | dst = gdk_pixbuf_scale_simple(src, cur_w, cur_h, interp_type); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
340 | g_object_unref(src); |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
341 | |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
342 | return dst; |
|
910bdda75c74
Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
343 | } |