diff options
author | Federico Mena Quintero <federico@ximian.com> | 2002-05-22 18:13:44 +0000 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2002-05-22 18:13:44 +0000 |
commit | 1528b0ad857757cdb0fd711663192a898501ebc8 (patch) | |
tree | 19dbc31897f38766c4eff31615a8d60b553a1d4f /gdk-pixbuf/io-xpm.c | |
parent | acaf177b5f71694ae24149b3ccbc661107cb73bf (diff) | |
download | gtk+-1528b0ad857757cdb0fd711663192a898501ebc8.tar.gz |
Ahem, take the rowstride into account!!! Fixes #82515.
2002-05-22 Federico Mena Quintero <federico@ximian.com>
* io-xpm.c (pixbuf_create_from_xpm): Ahem, take the rowstride into
account!!! Fixes #82515.
[This bug is not present in the GNOME 1.4 branch as its XPM loader
does not use gdk_pixbuf_new(); rather it malloc()s a buffer with
no row padding and then uses gdk_pixbuf_new_from_data() on it.]
[IMPORTANT: The comment above is to make my life easier when
merging stuff across branches. If you make changes to gdk-pixbuf
in either branch, please include a comment in the ChangeLog that
indicates whether this should be merged into the other branch.
Thanks!]
Diffstat (limited to 'gdk-pixbuf/io-xpm.c')
-rw-r--r-- | gdk-pixbuf/io-xpm.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gdk-pixbuf/io-xpm.c b/gdk-pixbuf/io-xpm.c index 3f04729896..6f47766768 100644 --- a/gdk-pixbuf/io-xpm.c +++ b/gdk-pixbuf/io-xpm.c @@ -1209,7 +1209,7 @@ pixbuf_create_from_xpm (const gchar * (*get_buf) (enum buf_op op, gpointer handl GError **error) { gint w, h, n_col, cpp; - gint cnt, xcnt, ycnt, wbytes, n, ns; + gint cnt, xcnt, ycnt, wbytes, n; gint is_trans = FALSE; const gchar *buffer; gchar *name_buf; @@ -1322,9 +1322,10 @@ pixbuf_create_from_xpm (const gchar * (*get_buf) (enum buf_op op, gpointer handl } wbytes = w * cpp; - pixtmp = pixbuf->pixels; for (ycnt = 0; ycnt < h; ycnt++) { + pixtmp = pixbuf->pixels + ycnt * pixbuf->rowstride; + buffer = (*get_buf) (op_body, handle); if ((!buffer) || (strlen (buffer) < wbytes)) continue; @@ -1332,7 +1333,6 @@ pixbuf_create_from_xpm (const gchar * (*get_buf) (enum buf_op op, gpointer handl for (n = 0, cnt = 0, xcnt = 0; n < wbytes; n += cpp, xcnt++) { strncpy (pixel_str, &buffer[n], cpp); pixel_str[cpp] = 0; - ns = 0; color = g_hash_table_lookup (color_hash, pixel_str); |