On Tue, 2005-08-16 at 19:11 +0200, Andreas Tobler wrote: > > Index: classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c > =================================================================== > RCS file: > /cvs/gcc/gcc/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c,v > retrieving revision 1.1.1.1 > diff -u -r1.1.1.1 gnu_java_awt_peer_gtk_GtkImage.c > --- classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c > 16 Jul 2005 00:30:51 -0000 1.1.1.1 > +++ classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c > 16 Aug 2005 17:06:45 -0000 > @@ -176,7 +176,7 @@ > int width, height, rowstride; > guchar *pixeldata; > jint *src_array_iter, *src; > - int i; > + int i,j; > > gdk_threads_enter (); > > @@ -184,15 +184,26 @@ > height = gdk_pixbuf_get_height (pixbuf); > rowstride = gdk_pixbuf_get_rowstride (pixbuf); > > - src = src_array_iter = > + src = src_array_iter = > (*env)->GetIntArrayElements (env, pixels, NULL); > > pixeldata = gdk_pixbuf_get_pixels (pixbuf); > for(i = 0 ; i < height; i++) > { > +#ifdef WORDS_BIGENDIAN > + /* Convert and copy the native BigEndian pixels to the 32-bit > + AABBGGRR format the Java uses. */ > + for (j = 0; j < width; j++) > + { > + unsigned int *pix_conv = (unsigned int *) pixeldata; > + *pix_conv = SWAPU32((unsigned)src[j]); > + pixeldata += 4; > + } > +#else > memcpy((void *)pixeldata, (void *)src, width * 4); > - src += width; > pixeldata += rowstride; > +#endif > + src += width; > }
This, and the existing code, assumes rowstride == width * 4. This depends on whether or not the image has an alpha channel though. I think we should replace the 4 constants in this code with n_channels, obtained from gdk_pixbuf_get_n_channels. Shouldn't you also swap bytes in getPixels? Tom _______________________________________________ Classpath-patches mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/classpath-patches