4 * Copyright (C) 2008 - 2010 The Geeqie Team
8 * This software is released under the GNU General Public License (GNU GPL).
9 * Please read the included file COPYING for more information.
10 * This software comes with no warranty of any kind, use at your own risk!
15 #include "image-load.h"
16 #include "image_load_gdk.h"
17 #include "image_load_jpeg.h"
18 #include "image_load_tiff.h"
22 #include "ui_fileops.h"
23 #include "gq-marshal.h"
28 #define IMAGE_LOADER_READ_BUFFER_SIZE_DEFAULT 4096
29 #define IMAGE_LOADER_IDLE_READ_LOOP_COUNT_DEFAULT 1
32 /**************************************************************************************/
33 /* image loader class */
37 SIGNAL_AREA_READY = 0,
45 static guint signals[SIGNAL_COUNT] = { 0 };
47 static void image_loader_init(GTypeInstance *instance, gpointer g_class);
48 static void image_loader_class_init(ImageLoaderClass *class);
49 static void image_loader_finalize(GObject *object);
50 static void image_loader_stop(ImageLoader *il);
52 GType image_loader_get_type(void)
54 static GType type = 0;
57 static const GTypeInfo info = {
58 sizeof(ImageLoaderClass),
60 NULL, /* base_finalize */
61 (GClassInitFunc)image_loader_class_init, /* class_init */
62 NULL, /* class_finalize */
63 NULL, /* class_data */
66 (GInstanceInitFunc)image_loader_init, /* instance_init */
67 NULL /* value_table */
69 type = g_type_register_static(G_TYPE_OBJECT, "ImageLoaderType", &info, 0);
74 static void image_loader_init(GTypeInstance *instance, gpointer g_class)
76 ImageLoader *il = (ImageLoader *)instance;
80 il->idle_priority = G_PRIORITY_DEFAULT_IDLE;
89 il->idle_read_loop_count = IMAGE_LOADER_IDLE_READ_LOOP_COUNT_DEFAULT;
90 il->read_buffer_size = IMAGE_LOADER_READ_BUFFER_SIZE_DEFAULT;
91 il->mapped_file = NULL;
93 il->requested_width = 0;
94 il->requested_height = 0;
97 il->can_destroy = TRUE;
100 il->data_mutex = g_mutex_new();
101 il->can_destroy_cond = g_cond_new();
103 DEBUG_1("new image loader %p, bufsize=%" G_GSIZE_FORMAT " idle_loop=%u", il, il->read_buffer_size, il->idle_read_loop_count);
106 static void image_loader_class_init(ImageLoaderClass *class)
108 GObjectClass *gobject_class = G_OBJECT_CLASS (class);
110 // gobject_class->set_property = image_loader_set_property;
111 // gobject_class->get_property = image_loader_get_property;
113 gobject_class->finalize = image_loader_finalize;
116 signals[SIGNAL_AREA_READY] =
117 g_signal_new("area_ready",
118 G_OBJECT_CLASS_TYPE(gobject_class),
120 G_STRUCT_OFFSET(ImageLoaderClass, area_ready),
122 gq_marshal_VOID__INT_INT_INT_INT,
129 signals[SIGNAL_ERROR] =
130 g_signal_new("error",
131 G_OBJECT_CLASS_TYPE(gobject_class),
133 G_STRUCT_OFFSET(ImageLoaderClass, error),
135 g_cclosure_marshal_VOID__VOID,
138 signals[SIGNAL_DONE] =
140 G_OBJECT_CLASS_TYPE(gobject_class),
142 G_STRUCT_OFFSET(ImageLoaderClass, done),
144 g_cclosure_marshal_VOID__VOID,
147 signals[SIGNAL_PERCENT] =
148 g_signal_new("percent",
149 G_OBJECT_CLASS_TYPE(gobject_class),
151 G_STRUCT_OFFSET(ImageLoaderClass, percent),
153 g_cclosure_marshal_VOID__DOUBLE,
157 signals[SIGNAL_SIZE] =
158 g_signal_new("size_prepared",
159 G_OBJECT_CLASS_TYPE(gobject_class),
161 G_STRUCT_OFFSET(ImageLoaderClass, area_ready),
163 gq_marshal_VOID__INT_INT,
170 static void image_loader_finalize(GObject *object)
172 ImageLoader *il = (ImageLoader *)object;
174 image_loader_stop(il);
176 if (il->error) DEBUG_1("%s", image_loader_get_error(il));
178 DEBUG_1("freeing image loader %p bytes_read=%" G_GSIZE_FORMAT, il, il->bytes_read);
180 if (il->idle_done_id)
182 g_source_remove(il->idle_done_id);
183 il->idle_done_id = 0;
186 while (g_source_remove_by_user_data(il))
188 DEBUG_2("pending signals detected");
191 while (il->area_param_list)
193 DEBUG_1("pending area_ready signals detected");
194 while (g_source_remove_by_user_data(il->area_param_list->data)) {}
195 g_free(il->area_param_list->data);
196 il->area_param_list = g_list_delete_link(il->area_param_list, il->area_param_list);
199 while (il->area_param_delayed_list)
201 g_free(il->area_param_delayed_list->data);
202 il->area_param_delayed_list = g_list_delete_link(il->area_param_delayed_list, il->area_param_delayed_list);
205 if (il->pixbuf) g_object_unref(il->pixbuf);
207 if (il->error) g_error_free(il->error);
209 file_data_unref(il->fd);
211 g_mutex_free(il->data_mutex);
212 g_cond_free(il->can_destroy_cond);
216 void image_loader_free(ImageLoader *il)
219 g_object_unref(G_OBJECT(il));
223 ImageLoader *image_loader_new(FileData *fd)
227 if (!fd) return NULL;
229 il = (ImageLoader *) g_object_new(TYPE_IMAGE_LOADER, NULL);
231 il->fd = file_data_ref(fd);
236 /**************************************************************************************/
237 /* send signals via idle calbacks - the callback are executed in the main thread */
239 typedef struct _ImageLoaderAreaParam ImageLoaderAreaParam;
240 struct _ImageLoaderAreaParam {
249 static gboolean image_loader_emit_area_ready_cb(gpointer data)
251 ImageLoaderAreaParam *par = data;
252 ImageLoader *il = par->il;
253 g_signal_emit(il, signals[SIGNAL_AREA_READY], 0, par->x, par->y, par->w, par->h);
254 g_mutex_lock(il->data_mutex);
255 il->area_param_list = g_list_remove(il->area_param_list, par);
257 g_mutex_unlock(il->data_mutex);
262 static gboolean image_loader_emit_done_cb(gpointer data)
264 ImageLoader *il = data;
265 g_signal_emit(il, signals[SIGNAL_DONE], 0);
269 static gboolean image_loader_emit_error_cb(gpointer data)
271 ImageLoader *il = data;
272 g_signal_emit(il, signals[SIGNAL_ERROR], 0);
276 static gboolean image_loader_emit_percent_cb(gpointer data)
278 ImageLoader *il = data;
279 g_signal_emit(il, signals[SIGNAL_PERCENT], 0, image_loader_get_percent(il));
283 /* DONE and ERROR are emited only once, thus they can have normal priority
284 PERCENT and AREA_READY should be processed ASAP
287 static void image_loader_emit_done(ImageLoader *il)
289 g_idle_add_full(il->idle_priority, image_loader_emit_done_cb, il, NULL);
292 static void image_loader_emit_error(ImageLoader *il)
294 g_idle_add_full(il->idle_priority, image_loader_emit_error_cb, il, NULL);
297 static void image_loader_emit_percent(ImageLoader *il)
299 g_idle_add_full(G_PRIORITY_HIGH, image_loader_emit_percent_cb, il, NULL);
302 /* this function expects that il->data_mutex is locked by caller */
303 static void image_loader_emit_area_ready(ImageLoader *il, guint x, guint y, guint w, guint h)
305 ImageLoaderAreaParam *par = g_new0(ImageLoaderAreaParam, 1);
312 il->area_param_list = g_list_prepend(il->area_param_list, par);
314 g_idle_add_full(G_PRIORITY_HIGH, image_loader_emit_area_ready_cb, par, NULL);
317 /**************************************************************************************/
318 /* the following functions may be executed in separate thread */
320 /* this function expects that il->data_mutex is locked by caller */
321 static void image_loader_queue_delayed_area_ready(ImageLoader *il, guint x, guint y, guint w, guint h)
323 ImageLoaderAreaParam *par = g_new0(ImageLoaderAreaParam, 1);
330 il->area_param_delayed_list = g_list_prepend(il->area_param_delayed_list, par);
335 static gboolean image_loader_get_stopping(ImageLoader *il)
338 if (!il) return FALSE;
340 g_mutex_lock(il->data_mutex);
342 g_mutex_unlock(il->data_mutex);
348 static void image_loader_sync_pixbuf(ImageLoader *il)
352 g_mutex_lock(il->data_mutex);
356 g_mutex_unlock(il->data_mutex);
360 pb = il->backend.get_pixbuf(il->loader);
362 if (pb == il->pixbuf)
364 g_mutex_unlock(il->data_mutex);
368 if (g_ascii_strcasecmp(".jps", il->fd->extension) == 0)
370 g_object_set_data(G_OBJECT(pb), "stereo_data", GINT_TO_POINTER(STEREO_PIXBUF_CROSS));
373 if (il->pixbuf) g_object_unref(il->pixbuf);
376 if (il->pixbuf) g_object_ref(il->pixbuf);
378 g_mutex_unlock(il->data_mutex);
381 static void image_loader_area_updated_cb(gpointer loader,
382 guint x, guint y, guint w, guint h,
385 ImageLoader *il = data;
387 if (!image_loader_get_pixbuf(il))
389 image_loader_sync_pixbuf(il);
390 if (!image_loader_get_pixbuf(il))
392 log_printf("critical: area_ready signal with NULL pixbuf (out of mem?)\n");
396 g_mutex_lock(il->data_mutex);
397 if (il->delay_area_ready)
398 image_loader_queue_delayed_area_ready(il, x, y, w, h);
400 image_loader_emit_area_ready(il, x, y, w, h);
402 if (il->stopping) il->backend.abort(il->loader);
404 g_mutex_unlock(il->data_mutex);
407 static void image_loader_area_prepared_cb(gpointer loader, gpointer data)
409 ImageLoader *il = data;
415 http://bugzilla.gnome.org/show_bug.cgi?id=547669
416 http://bugzilla.gnome.org/show_bug.cgi?id=589334
418 gchar *format = il->backend.get_format_name(loader);
419 if (strcmp(format, "svg") == 0 ||
420 strcmp(format, "xpm") == 0)
428 pb = il->backend.get_pixbuf(loader);
430 h = gdk_pixbuf_get_height(pb);
431 rs = gdk_pixbuf_get_rowstride(pb);
432 pix = gdk_pixbuf_get_pixels(pb);
434 memset(pix, 0, rs * h); /*this should be faster than pixbuf_fill */
438 static void image_loader_size_cb(gpointer loader,
439 gint width, gint height, gpointer data)
441 ImageLoader *il = data;
443 gboolean scale = FALSE;
446 g_mutex_lock(il->data_mutex);
447 if (il->requested_width < 1 || il->requested_height < 1)
449 g_mutex_unlock(il->data_mutex);
450 g_signal_emit(il, signals[SIGNAL_SIZE], 0, width, height);
453 g_mutex_unlock(il->data_mutex);
455 mime_types = il->backend.get_format_mime_types(loader);
457 while (mime_types[n])
459 if (strstr(mime_types[n], "jpeg")) scale = TRUE;
462 g_strfreev(mime_types);
466 g_signal_emit(il, signals[SIGNAL_SIZE], 0, width, height);
470 g_mutex_lock(il->data_mutex);
473 if (width > il->requested_width || height > il->requested_height)
476 if (((gdouble)il->requested_width / width) < ((gdouble)il->requested_height / height))
478 nw = il->requested_width;
479 nh = (gdouble)nw / width * height;
484 nh = il->requested_height;
485 nw = (gdouble)nh / height * width;
489 il->backend.set_size(loader, nw, nh);
492 g_mutex_unlock(il->data_mutex);
494 g_signal_emit(il, signals[SIGNAL_SIZE], 0, nw, nh);
497 static void image_loader_stop_loader(ImageLoader *il)
503 /* some loaders do not have a pixbuf till close, order is important here */
504 il->backend.close(il->loader, il->error ? NULL : &il->error); /* we are interested in the first error only */
505 image_loader_sync_pixbuf(il);
506 il->backend.free(il->loader);
509 g_mutex_lock(il->data_mutex);
511 g_mutex_unlock(il->data_mutex);
514 static void image_loader_setup_loader(ImageLoader *il)
516 g_mutex_lock(il->data_mutex);
518 if (il->bytes_total >= 2 && il->mapped_file[0] == 0xff && il->mapped_file[1] == 0xd8)
520 DEBUG_1("Using custom jpeg loader");
521 image_loader_backend_set_jpeg(&il->backend);
526 if (il->bytes_total >= 10 &&
527 (memcmp(il->mapped_file, "MM\0*", 4) == 0 ||
528 memcmp(il->mapped_file, "II*\0", 4) == 0))
530 DEBUG_1("Using custom tiff loader");
531 image_loader_backend_set_tiff(&il->backend);
535 image_loader_backend_set_default(&il->backend);
537 il->loader = il->backend.loader_new(image_loader_area_updated_cb, image_loader_size_cb, image_loader_area_prepared_cb, il);
538 g_mutex_unlock(il->data_mutex);
542 static void image_loader_done(ImageLoader *il)
544 image_loader_stop_loader(il);
546 image_loader_emit_done(il);
549 static void image_loader_error(ImageLoader *il)
551 image_loader_stop_loader(il);
553 DEBUG_1("pixbuf_loader reported load error for: %s", il->fd->path);
555 image_loader_emit_error(il);
558 static gboolean image_loader_continue(ImageLoader *il)
563 if (!il) return FALSE;
565 c = il->idle_read_loop_count ? il->idle_read_loop_count : 1;
566 while (c > 0 && !image_loader_get_stopping(il))
568 b = MIN(il->read_buffer_size, il->bytes_total - il->bytes_read);
572 image_loader_done(il);
576 if (b < 0 || (b > 0 && !il->backend.write(il->loader, il->mapped_file + il->bytes_read, b, &il->error)))
578 image_loader_error(il);
587 if (il->bytes_total > 0)
589 image_loader_emit_percent(il);
595 static gboolean image_loader_begin(ImageLoader *il)
599 if (il->pixbuf) return FALSE;
601 b = MIN(il->read_buffer_size, il->bytes_total - il->bytes_read);
602 if (b < 1) return FALSE;
604 image_loader_setup_loader(il);
606 g_assert(il->bytes_read == 0);
607 if (il->backend.load) {
609 if (!il->backend.load(il->loader, il->mapped_file, b, &il->error))
611 image_loader_stop_loader(il);
615 else if (!il->backend.write(il->loader, il->mapped_file, b, &il->error))
617 image_loader_stop_loader(il);
623 /* read until size is known */
624 while (il->loader && !il->backend.get_pixbuf(il->loader) && b > 0 && !image_loader_get_stopping(il))
626 b = MIN(il->read_buffer_size, il->bytes_total - il->bytes_read);
627 if (b < 0 || (b > 0 && !il->backend.write(il->loader, il->mapped_file + il->bytes_read, b, &il->error)))
629 image_loader_stop_loader(il);
634 if (!il->pixbuf) image_loader_sync_pixbuf(il);
636 if (il->bytes_read == il->bytes_total || b < 1)
638 /* done, handle (broken) loaders that do not have pixbuf till close */
639 image_loader_stop_loader(il);
641 if (!il->pixbuf) return FALSE;
643 image_loader_done(il);
649 image_loader_stop_loader(il);
656 /**************************************************************************************/
657 /* the following functions are always executed in the main thread */
660 static gboolean image_loader_setup_source(ImageLoader *il)
665 if (!il || il->loader || il->mapped_file) return FALSE;
667 il->mapped_file = NULL;
671 ExifData *exif = exif_read_fd(il->fd);
673 if (options->thumbnails.use_exif)
674 il->mapped_file = exif_get_preview(exif, (guint *)&il->bytes_total, il->requested_width, il->requested_height);
676 il->mapped_file = exif_get_preview(exif, (guint *)&il->bytes_total, 0, 0); /* get the largest available preview image or NULL for normal images*/
681 DEBUG_1("Usable reduced size (preview) image loaded from file %s", il->fd->path);
683 exif_free_fd(il->fd, exif);
687 if (!il->mapped_file)
692 pathl = path_from_utf8(il->fd->path);
693 load_fd = open(pathl, O_RDONLY | O_NONBLOCK);
695 if (load_fd == -1) return FALSE;
697 if (fstat(load_fd, &st) == 0)
699 il->bytes_total = st.st_size;
707 il->mapped_file = mmap(0, il->bytes_total, PROT_READ|PROT_WRITE, MAP_PRIVATE, load_fd, 0);
709 if (il->mapped_file == MAP_FAILED)
720 static void image_loader_stop_source(ImageLoader *il)
728 exif_free_preview(il->mapped_file);
732 munmap(il->mapped_file, il->bytes_total);
734 il->mapped_file = NULL;
738 static void image_loader_stop(ImageLoader *il)
744 g_source_remove(il->idle_id);
750 /* stop loader in the other thread */
751 g_mutex_lock(il->data_mutex);
753 while (!il->can_destroy) g_cond_wait(il->can_destroy_cond, il->data_mutex);
754 g_mutex_unlock(il->data_mutex);
757 image_loader_stop_loader(il);
758 image_loader_stop_source(il);
762 void image_loader_delay_area_ready(ImageLoader *il, gboolean enable)
764 g_mutex_lock(il->data_mutex);
765 il->delay_area_ready = enable;
770 list = g_list_reverse(il->area_param_delayed_list);
771 il->area_param_delayed_list = NULL;
772 g_mutex_unlock(il->data_mutex);
778 ImageLoaderAreaParam *par = work->data;
781 g_signal_emit(il, signals[SIGNAL_AREA_READY], 0, par->x, par->y, par->w, par->h);
789 g_mutex_unlock(il->data_mutex);
794 /**************************************************************************************/
795 /* execution via idle calls */
797 static gboolean image_loader_idle_cb(gpointer data)
799 gboolean ret = FALSE;
800 ImageLoader *il = data;
804 ret = image_loader_continue(il);
809 image_loader_stop_source(il);
816 static gboolean image_loader_start_idle(ImageLoader *il)
820 if (!il) return FALSE;
822 if (!il->fd) return FALSE;
824 if (!image_loader_setup_source(il)) return FALSE;
826 ret = image_loader_begin(il);
828 if (ret && !il->done) il->idle_id = g_idle_add_full(il->idle_priority, image_loader_idle_cb, il, NULL);
832 /**************************************************************************************/
833 /* execution via thread */
836 static GThreadPool *image_loader_thread_pool = NULL;
838 static GCond *image_loader_prio_cond = NULL;
839 static GMutex *image_loader_prio_mutex = NULL;
840 static gint image_loader_prio_num = 0;
843 static void image_loader_thread_enter_high(void)
845 g_mutex_lock(image_loader_prio_mutex);
846 image_loader_prio_num++;
847 g_mutex_unlock(image_loader_prio_mutex);
850 static void image_loader_thread_leave_high(void)
852 g_mutex_lock(image_loader_prio_mutex);
853 image_loader_prio_num--;
854 if (image_loader_prio_num == 0) g_cond_broadcast(image_loader_prio_cond); /* wake up all low prio threads */
855 g_mutex_unlock(image_loader_prio_mutex);
858 static void image_loader_thread_wait_high(void)
860 g_mutex_lock(image_loader_prio_mutex);
861 while (image_loader_prio_num)
863 g_cond_wait(image_loader_prio_cond, image_loader_prio_mutex);
866 g_mutex_unlock(image_loader_prio_mutex);
870 static void image_loader_thread_run(gpointer data, gpointer user_data)
872 ImageLoader *il = data;
876 if (il->idle_priority > G_PRIORITY_DEFAULT_IDLE)
878 /* low prio, wait untill high prio tasks finishes */
879 image_loader_thread_wait_high();
884 image_loader_thread_enter_high();
887 err = !image_loader_begin(il);
892 loader failed, we have to send signal
893 (idle mode returns the image_loader_begin return value directly)
894 (success is always reported indirectly from image_loader_begin)
896 image_loader_emit_error(il);
901 while (cont && !image_loader_get_is_done(il) && !image_loader_get_stopping(il))
903 if (il->idle_priority > G_PRIORITY_DEFAULT_IDLE)
905 /* low prio, wait untill high prio tasks finishes */
906 image_loader_thread_wait_high();
908 cont = image_loader_continue(il);
910 image_loader_stop_loader(il);
912 if (il->idle_priority <= G_PRIORITY_DEFAULT_IDLE)
915 image_loader_thread_leave_high();
918 g_mutex_lock(il->data_mutex);
919 il->can_destroy = TRUE;
920 g_cond_signal(il->can_destroy_cond);
921 g_mutex_unlock(il->data_mutex);
926 static gboolean image_loader_start_thread(ImageLoader *il)
928 if (!il) return FALSE;
930 if (!il->fd) return FALSE;
934 if (!image_loader_setup_source(il)) return FALSE;
936 if (!image_loader_thread_pool)
938 image_loader_thread_pool = g_thread_pool_new(image_loader_thread_run, NULL, -1, FALSE, NULL);
939 image_loader_prio_cond = g_cond_new();
940 image_loader_prio_mutex = g_mutex_new();
943 il->can_destroy = FALSE; /* ImageLoader can't be freed until image_loader_thread_run finishes */
945 g_thread_pool_push(image_loader_thread_pool, il, NULL);
946 DEBUG_1("Thread pool num threads: %d", g_thread_pool_get_num_threads(image_loader_thread_pool));
950 #endif /* HAVE_GTHREAD */
953 /**************************************************************************************/
954 /* public interface */
957 gboolean image_loader_start(ImageLoader *il)
959 if (!il) return FALSE;
961 if (!il->fd) return FALSE;
964 return image_loader_start_thread(il);
966 return image_loader_start_idle(il);
971 /* don't forget to gdk_pixbuf_ref() it if you want to use it after image_loader_free() */
972 GdkPixbuf *image_loader_get_pixbuf(ImageLoader *il)
975 if (!il) return NULL;
977 g_mutex_lock(il->data_mutex);
979 g_mutex_unlock(il->data_mutex);
983 gchar *image_loader_get_format(ImageLoader *il)
988 if (!il || !il->loader) return NULL;
990 mimev = il->backend.get_format_mime_types(il->loader);
991 if (!mimev) return NULL;
993 /* return first member of mimev, as GdkPixbufLoader has no way to tell us which exact one ? */
994 mime = g_strdup(mimev[0]);
1000 void image_loader_set_requested_size(ImageLoader *il, gint width, gint height)
1004 g_mutex_lock(il->data_mutex);
1005 il->requested_width = width;
1006 il->requested_height = height;
1007 g_mutex_unlock(il->data_mutex);
1010 void image_loader_set_buffer_size(ImageLoader *il, guint count)
1014 g_mutex_lock(il->data_mutex);
1015 il->idle_read_loop_count = count ? count : 1;
1016 g_mutex_unlock(il->data_mutex);
1019 void image_loader_set_priority(ImageLoader *il, gint priority)
1023 if (il->thread) return; /* can't change prio if the thread already runs */
1024 il->idle_priority = priority;
1028 gdouble image_loader_get_percent(ImageLoader *il)
1031 if (!il) return 0.0;
1033 g_mutex_lock(il->data_mutex);
1034 if (il->bytes_total == 0)
1040 ret = (gdouble)il->bytes_read / il->bytes_total;
1042 g_mutex_unlock(il->data_mutex);
1046 gboolean image_loader_get_is_done(ImageLoader *il)
1049 if (!il) return FALSE;
1051 g_mutex_lock(il->data_mutex);
1053 g_mutex_unlock(il->data_mutex);
1058 FileData *image_loader_get_fd(ImageLoader *il)
1061 if (!il) return NULL;
1063 g_mutex_lock(il->data_mutex);
1065 g_mutex_unlock(il->data_mutex);
1070 gboolean image_loader_get_shrunk(ImageLoader *il)
1073 if (!il) return FALSE;
1075 g_mutex_lock(il->data_mutex);
1077 g_mutex_unlock(il->data_mutex);
1081 const gchar *image_loader_get_error(ImageLoader *il)
1083 const gchar *ret = NULL;
1084 if (!il) return NULL;
1085 g_mutex_lock(il->data_mutex);
1086 if (il->error) ret = il->error->message;
1087 g_mutex_unlock(il->data_mutex);
1092 /* FIXME - this can be rather slow and blocks until the size is known */
1093 gboolean image_load_dimensions(FileData *fd, gint *width, gint *height)
1098 il = image_loader_new(fd);
1100 success = image_loader_start_idle(il);
1102 if (success && il->pixbuf)
1104 if (width) *width = gdk_pixbuf_get_width(il->pixbuf);
1105 if (height) *height = gdk_pixbuf_get_height(il->pixbuf);;
1109 if (width) *width = -1;
1110 if (height) *height = -1;
1113 image_loader_free(il);
1117 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */