diff options
author | Andreas Tobler <a.tobler@schweiz.org> | 2006-06-28 19:47:42 +0000 |
---|---|---|
committer | Andreas Tobler <a.tobler@schweiz.org> | 2006-06-28 19:47:42 +0000 |
commit | 7b560a35d02e2239dc60856edd351e2c28aed024 (patch) | |
tree | 3c54ce7b723c60f9bceb92b560b4f4604d64fdbb /native | |
parent | 823253efc205ac53d49c1a4860c1f1d1d056424c (diff) | |
download | classpath-7b560a35d02e2239dc60856edd351e2c28aed024.tar.gz |
2006-06-28 Andreas Tobler <a.tobler@schweiz.ch>
* gnu/java/awt/peer/gtk/CairoSurface.java: Swap the data from the
GdkPixbuf correctly on big endian systems. Fix a typo in the little
endian swapping code.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
(Java_gnu_java_awt_peer_gtk_GtkImage_getPixels): Swap the pixeldata
without alpha information correctly on big endian systems.
Diffstat (limited to 'native')
-rw-r--r-- | native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c index 1168c6ec0..8805ae7b3 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c @@ -189,13 +189,27 @@ Java_gnu_java_awt_peer_gtk_GtkImage_getPixels(JNIEnv *env, jobject obj) pixeldata += rowstride; } } else { + + /* Add a default alpha value of 0xFF to the pixeldata without alpha + information and keep it in the same format as the pixeldata with alpha + information. On Little Endian systems: AABBGGRR and on Big Endian + systems: RRGGBBAA. */ + for(i = 0; i < height; i++) { for(j = 0; j < width; j++) - dst[j] = 0xFF000000 | - (pixeldata[j*3 + 2] & 0xFF) << 16 | - (pixeldata[j*3 + 1] & 0xFF) << 8 | - (pixeldata[j*3] & 0xFF); + +#ifndef WORDS_BIGENDIAN + dst[j] = 0xFF000000 + | (pixeldata[j*3 + 2] & 0xFF) << 16 + | (pixeldata[j*3 + 1] & 0xFF) << 8 + | (pixeldata[j*3] & 0xFF); +#else + dst[j] = (pixeldata[j*3] & 0xFF) << 24 + | (pixeldata[j*3 + 1] & 0xFF) << 16 + | (pixeldata[j*3 + 2] & 0xFF) << 8 + | 0xFF; +#endif dst += width; pixeldata += rowstride; } |