2006-06-01 Sven de Marothy <[EMAIL PROTECTED]> * gnu/java/awt/peer/gtk/BufferedImageGraphics.java * gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java * native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c (nativeCopyArea): Change stride parameter to use # of ints. * gnu/java/awt/peer/gtk/ComponentGraphics.java (ComponentGraphics): Set background, clip. * gnu/java/awt/peer/gtk/CairoGraphics2D.java (Cairographics2D): Don't set clip. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c Add flush.
Index: gnu/java/awt/peer/gtk/BufferedImageGraphics.java =================================================================== RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/BufferedImageGraphics.java,v retrieving revision 1.5 diff -U3 -r1.5 BufferedImageGraphics.java --- gnu/java/awt/peer/gtk/BufferedImageGraphics.java 1 Jun 2006 07:43:14 -0000 1.5 +++ gnu/java/awt/peer/gtk/BufferedImageGraphics.java 2 Jun 2006 16:17:45 -0000 @@ -231,7 +231,7 @@ if( y + dy + height >= surface.height ) // bottom height = surface.height - dy - y; - surface.copyAreaNative(x, y, width, height, dx, dy, surface.width * 4); + surface.copyAreaNative(x, y, width, height, dx, dy, surface.width); updateBufferedImage(x + dx, y + dy, width, height); } Index: gnu/java/awt/peer/gtk/CairoGraphics2D.java =================================================================== RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,v retrieving revision 1.11 diff -U3 -r1.11 CairoGraphics2D.java --- gnu/java/awt/peer/gtk/CairoGraphics2D.java 1 Jun 2006 17:50:58 -0000 1.11 +++ gnu/java/awt/peer/gtk/CairoGraphics2D.java 2 Jun 2006 16:17:45 -0000 @@ -257,7 +257,6 @@ setPaint(paint); setStroke(stroke); setTransform(transform); - setClip(clip); } /** Index: gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java =================================================================== RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java,v retrieving revision 1.2 diff -U3 -r1.2 CairoSurfaceGraphics.java --- gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java 30 May 2006 04:21:53 -0000 1.2 +++ gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java 2 Jun 2006 16:17:45 -0000 @@ -115,6 +115,6 @@ if( y + dy + height >= surface.height ) // bottom height = surface.height - dy - y; - surface.copyAreaNative(x, y, width, height, dx, dy, surface.width * 4); + surface.copyAreaNative(x, y, width, height, dx, dy, surface.width); } } Index: gnu/java/awt/peer/gtk/ComponentGraphics.java =================================================================== RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java,v retrieving revision 1.5 diff -U3 -r1.5 ComponentGraphics.java --- gnu/java/awt/peer/gtk/ComponentGraphics.java 31 May 2006 00:04:30 -0000 1.5 +++ gnu/java/awt/peer/gtk/ComponentGraphics.java 2 Jun 2006 16:17:45 -0000 @@ -80,6 +80,9 @@ component = cg.component; cairo_t = initState(component); copy( cg, cairo_t ); + setBackground(component.awtComponent.getBackground()); + setClip(component.awtComponent.getBounds()); + setColor(component.awtComponent.getForeground()); } /** Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c =================================================================== RCS file: /sources/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c,v retrieving revision 1.11 diff -U3 -r1.11 gnu_java_awt_peer_gtk_CairoSurface.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c 1 Jun 2006 04:26:40 -0000 1.11 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c 2 Jun 2006 16:17:47 -0000 @@ -223,17 +223,17 @@ jint *pixeldata = (jint *)getNativeObject(env, obj, BUFFER); g_assert( pixeldata != NULL ); - temp = g_malloc( w * 4 ); + temp = g_malloc( w * sizeof( jint ) ); g_assert( temp != NULL ); - srcOffset = x + y * (stride >> 2); - dstOffset = (x + dx) + (y + dy) * (stride >> 2); + srcOffset = x + y * stride; + dstOffset = (x + dx) + (y + dy) * stride; for( row = 0; row < h; row++) { - memcpy( temp, pixeldata + srcOffset, w * 4 ); - memcpy( pixeldata + dstOffset, temp, w * 4 ); - srcOffset += (stride >> 2); - dstOffset += (stride >> 2); + memcpy( temp, pixeldata + srcOffset, w * sizeof(jint) ); + memcpy( pixeldata + dstOffset, temp, w * sizeof(jint) ); + srcOffset += stride; + dstOffset += stride; } g_free( temp ); Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c =================================================================== RCS file: /sources/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c,v retrieving revision 1.8 diff -U3 -r1.8 gnu_java_awt_peer_gtk_ComponentGraphics.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c 31 May 2006 21:29:48 -0000 1.8 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c 2 Jun 2006 16:17:47 -0000 @@ -54,6 +54,34 @@ #include "gnu_java_awt_peer_gtk_ComponentGraphics.h" +static short flush_scheduled = 0; + +static gboolean flush (gpointer data __attribute__((unused))) +{ + gdk_threads_enter (); + + XFlush (GDK_DISPLAY ()); + flush_scheduled = 0; + + gdk_threads_leave (); + + return FALSE; +} + +/* The minimum time period between calls to XFlush, in + milliseconds. */ +#define MINIMUM_FLUSH_PERIOD 20 + +/* schedule_flush must be called with the GDK lock held. */ +static void +schedule_flush () +{ + if (!flush_scheduled) + { + g_timeout_add (MINIMUM_FLUSH_PERIOD, flush, NULL); + flush_scheduled = 1; + } +} void cp_gtk_grab_current_drawable(GtkWidget *widget, GdkDrawable **draw, GdkWindow **win) @@ -148,6 +176,7 @@ Java_gnu_java_awt_peer_gtk_ComponentGraphics_end_1gdk_1drawing (JNIEnv *env __attribute__ ((unused)), jobject obj __attribute__ ((unused))) { + schedule_flush (); gdk_threads_leave(); }