Commit 2580cb68 authored by Michael Fulbright's avatar Michael Fulbright Committed by Michael Fulbright

Actually load the image handler when we determine the image type.

1999-10-29  Michael Fulbright  <drmike@redhat.com>

        * src/gdk-pixbuf-loader.c (gdk_pixbuf_loader_write): Actually
        load the image handler when we determine the image type.

        * src/gdk-pixbuf-io.[ch] (gdk_pixbuf_load_module): Changed the
        previously static function load_image_handler () to
        a public function gdk_pixbuf_load_module (). It is needed in
        gdk-pixbuf-loader.c to load image handler modules.  This function
        is different from gdk_pixbuf_get_module (), which only returns
        a reference to the required handler, because it actually loads
        the handler into memory. Both actions should possibly be combined
        in a convenience function since one w/o the other doesn't seem to
        make much sense.
parent 52b7ddb7
......@@ -149,8 +149,12 @@ GdkPixbufModule file_formats [] = {
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL }
};
static void
image_handler_load (GdkPixbufModule *image_module)
/* actually load the image handler - gdk_pixbuf_get_module only get a */
/* reference to the module to load, it doesn't actually load it */
/* perhaps these actions should be combined in one function */
void
gdk_pixbuf_load_module (GdkPixbufModule *image_module)
{
char *module_name;
char *path;
......@@ -240,7 +244,7 @@ gdk_pixbuf_new_from_file (const char *filename)
image_module = gdk_pixbuf_get_module (buffer, size);
if (image_module){
if (image_module->module == NULL)
image_handler_load (image_module);
gdk_pixbuf_load_module (image_module);
if (image_module->load == NULL) {
fclose (f);
......@@ -270,7 +274,7 @@ gdk_pixbuf_new_from_xpm_data (const gchar **data)
GdkPixbuf *pixbuf;
if (file_formats[XPM_FILE_FORMAT_INDEX].module == NULL) {
image_handler_load(&file_formats[XPM_FILE_FORMAT_INDEX]);
gdk_pixbuf_load_module(&file_formats[XPM_FILE_FORMAT_INDEX]);
}
if (file_formats[XPM_FILE_FORMAT_INDEX].module == NULL) {
......
......@@ -6,6 +6,7 @@
* Miguel de Icaza <miguel@gnu.org>
* Federico Mena-Quintero <federico@gimp.org>
* Jonathan Blandford <jrb@redhat.com>
* Michael Fulbright <drmike@redhat.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -46,4 +47,5 @@ struct _GdkPixbufModule {
GdkPixbufModule *gdk_pixbuf_get_module (gchar *buffer, gint size);
void gdk_pixbuf_load_module (GdkPixbufModule *image_module);
......@@ -270,16 +270,19 @@ gdk_pixbuf_loader_write (GdkPixbufLoader *loader, guchar *buf, size_t count)
priv->image_module = gdk_pixbuf_get_module (priv->buf, 128);
if (priv->image_module == NULL)
return FALSE;
else if ((priv->image_module->begin_load == NULL) ||
(priv->image_module->stop_load == NULL) ||
(priv->image_module->load_increment == NULL)) {
else if (priv->image_module->module == NULL)
gdk_pixbuf_load_module (priv->image_module);
if ((priv->image_module->begin_load == NULL) ||
(priv->image_module->stop_load == NULL) ||
(priv->image_module->load_increment == NULL)) {
g_warning ("module %s does not support incremental loading.\n",
priv->image_module->module_name);
return FALSE;
} else {
priv->context = (*priv->image_module->begin_load) (
gdk_pixbuf_loader_prepare, loader);
if (priv->context == NULL) {
g_warning("Failed to begin progressive load");
return FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment