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.
This commit is contained in:
Michael Fulbright 1999-10-29 19:27:51 +00:00 committed by Michael Fulbright
parent ece5ac121a
commit 5749f310e4
5 changed files with 39 additions and 12 deletions

View File

@ -1,3 +1,18 @@
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.
1999-10-28 Federico Mena Quintero <federico@redhat.com>
* src/gdk-pixbuf-render.c (gdk_pixbuf_render_to_drawable): New

View File

@ -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) {

View File

@ -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);

View File

@ -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;

View File

@ -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;