comparison gtk3/dw.c @ 1258:3df86772b625

Updated the list of supported image formats for GTK. This could be generated automatically by querying pixbuf loaders... However it does not take into account formats that support transparency. So for right now we keep using a static list... and include the most popular formats.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 24 Oct 2011 08:30:53 +0000
parents 3a2ffe3a7eae
children 61d0c5f84644
comparison
equal deleted inserted replaced
1257:35b177e8a0a2 1258:3df86772b625
94 }; 94 };
95 95
96 /* 96 /*
97 * List those icons that have transparency first 97 * List those icons that have transparency first
98 */ 98 */
99 #define NUM_EXTS 5 99 #define NUM_EXTS 9
100 char *image_exts[NUM_EXTS] = 100 char *image_exts[NUM_EXTS] =
101 { 101 {
102 ".xpm", 102 ".xpm",
103 ".png", 103 ".png",
104 ".ico", 104 ".ico",
105 ".icns",
106 ".gif",
105 ".jpg", 107 ".jpg",
106 ".bmp", 108 ".jpeg",
109 ".tiff",
110 ".bmp"
107 }; 111 };
108 112
109 #ifndef max 113 #ifndef max
110 # define max(a,b) (((a) > (b)) ? (a) : (b)) 114 # define max(a,b) (((a) > (b)) ? (a) : (b))
111 #endif 115 #endif
4204 DW_MUTEX_LOCK; 4208 DW_MUTEX_LOCK;
4205 if(id) 4209 if(id)
4206 tmp = _find_pixbuf((HICN)id, NULL, NULL); 4210 tmp = _find_pixbuf((HICN)id, NULL, NULL);
4207 else 4211 else
4208 { 4212 {
4209 char *file = alloca(strlen(filename) + 5); 4213 char *file = alloca(strlen(filename) + 6);
4210 4214
4211 if (!file) 4215 if (!file)
4212 { 4216 {
4213 DW_MUTEX_UNLOCK; 4217 DW_MUTEX_UNLOCK;
4214 return; 4218 return;
5622 * (ICO on OS/2 or Windows, XPM on Unix) 5626 * (ICO on OS/2 or Windows, XPM on Unix)
5623 */ 5627 */
5624 HICN API dw_icon_load_from_file(char *filename) 5628 HICN API dw_icon_load_from_file(char *filename)
5625 { 5629 {
5626 int _locked_by_me = FALSE; 5630 int _locked_by_me = FALSE;
5627 char *file = alloca(strlen(filename) + 5); 5631 char *file = alloca(strlen(filename) + 6);
5628 int i, found_ext = 0; 5632 int i, found_ext = 0;
5629 HICN ret = 0; 5633 HICN ret = 0;
5630 5634
5631 if (!file) 5635 if (!file)
5632 return 0; 5636 return 0;
7125 */ 7129 */
7126 HPIXMAP dw_pixmap_new_from_file(HWND handle, char *filename) 7130 HPIXMAP dw_pixmap_new_from_file(HWND handle, char *filename)
7127 { 7131 {
7128 int _locked_by_me = FALSE; 7132 int _locked_by_me = FALSE;
7129 HPIXMAP pixmap; 7133 HPIXMAP pixmap;
7130 char *file = alloca(strlen(filename) + 5); 7134 char *file = alloca(strlen(filename) + 6);
7131 int found_ext = 0; 7135 int found_ext = 0;
7132 int i; 7136 int i;
7133 7137
7134 if (!file || !(pixmap = calloc(1,sizeof(struct _hpixmap)))) 7138 if (!file || !(pixmap = calloc(1,sizeof(struct _hpixmap))))
7135 return NULL; 7139 return NULL;