diff options
Diffstat (limited to 'gdk-pixbuf/io-qtif.c')
-rw-r--r-- | gdk-pixbuf/io-qtif.c | 58 |
1 files changed, 22 insertions, 36 deletions
diff --git a/gdk-pixbuf/io-qtif.c b/gdk-pixbuf/io-qtif.c index 79fd4ffa9..aaa483611 100644 --- a/gdk-pixbuf/io-qtif.c +++ b/gdk-pixbuf/io-qtif.c @@ -256,6 +256,10 @@ static gpointer gdk_pixbuf__qtif_image_begin_load (GdkPixbufModuleSizeFunc size_ { QTIFContext *context; + g_assert (size_func != NULL); + g_assert (prepare_func != NULL); + g_assert (update_func != NULL); + /* Create context struct. */ context = g_new0(QTIFContext, 1); if(context == NULL) @@ -329,24 +333,15 @@ static gboolean gdk_pixbuf__qtif_image_create_loader (QTIFContext *context, GErr /* Connect signals. */ context->cb_prepare_count = 0; context->cb_update_count = 0; - if(context->size_func != NULL) - { - g_signal_connect(context->loader, "size-prepared", - G_CALLBACK(gdk_pixbuf__qtif_cb_size_prepared), - context); - } - if(context->prepare_func != NULL) - { - g_signal_connect(context->loader, "area-prepared", - G_CALLBACK(gdk_pixbuf__qtif_cb_area_prepared), - context); - } - if(context->update_func != NULL) - { - g_signal_connect(context->loader, "area-updated", - G_CALLBACK(gdk_pixbuf__qtif_cb_area_updated), - context); - } + g_signal_connect(context->loader, "size-prepared", + G_CALLBACK(gdk_pixbuf__qtif_cb_size_prepared), + context); + g_signal_connect(context->loader, "area-prepared", + G_CALLBACK(gdk_pixbuf__qtif_cb_area_prepared), + context); + g_signal_connect(context->loader, "area-updated", + G_CALLBACK(gdk_pixbuf__qtif_cb_area_updated), + context); return TRUE; } @@ -384,12 +379,12 @@ static gboolean gdk_pixbuf__qtif_image_free_loader (QTIFContext *context, GError if(pixbuf != NULL) { /* Callback functions should be called for at least once. */ - if((context->prepare_func != NULL) && (context->cb_prepare_count == 0)) + if(context->cb_prepare_count == 0) { (context->prepare_func)(pixbuf, NULL, context->user_data); } - if((context->update_func != NULL) && (context->cb_update_count == 0)) + if(context->cb_update_count == 0) { gint width; gint height; @@ -542,22 +537,16 @@ static void gdk_pixbuf__qtif_cb_size_prepared(GdkPixbufLoader *loader, gpointer user_data) { QTIFContext *context = (QTIFContext *)user_data; - if((context != NULL) && (context->size_func != NULL)) - { - (context->size_func)(&width, &height, context->user_data); - context->cb_prepare_count++; - } + (context->size_func)(&width, &height, context->user_data); + context->cb_prepare_count++; } static void gdk_pixbuf__qtif_cb_area_prepared(GdkPixbufLoader *loader, gpointer user_data) { QTIFContext *context = (QTIFContext *)user_data; - if((loader != NULL) && (context != NULL) && (context->prepare_func != NULL)) - { - GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf(context->loader); - (context->prepare_func)(pixbuf, NULL, context->user_data); - context->cb_update_count++; - } + GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf(context->loader); + (context->prepare_func)(pixbuf, NULL, context->user_data); + context->cb_update_count++; } static void gdk_pixbuf__qtif_cb_area_updated(GdkPixbufLoader *loader, @@ -568,11 +557,8 @@ static void gdk_pixbuf__qtif_cb_area_updated(GdkPixbufLoader *loader, gpointer user_data) { QTIFContext *context = (QTIFContext *)user_data; - if((loader != NULL) && (context != NULL) && (context->update_func != NULL)) - { - GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf(context->loader); - (context->update_func)(pixbuf, x, y, width, height, context->user_data); - } + GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf(context->loader); + (context->update_func)(pixbuf, x, y, width, height, context->user_data); } |