Ok, we'll try this again.

Ok, we'll try this again.

io-xpm.c: Fixed.  Now actually loads XPMs instead of a big black blob.

configure.in : yes, I know it was broken.  It wasn't finished quite yet (I
always have larger fish to fry)

Oh, and if anyone touches this module again without emailing the people in
AUTHORS, I will go ballistic (after spending precious time figuring out why
this commit never happened the 1st time I tried...)
This commit is contained in:
Mark Crichton 1999-07-13 01:01:14 +00:00
parent e3c310e538
commit 6992607bb0
2 changed files with 18 additions and 12 deletions

View File

@ -30,7 +30,8 @@ libgdk_pixbuf_la_SOURCES = \
gdk-pixbuf-io.c gdk-pixbuf-io.c
libgdk_pixbufinclude_HEADERS = \ libgdk_pixbufinclude_HEADERS = \
gdk-pixbuf.h gdk-pixbuf.h \
gdk-pixbuf-io.h
# #
# The PNG plugin. # The PNG plugin.

View File

@ -273,7 +273,7 @@ static gchar *
xpm_read_string(h->infile, &h->buffer, &h->buffer_size); xpm_read_string(h->infile, &h->buffer, &h->buffer_size);
return h->buffer; return h->buffer;
} }
return NULL; return 0;
} }
/* This reads from memory */ /* This reads from memory */
@ -341,12 +341,13 @@ static GdkPixBuf *
color->transparent = FALSE; color->transparent = FALSE;
color_name = xpm_extract_color(buffer); color_name = xpm_extract_color(buffer);
if ((!color_name) || (g_strcasecmp(color_name, "None") == 0) if ((color_name == NULL) || (g_strcasecmp(color_name, "None") == 0)
|| (gdk_color_parse(color_name, &color->color) == FALSE)) { || (gdk_color_parse(color_name, &color->color) == FALSE)) {
color->transparent = TRUE; color->transparent = TRUE;
is_trans = TRUE; is_trans = TRUE;
} }
g_free(color_name); g_free(color_name);
g_hash_table_insert(color_hash, color->color_string, color); g_hash_table_insert(color_hash, color->color_string, color);
@ -384,19 +385,18 @@ static GdkPixBuf *
if (!color) if (!color)
color = fallbackcolor; color = fallbackcolor;
pixtmp[0] = color->color.red; *pixtmp++ = (color->color.red)>>8;
pixtmp[1] = color->color.green; *pixtmp++ = (color->color.green)>>8;
pixtmp[2] = color->color.blue; *pixtmp++ = (color->color.blue)>>8;
if ((is_trans) && (color->transparent)) { if ((is_trans) && (color->transparent)) {
pixtmp[3] = 0; *pixtmp++ = 0;
pixtmp++;
} else if (is_trans) { } else if (is_trans) {
pixtmp[3] = 0xFF; *pixtmp++ = 0xFF;
pixtmp++;
} }
pixtmp += 3;
} }
} }
/* Ok, now stuff the GdkPixBuf with goodies */ /* Ok, now stuff the GdkPixBuf with goodies */
pixbuf = g_new(GdkPixBuf, 1); pixbuf = g_new(GdkPixBuf, 1);
@ -427,9 +427,14 @@ GdkPixBuf *image_load(FILE * f)
g_return_val_if_fail(f != NULL, NULL); g_return_val_if_fail(f != NULL, NULL);
memset(&h, 0, sizeof(h));
h.infile = f; h.infile = f;
pixbuf = _pixbuf_create_from_xpm(file_buffer, &h); pixbuf = _pixbuf_create_from_xpm(file_buffer, &h);
g_free(h.buffer); g_free(h.buffer);
return pixbuf; return pixbuf;
} }
image_save()
{
}