[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: awt image fixes

Kaffe CVS cvs-commits at kaffe.org
Sat Jun 11 13:27:41 PDT 2005


PatchSet 6626 
Date: 2005/06/11 20:22:59
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: awt image fixes

Members: 
	ChangeLog:1.4152->1.4153 
	include/Makefile.am:1.105->1.106 
	include/Makefile.in:1.234->1.235 
	libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am:1.14->1.15 
	libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in:1.35->1.36 
	libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c:1.12->1.13 
	libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c:1.4->1.5 
	libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c:INITIAL->1.1 
	libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c:1.5->1.6(DEAD) 
	libraries/javalib/Makefile.am:1.361->1.362 
	libraries/javalib/Makefile.in:1.451->1.452 
	libraries/javalib/all.files:1.134->1.135 
	libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics.java:1.12->1.13 
	libraries/javalib/gnu/java/awt/peer/gtk/GtkComponentPeer.java:1.13->1.14 
	libraries/javalib/gnu/java/awt/peer/gtk/GtkFramePeer.java:1.9->1.10 
	libraries/javalib/gnu/java/awt/peer/gtk/GtkImage.java:1.4->1.5 
	libraries/javalib/gnu/java/awt/peer/gtk/GtkImageConsumer.java:INITIAL->1.1 
	libraries/javalib/gnu/java/awt/peer/gtk/GtkImagePainter.java:1.5->1.6(DEAD) 
	libraries/javalib/gnu/java/awt/peer/gtk/GtkOffScreenImage.java:1.2->1.3(DEAD) 
	libraries/javalib/gnu/java/awt/peer/gtk/GtkToolkit.java:1.16->1.17 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4152 kaffe/ChangeLog:1.4153
--- kaffe/ChangeLog:1.4152	Sat Jun 11 19:27:34 2005
+++ kaffe/ChangeLog	Sat Jun 11 20:22:59 2005
@@ -2,6 +2,46 @@
 
 	Resynced with GNU Classpath.
 	
+	2005-06-02  Sven de Marothy  <sven at physto.se>
+
+	* gnu/java/awt/peer/gtk/GdkGraphics.java:
+	(GdkGraphics): New constructor.
+	(drawImage): Reimplemented.
+	* gnu/java/awt/peer/gtk/GtkComponentPeer.java:
+	(checkImage,createImage): Reimplemented.
+	(prepareImage): Just call the GdkToolkit method.
+	* gnu/java/awt/peer/gtk/GtkFramePeer.java:
+	(setIconImage): Reimplemented.
+	* gnu/java/awt/peer/gtk/GtkImage.java: Reimplemented.
+	* gnu/java/awt/peer/gtk/GtkToolkit.java:
+	(checkImage): Change handling of GtkImage.
+	(createImage): Reimplemented for GtkImage.
+	(getColorModel): Return the actual native color model.
+	(prepareImage): Reimplemented.
+	* include/Makefile.am,
+	* native/jni/gtk-peer/Makefile.am: Removed old files, added new ones.
+	* include/gnu_java_awt_peer_gtk_GdkGraphics.h,
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c:
+	(initFromImage): New method.
+	(copyPixmap, flip_pixbuf, copyAndScalePixmap): Removed.
+	* include/gnu_java_awt_peer_gtk_GtkFramePeer.h,
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c:
+	(nativeSetIconImage): New method.
+	(nativeSetIconImageFromData,nativeSetIconImageFromDecoder): Removed.
+	* gnu/java/awt/peer/gtk/GtkImageConsumer.java,
+	* include/gnu_java_awt_peer_gtk_GtkImage.h,
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c: 
+	New files.
+	* gnu/java/awt/peer/gtk/GtkImagePainter.java,
+	* gnu/java/awt/peer/gtk/GtkOffScreenImage.java,
+	* include/gnu_java_awt_peer_gtk_GtkImagePainter.h,
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c:
+	Removed files.
+
+2005-06-11  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+	
 	2005-06-01  Tom Tromey  <tromey at redhat.com>
 
 	* java/io/ObjectInputStream.java (currentLoader): Fixed typo.
Index: kaffe/include/Makefile.am
diff -u kaffe/include/Makefile.am:1.105 kaffe/include/Makefile.am:1.106
--- kaffe/include/Makefile.am:1.105	Tue May 31 19:45:36 2005
+++ kaffe/include/Makefile.am	Sat Jun 11 20:23:01 2005
@@ -166,7 +166,7 @@
 	gnu_java_awt_peer_gtk_GtkFileDialogPeer.h \
 	gnu_java_awt_peer_gtk_GtkFramePeer.h \
 	gnu_java_awt_peer_gtk_GtkGenericPeer.h \
-	gnu_java_awt_peer_gtk_GtkImagePainter.h \
+	gnu_java_awt_peer_gtk_GtkImage.h \
 	gnu_java_awt_peer_gtk_GtkLabelPeer.h \
 	gnu_java_awt_peer_gtk_GtkListPeer.h \
 	gnu_java_awt_peer_gtk_GtkMenuBarPeer.h \
Index: kaffe/include/Makefile.in
diff -u kaffe/include/Makefile.in:1.234 kaffe/include/Makefile.in:1.235
--- kaffe/include/Makefile.in:1.234	Tue May 31 19:45:37 2005
+++ kaffe/include/Makefile.in	Sat Jun 11 20:23:01 2005
@@ -525,7 +525,7 @@
 	gnu_java_awt_peer_gtk_GtkFileDialogPeer.h \
 	gnu_java_awt_peer_gtk_GtkFramePeer.h \
 	gnu_java_awt_peer_gtk_GtkGenericPeer.h \
-	gnu_java_awt_peer_gtk_GtkImagePainter.h \
+	gnu_java_awt_peer_gtk_GtkImage.h \
 	gnu_java_awt_peer_gtk_GtkLabelPeer.h \
 	gnu_java_awt_peer_gtk_GtkListPeer.h \
 	gnu_java_awt_peer_gtk_GtkMenuBarPeer.h \
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am:1.14 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am:1.15
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am:1.14	Fri Apr 15 06:45:40 2005
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am	Sat Jun 11 20:23:02 2005
@@ -30,7 +30,7 @@
 	gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c \
 	gnu_java_awt_peer_gtk_GtkFramePeer.c \
 	gnu_java_awt_peer_gtk_GtkGenericPeer.c	\
-	gnu_java_awt_peer_gtk_GtkImagePainter.c \
+	gnu_java_awt_peer_gtk_GtkImage.c \
 	gnu_java_awt_peer_gtk_GtkLabelPeer.c \
 	gnu_java_awt_peer_gtk_GtkListPeer.c	\
 	gnu_java_awt_peer_gtk_GtkMenuBarPeer.c \
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in:1.35 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in:1.36
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in:1.35	Sat May 14 21:46:48 2005
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in	Sat Jun 11 20:23:02 2005
@@ -101,7 +101,7 @@
 	gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c \
 	gnu_java_awt_peer_gtk_GtkFramePeer.c \
 	gnu_java_awt_peer_gtk_GtkGenericPeer.c \
-	gnu_java_awt_peer_gtk_GtkImagePainter.c \
+	gnu_java_awt_peer_gtk_GtkImage.c \
 	gnu_java_awt_peer_gtk_GtkLabelPeer.c \
 	gnu_java_awt_peer_gtk_GtkListPeer.c \
 	gnu_java_awt_peer_gtk_GtkMenuBarPeer.c \
@@ -140,7 +140,7 @@
 	libgtkpeer_la-gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.lo \
 	libgtkpeer_la-gnu_java_awt_peer_gtk_GtkFramePeer.lo \
 	libgtkpeer_la-gnu_java_awt_peer_gtk_GtkGenericPeer.lo \
-	libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImagePainter.lo \
+	libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImage.lo \
 	libgtkpeer_la-gnu_java_awt_peer_gtk_GtkLabelPeer.lo \
 	libgtkpeer_la-gnu_java_awt_peer_gtk_GtkListPeer.lo \
 	libgtkpeer_la-gnu_java_awt_peer_gtk_GtkMenuBarPeer.lo \
@@ -483,7 +483,7 @@
 	gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c \
 	gnu_java_awt_peer_gtk_GtkFramePeer.c \
 	gnu_java_awt_peer_gtk_GtkGenericPeer.c	\
-	gnu_java_awt_peer_gtk_GtkImagePainter.c \
+	gnu_java_awt_peer_gtk_GtkImage.c \
 	gnu_java_awt_peer_gtk_GtkLabelPeer.c \
 	gnu_java_awt_peer_gtk_GtkListPeer.c	\
 	gnu_java_awt_peer_gtk_GtkMenuBarPeer.c \
@@ -640,7 +640,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GtkFileDialogPeer.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GtkFramePeer.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GtkGenericPeer.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImagePainter.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImage.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GtkLabelPeer.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GtkListPeer.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GtkMenuBarPeer.Plo at am__quote@
@@ -828,12 +828,12 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -c -o libgtkpeer_la-gnu_java_awt_peer_gtk_GtkGenericPeer.lo `test -f 'gnu_java_awt_peer_gtk_GtkGenericPeer.c' || echo '$(srcdir)/'`gnu_java_awt_peer_gtk_GtkGenericPeer.c
 
-libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImagePainter.lo: gnu_java_awt_peer_gtk_GtkImagePainter.c
- at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -MT libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImagePainter.lo -MD -MP -MF "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImagePainter.Tpo" -c -o libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImagePainter.lo `test -f 'gnu_java_awt_peer_gtk_GtkImagePainter.c' || echo '$(srcdir)/'`gnu_java_awt_peer_gtk_GtkImagePainter.c; \
- at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImagePainter.Tpo" "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImagePainter.Plo"; else rm -f "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImagePainter.Tpo"; exit 1; fi
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='gnu_java_awt_peer_gtk_GtkImagePainter.c' object='libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImagePainter.lo' libtool=yes @AMDEPBACKSLASH@
+libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImage.lo: gnu_java_awt_peer_gtk_GtkImage.c
+ at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -MT libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImage.lo -MD -MP -MF "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImage.Tpo" -c -o libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImage.lo `test -f 'gnu_java_awt_peer_gtk_GtkImage.c' || echo '$(srcdir)/'`gnu_java_awt_peer_gtk_GtkImage.c; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImage.Tpo" "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImage.Plo"; else rm -f "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImage.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='gnu_java_awt_peer_gtk_GtkImage.c' object='libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImage.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -c -o libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImagePainter.lo `test -f 'gnu_java_awt_peer_gtk_GtkImagePainter.c' || echo '$(srcdir)/'`gnu_java_awt_peer_gtk_GtkImagePainter.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -c -o libgtkpeer_la-gnu_java_awt_peer_gtk_GtkImage.lo `test -f 'gnu_java_awt_peer_gtk_GtkImage.c' || echo '$(srcdir)/'`gnu_java_awt_peer_gtk_GtkImage.c
 
 libgtkpeer_la-gnu_java_awt_peer_gtk_GtkLabelPeer.lo: gnu_java_awt_peer_gtk_GtkLabelPeer.c
 @am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -MT libgtkpeer_la-gnu_java_awt_peer_gtk_GtkLabelPeer.lo -MD -MP -MF "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GtkLabelPeer.Tpo" -c -o libgtkpeer_la-gnu_java_awt_peer_gtk_GtkLabelPeer.lo `test -f 'gnu_java_awt_peer_gtk_GtkLabelPeer.c' || echo '$(srcdir)/'`gnu_java_awt_peer_gtk_GtkLabelPeer.c; \
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c:1.12 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c:1.13
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c:1.12	Sun Feb 13 22:01:37 2005
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c	Sat Jun 11 20:23:02 2005
@@ -97,6 +97,32 @@
   NSA_SET_PTR (env, obj, g);
 }
 
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_initFromImage
+   (JNIEnv *env, jobject obj, jobject source)
+{
+  struct graphics *g;
+  GdkPixmap *pixmap = 
+    gnu_java_awt_peer_gtk_GtkImage_getPixmap(env, source);
+  g_assert(pixmap != NULL);
+  gdk_pixmap_ref (pixmap);
+
+  g = (struct graphics *) malloc (sizeof (struct graphics));
+  g->x_offset = g->y_offset = 0;
+
+  gdk_threads_enter ();
+
+  g->drawable = (GdkDrawable *)pixmap;
+
+  g->cm = gdk_drawable_get_colormap (g->drawable);
+  gdk_colormap_ref (g->cm);
+  g->gc = gdk_gc_new (g->drawable);
+
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, g);
+}
+
 /* copy the native state of the peer (GtkWidget *) to the native state
    of the graphics object */
 JNIEXPORT void JNICALL
@@ -299,136 +325,6 @@
   gdk_flush ();
   gdk_threads_leave ();
 }
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_copyPixmap
-  (JNIEnv *env, jobject obj, jobject offscreen, 
-   jint x, jint y, jint width, jint height)
-{
-  struct graphics *g1, *g2;
-
-  g1 = (struct graphics *) NSA_GET_PTR (env, obj);
-  g2 = (struct graphics *) NSA_GET_PTR (env, offscreen);
-
-  gdk_threads_enter ();
-  gdk_window_copy_area ((GdkWindow *)g1->drawable,
-			g1->gc,
-			x + g1->x_offset, y + g1->y_offset,
-			(GdkWindow *)g2->drawable,
-			0 + g2->x_offset, 0 + g2->y_offset, 
-			width, height);
-  gdk_flush ();
-  gdk_threads_leave ();
-}
-
-static void flip_pixbuf (GdkPixbuf *pixbuf,
-                         jboolean flip_x,
-                         jboolean flip_y,
-                         jint width,
-                         jint height)
-{
-  gint src_rs;
-  guchar *src_pix;
-
-  src_rs = gdk_pixbuf_get_rowstride (pixbuf);
-  src_pix = gdk_pixbuf_get_pixels (pixbuf);
-
-  if (flip_x) 
-    {
-      gint i, channels;
-      guchar buf[4];
-
-      channels = gdk_pixbuf_get_has_alpha (pixbuf) ? 4 : 3;
-
-      for (i = 0; i < height; i++) 
-        {
-          guchar *left = src_pix + i * src_rs;
-          guchar *right = left + channels * (width - 1);
-          while (left < right)
-            { 
-              g_memmove (buf, left, (size_t)channels);
-              g_memmove (left, right, (size_t)channels);
-              g_memmove (right, buf, (size_t)channels);
-              left += channels;
-              right -= channels;
-            }
-        }
-    }
-
-  if (flip_y) 
-    {
-      guchar *top = src_pix;
-      guchar *bottom = top + (height - 1) * src_rs;
-      gpointer buf = g_malloc ((size_t)src_rs);
-      
-      while (top < bottom)
-        {
-          g_memmove (buf, top, (size_t)src_rs);
-          g_memmove (top, bottom, (size_t)src_rs);
-          g_memmove (bottom, buf, (size_t)src_rs); 
-          top += src_rs;
-          bottom -= src_rs;
-        }
-
-      g_free (buf);
-    }
-}
-  
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_copyAndScalePixmap
-  (JNIEnv *env, jobject obj, jobject offscreen, jboolean flip_x, jboolean flip_y,
-   jint src_x, jint src_y, jint src_width, jint src_height,
-   jint dest_x, jint dest_y, jint dest_width, jint dest_height)
-{
-  struct graphics *g1, *g2;
-  GdkPixbuf *buf_src, *buf_dest;
-
-  g1 = (struct graphics *) NSA_GET_PTR (env, obj);
-  g2 = (struct graphics *) NSA_GET_PTR (env, offscreen);
-
-  gdk_threads_enter ();
-
-  buf_src = gdk_pixbuf_get_from_drawable (NULL,
-                                          g2->drawable,
-                                          g2->cm,
-                                          src_x,
-                                          src_y,
-                                          0,
-                                          0,
-                                          src_width,
-                                          src_height);
-
-  buf_dest = gdk_pixbuf_scale_simple (buf_src, 
-                                      dest_width, 
-                                      dest_height, 
-                                      GDK_INTERP_BILINEAR);
-
-  if (flip_x || flip_y)
-    {
-      flip_pixbuf (buf_dest, flip_x, flip_y, dest_width, dest_height);
-    }
-
-  gdk_pixbuf_render_to_drawable (buf_dest,
-                                 g1->drawable,
-                                 g1->gc,
-                                 0,
-                                 0,
-                                 dest_x,
-                                 dest_y,
-                                 dest_width,
-                                 dest_height,
-                                 GDK_RGB_DITHER_NORMAL,
-                                 0,
-                                 0);
-
-  g_object_unref (G_OBJECT (buf_src));
-  g_object_unref (G_OBJECT (buf_dest));
-
-  gdk_threads_leave ();
-}
-
-
-
 
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c:1.4 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c:1.5
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c:1.4	Tue May 31 21:18:30 2005
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c	Sat Jun 11 20:23:02 2005
@@ -38,6 +38,10 @@
 #include "gtkpeer.h"
 #include "gnu_java_awt_peer_gtk_GtkFramePeer.h"
 
+/* lives in GtkImage.c */
+GdkPixbuf *gnu_java_awt_peer_gtk_GtkImage_getPixbuf(JNIEnv *env, jobject obj);
+jboolean gnu_java_awt_peer_gtk_GtkImage_isOffScreen(JNIEnv *env, jobject obj);
+
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GtkFramePeer_removeMenuBarPeer
   (JNIEnv *env, jobject obj)
@@ -156,68 +160,26 @@
 }
 
 JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFramePeer_nativeSetIconImageFromDecoder
-  (JNIEnv *env, jobject obj, jobject decoder)
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_nativeSetIconImage
+  (JNIEnv *env, jobject obj, jobject gtkimage)
 {
   void *ptr;
-  GdkPixbufLoader *loader = NULL;
-  GdkPixbuf *pixbuf = NULL;
-
-  ptr = NSA_GET_PTR (env, obj);
-
-  loader = NSA_GET_PB_PTR (env, decoder);
-  g_assert (loader != NULL);
+  GdkPixbuf *pixbuf = gnu_java_awt_peer_gtk_GtkImage_getPixbuf(env, gtkimage);
 
-  gdk_threads_enter ();
-
-  pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
   g_assert (pixbuf != NULL);
 
-  gtk_window_set_icon (GTK_WINDOW (ptr), pixbuf);
-
-  gdk_threads_leave ();
-}
-
-static void
-free_pixbuf_data (guchar *pixels, gpointer data __attribute__((unused)))
-{
-  free(pixels);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFramePeer_nativeSetIconImageFromData
-  (JNIEnv *env, jobject obj, jintArray pixelArray, jint width, jint height)
-{
-  void *ptr;
-  GdkPixbuf *pixbuf;
-  jint *pixels;
-  int pixels_length, i;
-  guchar *data;
-
   ptr = NSA_GET_PTR (env, obj);
 
-  pixels = (*env)->GetIntArrayElements (env, pixelArray, NULL);
-  pixels_length = (*env)->GetArrayLength (env, pixelArray);
-
-  data = malloc (sizeof (guchar) * pixels_length);
-  for (i = 0; i < pixels_length; i++)
-    data[i] = (guchar) pixels[i];
-
   gdk_threads_enter ();
 
-  pixbuf = gdk_pixbuf_new_from_data (data,
-                                     GDK_COLORSPACE_RGB,
-                                     TRUE,
-                                     8,
-                                     width,
-                                     height,
-                                     width*4,
-                                     free_pixbuf_data,
-                                     NULL);
-
   gtk_window_set_icon (GTK_WINDOW (ptr), pixbuf);
 
-  gdk_threads_leave ();
+  /* if the GtkImage is offscreen, this is a temporary pixbuf which should 
+   be thrown out. */
+  if(gnu_java_awt_peer_gtk_GtkImage_isOffScreen(env, gtkimage) == JNI_TRUE)
+    gdk_pixbuf_unref (pixbuf);
 
-  (*env)->ReleaseIntArrayElements(env, pixelArray, pixels, 0);
+  gdk_threads_leave ();
 }
+
+
===================================================================
Checking out kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
RCS:  /home/cvs/kaffe/kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c	Sat Jun 11 20:27:41 2005
@@ -0,0 +1,610 @@
+/* gtkimage.c
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkImage.h"
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+/* The constant fields in java.awt.Image */   
+#define SCALE_DEFAULT      1
+#define SCALE_FAST         2
+#define SCALE_SMOOTH       4
+#define SCALE_REPLICATE    8 
+#define SCALE_AREA_AVERAGING  16
+
+/* functions used by other gtk peer native routines */
+GdkPixbuf *gnu_java_awt_peer_gtk_GtkImage_getPixbuf(JNIEnv *env, jobject obj);
+GdkPixmap *gnu_java_awt_peer_gtk_GtkImage_getPixmap(JNIEnv *env, jobject obj);
+jboolean gnu_java_awt_peer_gtk_GtkImage_isOffScreen(JNIEnv *env, jobject obj);
+
+/* local stuff */
+static GdkInterpType mapHints(jint hints);
+static jboolean offScreen (JNIEnv * env, jobject obj);
+static void *getData (JNIEnv * env, jobject obj);
+static void createRawData (JNIEnv * env, jobject obj, void *ptr);
+static void setWidthHeight (JNIEnv * env, jobject obj, int width, int height);
+
+/**
+ * Loads a pixmap from a file.
+ */
+JNIEXPORT jboolean JNICALL
+Java_gnu_java_awt_peer_gtk_GtkImage_loadPixbuf
+  (JNIEnv *env, jobject obj, jstring name)
+{
+  const char *filename;
+  int width, height;
+  GdkPixbuf *pixbuf;
+
+  /* Don't use the JCL convert function because it throws an exception
+     on failure */
+  filename = (*env)->GetStringUTFChars (env, name, 0);
+
+  if (filename == NULL)
+    return JNI_FALSE;
+
+  gdk_threads_enter ();
+
+  pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+  if (pixbuf == NULL)
+    {
+      gdk_threads_leave ();
+      (*env)->ReleaseStringUTFChars (env, name, filename);
+      return JNI_FALSE;
+    }
+
+  width =  gdk_pixbuf_get_width (pixbuf);
+  height = gdk_pixbuf_get_height (pixbuf);
+  gdk_threads_leave ();
+  
+  createRawData (env, obj, pixbuf);
+  setWidthHeight(env, obj, width, height);
+  (*env)->ReleaseStringUTFChars (env, name, filename);
+  return JNI_TRUE;
+}
+
+/**
+ * Returns a copy of the pixel data as a java array.
+ */
+JNIEXPORT jintArray JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkImage_getPixels(JNIEnv *env, jobject obj)
+{
+  GdkPixbuf *pixbuf;
+  int width, height, rowstride;
+  guchar *pixeldata;
+  jintArray result_array;
+  jint *result_array_iter, *dst;
+  int i,j;
+
+  gdk_threads_enter ();
+
+  pixbuf = gnu_java_awt_peer_gtk_GtkImage_getPixbuf(env, obj);
+  width =  gdk_pixbuf_get_width (pixbuf);
+  height = gdk_pixbuf_get_height (pixbuf);
+  rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+
+  result_array = (*env)->NewIntArray (env, (width * height));
+  dst = result_array_iter = 
+    (*env)->GetIntArrayElements (env, result_array, NULL);
+
+  pixeldata = gdk_pixbuf_get_pixels (pixbuf);
+
+  /* FIXME: handle more bit depths here? */
+  g_assert (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8);
+
+  if (gdk_pixbuf_get_has_alpha (pixbuf))
+    {
+      for(i = 0 ; i < height; i++)
+	{
+	  memcpy(dst, (void *)pixeldata, width * 4);
+	  dst += width;
+	  pixeldata += rowstride;
+	}
+    } else {
+      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);
+	  dst += width;
+	  pixeldata += rowstride;
+	}
+    }
+  
+  if (offScreen (env, obj) == JNI_TRUE)
+    gdk_pixbuf_unref (pixbuf);
+    
+  gdk_threads_leave ();
+
+  (*env)->ReleaseIntArrayElements (env, result_array, result_array_iter, 0);
+  return result_array;
+}
+
+/**
+ * Returns a copy of the pixel data as a java array.
+ * (GdkPixbuf only)
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkImage_setPixels(JNIEnv *env, jobject obj,
+					      jintArray pixels)
+{
+  GdkPixbuf *pixbuf = (GdkPixbuf *)getData (env, obj);
+  int width, height, rowstride;
+  guchar *pixeldata;
+  jint *src_array_iter, *src;
+  int i;
+
+  gdk_threads_enter ();
+
+  width =  gdk_pixbuf_get_width (pixbuf);
+  height = gdk_pixbuf_get_height (pixbuf);
+  rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+
+  src = src_array_iter = 
+    (*env)->GetIntArrayElements (env, pixels, NULL);
+
+  pixeldata = gdk_pixbuf_get_pixels (pixbuf);
+  for(i = 0 ; i < height; i++)
+    {
+      memcpy((void *)pixeldata, (void *)src, width * 4);
+      src += width;
+      pixeldata += rowstride;
+    }
+
+  gdk_threads_leave ();
+
+  (*env)->ReleaseIntArrayElements (env, pixels, src_array_iter, 0);
+}
+
+/**
+ * Allocates a Gtk Pixbuf or Pixmap.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkImage_createPixmap(JNIEnv *env, jobject obj)
+{
+  int width, height;
+  jclass cls;
+  jfieldID field;
+
+  cls = (*env)->GetObjectClass (env, obj);
+  field = (*env)->GetFieldID (env, cls, "width", "I");
+  g_assert (field != 0);
+  width = (*env)->GetIntField (env, obj, field);
+
+  field = (*env)->GetFieldID (env, cls, "height", "I");
+  g_assert (field != 0);
+  height = (*env)->GetIntField (env, obj, field);
+
+  gdk_threads_enter ();
+  if (offScreen (env, obj) == JNI_FALSE)
+    createRawData (env, obj, gdk_pixbuf_new (GDK_COLORSPACE_RGB, 
+					     TRUE,
+					     8,
+					     width,
+					     height));
+  else
+    createRawData (env, obj, gdk_pixmap_new (NULL, width, height,
+					     gdk_rgb_get_visual ()->depth));
+
+  gdk_threads_leave ();
+}
+
+/**
+ * Frees the Gtk Pixmap.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkImage_freePixmap(JNIEnv *env, jobject obj)
+{
+  gdk_threads_enter ();
+  if (offScreen (env, obj) == JNI_FALSE)
+    gdk_pixbuf_unref ((GdkPixbuf *)getData (env, obj));
+  else
+    gdk_pixmap_unref ((GdkPixmap *)getData (env, obj));
+
+  gdk_threads_leave ();
+}
+
+/**
+ * Sets this pixmap to a scaled version of the source pixmap.
+ * width and height of the destination GtkImage must be set.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkImage_createScaledPixmap(JNIEnv *env, 
+						       jobject destination, 
+						       jobject source,
+						       jint hints)
+{
+  GdkPixbuf* dst;
+  int width, height;
+  jclass cls;
+  jfieldID field;
+
+  GdkPixbuf *pixbuf;
+
+  cls = (*env)->GetObjectClass (env, destination);
+  field = (*env)->GetFieldID (env, cls, "width", "I");
+  g_assert (field != 0);
+  width = (*env)->GetIntField (env, destination, field);
+
+  field = (*env)->GetFieldID (env, cls, "height", "I");
+  g_assert (field != 0);
+  height = (*env)->GetIntField (env, destination, field);
+
+  gdk_threads_enter ();
+
+  pixbuf = gnu_java_awt_peer_gtk_GtkImage_getPixbuf(env, source);
+
+  dst = gdk_pixbuf_scale_simple(pixbuf,
+				width, height,
+				mapHints(hints));
+
+  if (offScreen (env, source) == JNI_TRUE)
+      gdk_pixbuf_unref (pixbuf);
+
+  gdk_threads_leave ();
+
+  createRawData (env, destination, (void *)dst);
+}
+
+/**
+ * Draws the pixbuf at x, y, scaled to width and height and 
+ * optionally composited with a given background color.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkImage_drawPixelsScaled 
+  (JNIEnv *env, jobject obj, jobject gc_obj,
+   jint bg_red, jint bg_green, jint bg_blue, 
+   jint x, jint y, jint width, jint height, jboolean composite)
+{
+  GdkPixbuf* dst;
+  struct graphics *g;
+  guint32 bgColor;
+
+  bgColor = ((bg_red & 0xFF) << 16) |
+    ((bg_green & 0xFF) << 8) | (bg_blue & 0xFF);
+    
+  gdk_threads_enter ();
+  
+  g = (struct graphics *) NSA_GET_PTR (env, gc_obj);
+  
+  if (!g || !GDK_IS_DRAWABLE (g->drawable))
+    {
+      gdk_threads_leave ();
+      return;
+    }
+
+  if (offScreen (env, obj) == JNI_FALSE)
+    {
+      GdkPixbuf* pixbuf = (GdkPixbuf *)getData (env, obj);
+
+      /* Scale and composite the image */
+      if (composite == JNI_TRUE)
+	dst = gdk_pixbuf_composite_color_simple (pixbuf,
+						 width,
+						 height,
+						 GDK_INTERP_BILINEAR,
+						 255,
+						 width,
+						 bgColor,
+						 bgColor);
+      else
+	dst = gdk_pixbuf_scale_simple(pixbuf,
+				      width, height,
+				      GDK_INTERP_BILINEAR);
+
+      gdk_draw_pixbuf (g->drawable,
+		       g->gc,
+		       dst,
+		       0, 0,
+		       x + g->x_offset, y + g->y_offset, 
+		       width, height,
+		       GDK_RGB_DITHER_NORMAL, 0, 0);
+      gdk_pixbuf_unref (dst);
+
+    } else {
+      /* Get a pixmap */
+      GdkPixmap* pixmap = (GdkPixmap *)getData (env, obj);
+      gdk_draw_drawable (g->drawable,
+			 g->gc,
+			 pixmap,
+			 0, 0, /* src x,y */
+			 x + g->x_offset, y + g->y_offset, 
+			 width, height);
+    }
+    
+  gdk_threads_leave ();
+}
+
+/**
+ * Draws the pixbuf at x, y, scaled to width and height and 
+ * optionally composited and/or flipped with a given background color.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkImage_drawPixelsScaledFlipped 
+(JNIEnv *env, jobject obj, jobject gc_obj,
+ jint bg_red, jint bg_green, jint bg_blue, 
+ jboolean flipx, jboolean flipy,
+ jint srcx, jint srcy, jint srcwidth, jint srcheight, 
+ jint dstx, jint dsty, jint dstwidth, jint dstheight, 
+ jboolean composite)
+{
+  GdkPixbuf *pixbuf;
+  GdkPixbuf *tmp, *dst;
+  struct graphics *g;
+  guint32 bgColor;
+
+  bgColor = ((bg_red & 0xFF) << 16) |
+    ((bg_green & 0xFF) << 8) | (bg_blue & 0xFF);
+    
+  gdk_threads_enter ();
+  
+  g = (struct graphics *) NSA_GET_PTR (env, gc_obj);
+  
+  if (!g || !GDK_IS_DRAWABLE (g->drawable))
+    {
+      gdk_threads_leave ();
+      return;
+    }
+
+  if (offScreen (env, obj) == JNI_FALSE)
+    {
+      pixbuf = (GdkPixbuf *)getData (env, obj);
+
+      /* Get the source area */
+      tmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB, 
+			    TRUE,
+			    8,
+			    srcwidth,
+			    srcheight);
+
+      gdk_pixbuf_copy_area (pixbuf, 
+			    srcx, srcy,
+			    srcwidth, srcheight,
+			    tmp, 
+			    0, 0); /* dst x , dst y */
+    } else {
+      /* Get a pixbuf from the pixmap */
+      GdkDrawable *pixmap = (GdkDrawable *)getData(env, obj);
+      tmp = gdk_pixbuf_get_from_drawable (NULL,
+					  pixmap,
+					  gdk_drawable_get_colormap( pixmap ),
+					  srcx, srcy,
+					  0, 0, /* dst x , dst y */
+					  srcwidth, srcheight);
+    }
+
+  /* FIXME: This #if should be discarded once I feel comfortable about
+     GTK 2.6 dependence */
+#if GTK_MINOR_VERSION > 4
+  /* Flip it if necessary. */
+  if (flipx == JNI_TRUE)
+    {
+      GdkPixbuf *tmp2 = gdk_pixbuf_flip (tmp, TRUE);
+      gdk_pixbuf_unref (tmp);
+      tmp = tmp2;
+    }
+  if (flipy == JNI_TRUE)
+    {
+      GdkPixbuf *tmp2 = gdk_pixbuf_flip (tmp, FALSE);
+      gdk_pixbuf_unref (tmp);
+      tmp = tmp2;
+    }
+#endif
+  
+  /* Scale and composite the image */
+  if (composite == JNI_TRUE)
+    dst = gdk_pixbuf_composite_color_simple (tmp,
+					     dstwidth,
+					     dstheight,
+					     GDK_INTERP_BILINEAR,
+					     255,
+					     dstwidth,
+					     bgColor,
+					     bgColor);
+  else
+    dst = gdk_pixbuf_scale_simple(tmp,
+				  dstwidth, dstheight,
+				  GDK_INTERP_BILINEAR);
+  gdk_pixbuf_unref (tmp);
+    
+  gdk_draw_pixbuf (g->drawable,
+		   g->gc,
+		   dst,
+		   0, 0,
+		   dstx + g->x_offset, dsty + g->y_offset, 
+		   dstwidth, dstheight,
+		   GDK_RGB_DITHER_NORMAL, 0, 0);
+  
+  gdk_pixbuf_unref (dst);
+  gdk_threads_leave ();
+}
+
+/**
+ * Used by GtkFramePeer
+ */
+GdkPixbuf *gnu_java_awt_peer_gtk_GtkImage_getPixbuf(JNIEnv *env, jobject obj)
+{
+  int width, height;
+  GdkPixbuf *pixbuf;
+  GdkPixmap* pixmap;
+  jclass cls;
+  jfieldID field;
+
+  if (offScreen (env, obj) == JNI_FALSE)
+    return (GdkPixbuf *)getData (env, obj);
+
+  cls = (*env)->GetObjectClass (env, obj);
+  field = (*env)->GetFieldID (env, cls, "width", "I");
+  g_assert (field != 0);
+  width = (*env)->GetIntField (env, obj, field);
+   
+  field = (*env)->GetFieldID (env, cls, "height", "I");
+  g_assert (field != 0);
+  height = (*env)->GetIntField (env, obj, field);
+
+  /* Get a pixmap */
+  pixmap = (GdkPixmap *)getData (env, obj);
+  pixbuf = gdk_pixbuf_get_from_drawable (NULL,
+					 pixmap,
+					 gdk_drawable_get_colormap( pixmap ),
+					 0, 0, /* src x , src y */
+					 0, 0, /* dst x , dst y */
+					 width, height);
+  return pixbuf;
+}
+
+/**
+ * Used by GdkGraphics
+ */
+GdkPixmap *gnu_java_awt_peer_gtk_GtkImage_getPixmap(JNIEnv *env, jobject obj)
+{
+  if (offScreen (env, obj) == JNI_FALSE)
+    return NULL;
+  return (GdkPixmap *)getData (env, obj);
+}
+
+jboolean gnu_java_awt_peer_gtk_GtkImage_isOffScreen(JNIEnv *env, jobject obj)
+{
+  return offScreen(env, obj);
+}
+
+/**
+ * Maps java.awt.Image scaling hints to the native GDK ones.
+ */
+static GdkInterpType mapHints(jint hints)
+{
+  switch ( hints ) 
+    {
+      /* For FAST, we use the nearest-neighbor. Fastest and lowest quality. */
+    case SCALE_FAST:
+    case SCALE_REPLICATE:
+      return GDK_INTERP_NEAREST;
+
+      /* Hyperbolic for smooth. Slowest too. */
+    case SCALE_SMOOTH:
+      return GDK_INTERP_HYPER;
+      
+      /* the inbetweenish method */
+    case SCALE_AREA_AVERAGING:
+      return GDK_INTERP_TILES;
+
+      /* default to bilinear */
+    }
+  return GDK_INTERP_BILINEAR;
+}
+
+/* Sets the width and height fields of a GtkImage object. */
+static void setWidthHeight (JNIEnv * env, jobject obj, int width, int height)
+{
+  jclass cls;
+  jfieldID field;
+  
+  cls = (*env)->GetObjectClass (env, obj);
+  g_assert (cls != 0);
+  field = (*env)->GetFieldID (env, cls, "width", "I");
+  g_assert (field != 0);
+  (*env)->SetIntField (env, obj, field, (jint)width);
+   
+  field = (*env)->GetFieldID (env, cls, "height", "I");
+  g_assert (field != 0);
+  (*env)->SetIntField (env, obj, field, (jint)height);
+}

*** Patch too long, truncated ***




More information about the kaffe mailing list