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!]
This commit is contained in:
Federico Mena Quintero 2002-05-22 18:13:44 +00:00 committed by Federico Mena Quintero
parent acaf177b5f
commit 1528b0ad85
2 changed files with 18 additions and 3 deletions

View File

@ -1,3 +1,18 @@
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!]
2002-05-18 Matthias Clasen <maclas@gmx.de>
* io-tiff.c (tiff_image_parse): fix packing order on bigendian

View File

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