]> Pileus Git - ~andy/gtk/commitdiff
Ahem, take the rowstride into account!!! Fixes #82515.
authorFederico Mena Quintero <federico@ximian.com>
Wed, 22 May 2002 18:13:44 +0000 (18:13 +0000)
committerFederico Mena Quintero <federico@src.gnome.org>
Wed, 22 May 2002 18:13:44 +0000 (18:13 +0000)
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!]

gdk-pixbuf/ChangeLog
gdk-pixbuf/io-xpm.c

index cc1aabe50196a2860d0a8079c113522427cdf237..0e77158f53564fefdbff74420625d041cb0ad0c7 100644 (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 
index 3f047298962677cad263ac5d0b619d02d82f2e52..6f47766768760eefa8810827a3fd4072819594ec 100644 (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);