summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/io-xpm.c
diff options
context:
space:
mode:
authorMark Crichton <crichton@src.gnome.org>1999-07-13 01:01:14 +0000
committerMark Crichton <crichton@src.gnome.org>1999-07-13 01:01:14 +0000
commit6992607bb0e99b097c06cb99d66f1f78525af8ed (patch)
treee40f8d02926f6b9578b6498b7d6ef73732a8b2a0 /gdk-pixbuf/io-xpm.c
parente3c310e538cb4584c38f36f3a86863685c51d62f (diff)
downloadgtk+-6992607bb0e99b097c06cb99d66f1f78525af8ed.tar.gz
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...)
Diffstat (limited to 'gdk-pixbuf/io-xpm.c')
-rw-r--r--gdk-pixbuf/io-xpm.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/gdk-pixbuf/io-xpm.c b/gdk-pixbuf/io-xpm.c
index e85926f1df..d4532cc997 100644
--- a/gdk-pixbuf/io-xpm.c
+++ b/gdk-pixbuf/io-xpm.c
@@ -273,7 +273,7 @@ static gchar *
xpm_read_string(h->infile, &h->buffer, &h->buffer_size);
return h->buffer;
}
- return NULL;
+ return 0;
}
/* This reads from memory */
@@ -341,12 +341,13 @@ static GdkPixBuf *
color->transparent = FALSE;
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)) {
color->transparent = TRUE;
is_trans = TRUE;
}
+
g_free(color_name);
g_hash_table_insert(color_hash, color->color_string, color);
@@ -384,19 +385,18 @@ static GdkPixBuf *
if (!color)
color = fallbackcolor;
- pixtmp[0] = color->color.red;
- pixtmp[1] = color->color.green;
- pixtmp[2] = color->color.blue;
+ *pixtmp++ = (color->color.red)>>8;
+ *pixtmp++ = (color->color.green)>>8;
+ *pixtmp++ = (color->color.blue)>>8;
+
if ((is_trans) && (color->transparent)) {
- pixtmp[3] = 0;
- pixtmp++;
+ *pixtmp++ = 0;
} else if (is_trans) {
- pixtmp[3] = 0xFF;
- pixtmp++;
+ *pixtmp++ = 0xFF;
}
- pixtmp += 3;
}
}
+
/* Ok, now stuff the GdkPixBuf with goodies */
pixbuf = g_new(GdkPixBuf, 1);
@@ -427,9 +427,14 @@ GdkPixBuf *image_load(FILE * f)
g_return_val_if_fail(f != NULL, NULL);
+ memset(&h, 0, sizeof(h));
h.infile = f;
pixbuf = _pixbuf_create_from_xpm(file_buffer, &h);
g_free(h.buffer);
return pixbuf;
}
+
+image_save()
+{
+}