[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] [patch] fix BE image issues
From: |
Andreas Tobler |
Subject: |
[cp-patches] [patch] fix BE image issues |
Date: |
Sun, 24 Jul 2005 22:47:42 +0200 |
User-agent: |
Mozilla Thunderbird 1.0.5 (Macintosh/20050711) |
Hi all,
according to the process I'm asked to send the patches here regarding cp :)
Attached a fixlet to bring Big Endian Machines into happiness with Image
representation.
It took a while to get it, but I hope I have it right. The reason for
then long time is a bit stupid, I always tested against the wrong
library :(
P.S, Sven, it is no rocket science, but stupid enough if I test against
an old installed library .....
Regards,
Andreas
2005-07-24 Andreas Tobler <address@hidden>
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
(Java_gnu_java_awt_peer_gtk_GtkImage_setPixels): Adjust BE image
handling.
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 24 Jul
2005 19:53:15 -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,9 +184,16 @@
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);
+ /* Convert the native BigEndian pixels to the 32-bit AABBGGRR format
+ the Java uses. */
+#ifdef WORDS_BIGENDIAN
+ for(j = 0 ; j < width * height; j++)
+ src[j] = SWAPU32((unsigned)src[j]);
+#endif
+
pixeldata = gdk_pixbuf_get_pixels (pixbuf);
for(i = 0 ; i < height; i++)
{
- [cp-patches] [patch] fix BE image issues,
Andreas Tobler <=