configure.ac: Introduce AC_C_BIGENDIAN_CROSS for WORDS_BIGENDIAN.

2004-09-22  Andreas Tobler  <a.tobler@schweiz.ch>

	* configure.ac: Introduce AC_C_BIGENDIAN_CROSS for WORDS_BIGENDIAN.
	* configure: Regenerate.
	* include/config.h.in: Likewise.
	* jni/gtk-peer/gtkpeer.h (SWAPU32): Introduce macro to swap pixels.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c: Moved SWAPU32
	macro to gtkpeer.h.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
	(Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getImagePixels): Convert
	pixels from  0xBBGGRRAA to 0xAARRGGBB only on Little Endian
	architectures.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c (area_updated):
	Likewise.

From-SVN: r87889
This commit is contained in:
Andreas Tobler 2004-09-22 22:59:16 +02:00 committed by Andreas Tobler
parent 08fb229ea8
commit 44bffd9f6f
8 changed files with 449 additions and 146 deletions

View File

@ -1,3 +1,18 @@
2004-09-22 Andreas Tobler <a.tobler@schweiz.ch>
* configure.ac: Introduce AC_C_BIGENDIAN_CROSS for WORDS_BIGENDIAN.
* configure: Regenerate.
* include/config.h.in: Likewise.
* jni/gtk-peer/gtkpeer.h (SWAPU32): Introduce macro to swap pixels.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c: Moved SWAPU32
macro to gtkpeer.h.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
(Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getImagePixels): Convert
pixels from 0xBBGGRRAA to 0xAARRGGBB only on Little Endian
architectures.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c (area_updated):
Likewise.
2004-09-22 Tom Tromey <tromey@redhat.com>
PR libgcj/14446:

519
libjava/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1124,6 +1124,8 @@ CPPFLAGS=$GCJ_SAVE_CPPFLAGS
AC_COMPILE_CHECK_SIZEOF(void *)
AC_C_BIGENDIAN_CROSS
ZLIBS=
SYS_ZLIBS=
ZINCS=

View File

@ -1,5 +1,8 @@
/* include/config.h.in. Generated from configure.ac by autoheader. */
/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
#undef BYTEORDER
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
@ -351,6 +354,10 @@
/* Define to 1 if you have the file `AC_File'. */
#undef HAVE__PROC_SELF_EXE
/* Define if the host machine stores words of multi-word integers in
big-endian order. */
#undef HOST_WORDS_BIG_ENDIAN
/* Define as const if the declaration of iconv() needs const. */
#undef ICONV_CONST
@ -441,6 +448,9 @@
/* Version number of package */
#undef VERSION
/* whether byteorder is bigendian */
#undef WORDS_BIGENDIAN
/* Define to 1 if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING

View File

@ -1,5 +1,5 @@
/* gnu_java_awt_peer_gtk_GdkGraphics2d.c
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -748,7 +748,7 @@ JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getImagePix
gint bits_per_sample = 8;
gboolean has_alpha = TRUE;
gint total_channels = 4;
jint i, px;
jint i;
gdk_threads_enter();
if (peer_is_disposed(env, obj)) { gdk_threads_leave(); return NULL; }
@ -777,23 +777,13 @@ JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getImagePix
native_pixels= gdk_pixbuf_get_pixels (buf);
/* NOTE: The pixels we got in the pixbuf are stored
in reversed order. i.e 0xBBGGRRAA.
We need to convert them to 0xAARRGGBB. */
#ifndef WORDS_BIGENDIAN
/* convert pixels from 0xBBGGRRAA to 0xAARRGGBB */
for (i=0; i<width * height; i++)
{
/* convert pixels from 0xBBGGRRAA to 0xAARRGGBB */
px = native_pixels[i];
px = ((px >> 24) & 0xff) | ((px << 8) & 0xffffff00);
px = ((px >> 8) & 0x00ff00ff) | ((px << 8) & 0xff00ff00);
px = ((px >> 16) & 0x0000ffff) | ((px << 16) & 0xffff0000);
native_pixels[i] = px;
native_pixels[i] = SWAPU32 ((unsigned)native_pixels[i]);
}
#endif
java_pixels = (*env) -> NewIntArray (env, width * height);

View File

@ -99,7 +99,7 @@ area_updated (GdkPixbufLoader *loader,
JNIEnv *env;
union env_union e;
jint stride_bytes, stride_pixels, n_channels, n_pixels;
int i, px;
int i;
jintArray jpixels;
jint *java_pixels;
guchar *gdk_pixels;
@ -129,21 +129,13 @@ area_updated (GdkPixbufLoader *loader,
gdk_pixels + (y * stride_bytes),
(height * stride_bytes));
#ifndef WORDS_BIGENDIAN
/* convert pixels from 0xBBGGRRAA to 0xAARRGGBB */
for (i = 0; i < n_pixels; ++i)
{
px = java_pixels[i];
/* move alpha around (GdkPixbufLoader results are AGBR not GBRA, in
the lsb sense) */
/* px = ((px >> 24) & 0xff) | ((px << 8) & 0xffffff00); */
/* it appears to require a full byte swap, now, not just a shift to
the A channel. why did this change? don't know. */
px = ((px >> 8) & 0x00ff00ff) | ((px << 8) & 0xff00ff00);
px = ((px >> 16) & 0x0000ffff) | ((px << 16) & 0xffff0000);
java_pixels[i] = px;
java_pixels[i] = SWAPU32 ((unsigned)java_pixels[i]);
}
#endif
g_object_unref (pixbuf);

View File

@ -1,5 +1,5 @@
/* gtkimagepainter.c
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -40,8 +40,6 @@ exception statement from your version. */
#include <libart_lgpl/art_misc.h>
#include <libart_lgpl/art_rgb_affine.h>
#define SWAPU32(w) \
(((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24))
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkImagePainter_drawPixels
(JNIEnv *env, jobject obj __attribute__((unused)), jobject gc_obj,

View File

@ -1,5 +1,5 @@
/* gtkpeer.h -- Some global variables and #defines
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -107,6 +107,9 @@ extern struct state_table *native_pixbufdecoder_state_table;
#endif /* JVM_SUN */
#define SWAPU32(w) \
(((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24))
struct graphics
{
GdkDrawable *drawable;