This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gui][PATCH] Fix MemoryImageSource and other things


Hi,

I committed the attached patch that fixes a bunch of problems in
MemoryImageSource and the GTK peers.  It

- updates image observers in GdkGraphics drawImage calls

- protects against negative menu bar widths in GtkFramePeer

- allows one to set an applet's size from its constructor

- fixes some bounds errors when accessing a memory image source's buffer

- makes memory image sources read directly from the pixel array, rather
than creating a copy

- uncomments gdk_flush calls in GdkGraphics -- for an explanation of why
they're needed, see this entry in the GTK FAQ:
http://www.gtk.org/faq/#AEN492

Tom

2004-11-15  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* gnu/java/awt/peer/gtk/GdkGraphics.java (drawImage variants):
	Update image observer.
	* gnu/java/awt/peer/gtk/GtkComponentPeer.java (createImage):
	Start image production.
	* gnu/java/awt/peer/gtk/GtkFramePeer.java (setMenuBar): Protect
	against negative menu bar widths.
	(setBounds): Likewise.
	(postConfigureEvent): Likewise.
	* gnu/java/awt/peer/gtk/GtkImage.java (imageComplete): Don't
	remove consumer unless only a single frame has completed.
	* gnu/java/awt/peer/gtk/GtkImagePainter.java (GtkImagePainter):
	Add observer parameter.
	(setPixels): Update image observer.
	(imageComplete): Likewise.
	* java/applet/Applet.java (width): New field.
	(height): Likewise.
	(setStub): Set size if width or height field has been set.
	(resize): If stub is null save width and height values.
	* java/awt/Component.java (reshape): Protect against null
	parent.
	* java/awt/image/MemoryImageSource.java
	(MemoryImageSource(int,int,ColorModel,byte[],int,int)):
	Document.
	(MemoryImageSource(int,int,ColorModel,int[],int,int)):
	Likewise.
	(MemoryImageSource(int,int,ColorModel,byte[],int,int,Hashtable)):
	Reference pixel array directly, rather than creating a local
	copy.
	(MemoryImageSource(int,int,ColorModel,int[],int,int,Hashtable)):
	Likewise.
	(newPixels(int,int,int,int)): Fix for loop and array copy
	bounds.
	(newPixels(int,int,int,int,boolean)): Likewise.
	(startProduction): If animated call imageComplete with
	SINGLEFRAME.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c: Uncomment
	gdk_flush lines.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c
	(drawPixels): Return if g is null or g->drawable is not a gdk
	drawable.

Index: gnu/java/awt/peer/gtk/GdkGraphics.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/awt/peer/gtk/GdkGraphics.java,v
retrieving revision 1.4.16.10
diff -u -r1.4.16.10 GdkGraphics.java
--- gnu/java/awt/peer/gtk/GdkGraphics.java	7 Oct 2004 22:11:57 -0000	1.4.16.10
+++ gnu/java/awt/peer/gtk/GdkGraphics.java	25 Nov 2004 02:31:27 -0000
@@ -127,15 +127,6 @@
     return new GdkGraphics (this);
   }
 
-//    public Graphics create (int x, int y, int width, int height)
-//    {
-//      GdkGraphics g = new GdkGraphics (this);
-//      g.translate (x, y);
-//      g.clipRect (0, 0, width, height);
-
-//      return g;
-//    }
-  
   native public void dispose ();
 
   native void copyPixmap (Graphics g, int x, int y, int width, int height);
@@ -152,13 +143,20 @@
 
     if (img instanceof GtkOffScreenImage)
       {
+        int width = img.getWidth (null);
+        int height = img.getHeight (null);
 	copyPixmap (img.getGraphics (), 
-		    x, y, img.getWidth (null), img.getHeight (null));
+		    x, y, width, height);
+        // FIXME: need to differentiate between SOMEBITS and FRAMEBITS.
+        if (observer != null)
+          observer.imageUpdate (img,
+                                ImageObserver.FRAMEBITS,
+                                x, y, width, height);
 	return true;
       }
 
     GtkImage image = (GtkImage) img;
-    new GtkImagePainter (image, this, x, y, -1, -1, bgcolor);
+    new GtkImagePainter (image, this, x, y, -1, -1, bgcolor, observer);
     return image.isLoaded ();
   }
 
@@ -169,8 +167,16 @@
 
     if (img instanceof GtkOffScreenImage)
       {
+        int width = img.getWidth (null);
+        int height = img.getHeight (null);
 	copyPixmap (img.getGraphics (), 
-		    x, y, img.getWidth (null), img.getHeight (null));
+		    x, y, width, height);
+
+        // FIXME: need to differentiate between SOMEBITS and FRAMEBITS.
+        if (observer != null)
+          observer.imageUpdate (img,
+                                ImageObserver.FRAMEBITS,
+                                x, y, width, height);
 	return true;
       }
 
@@ -191,11 +197,16 @@
         copyAndScalePixmap (img.getGraphics (), false, false,
                             0, 0, img.getWidth (null), img.getHeight (null), 
                             x, y, width, height);
+        // FIXME: need to differentiate between SOMEBITS and FRAMEBITS.
+        if (observer != null)
+          observer.imageUpdate (img,
+                                ImageObserver.FRAMEBITS,
+                                x, y, width, height);
         return true;
       }
 
     GtkImage image = (GtkImage) img;
-    new GtkImagePainter (image, this, x, y, width, height, bgcolor);
+    new GtkImagePainter (image, this, x, y, width, height, bgcolor, observer);
     return image.isLoaded ();
   }
 
@@ -275,12 +286,18 @@
         copyAndScalePixmap (img.getGraphics (), x_flip, y_flip,
                             sx_start, sy_start, s_width, s_height, 
                             dx_start, dy_start, d_width, d_height);
+
+        // FIXME: need to differentiate between SOMEBITS and FRAMEBITS.
+        if (observer != null)
+          observer.imageUpdate (img,
+                                ImageObserver.FRAMEBITS,
+                                dx_start, dy_start, d_width, d_height);
         return true;
       }
 
     GtkImage image = (GtkImage) img;
     new GtkImagePainter (image, this, dx1, dy1, dx2, dy2, 
-			 sx1, sy1, sx2, sy2, bgcolor);
+			 sx1, sy1, sx2, sy2, bgcolor, observer);
     return image.isLoaded ();
   }
 
Index: gnu/java/awt/peer/gtk/GtkComponentPeer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java,v
retrieving revision 1.16.2.24
diff -u -r1.16.2.24 GtkComponentPeer.java
--- gnu/java/awt/peer/gtk/GtkComponentPeer.java	7 Nov 2004 00:18:03 -0000	1.16.2.24
+++ gnu/java/awt/peer/gtk/GtkComponentPeer.java	25 Nov 2004 02:31:27 -0000
@@ -202,7 +202,9 @@
 
   public Image createImage (ImageProducer producer)
   {
-    return new GtkImage (producer, null);
+    GtkImage image = new GtkImage (producer, null);
+    producer.startProduction (image);
+    return image;
   }
 
   public Image createImage (int width, int height)
Index: gnu/java/awt/peer/gtk/GtkFramePeer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java,v
retrieving revision 1.17.2.10
diff -u -r1.17.2.10 GtkFramePeer.java
--- gnu/java/awt/peer/gtk/GtkFramePeer.java	10 Nov 2004 07:19:46 -0000	1.17.2.10
+++ gnu/java/awt/peer/gtk/GtkFramePeer.java	25 Nov 2004 02:31:27 -0000
@@ -89,7 +89,8 @@
         setMenuBarPeer (menuBar);
         int menuBarWidth =
           awtComponent.getWidth () - insets.left - insets.right;
-        setMenuBarWidth (menuBar, menuBarWidth);
+        if (menuBarWidth > 0)
+          setMenuBarWidth (menuBar, menuBarWidth);
         menuBarHeight = getMenuBarHeight ();
         insets.top += menuBarHeight;
         awtComponent.validate ();
@@ -105,7 +106,8 @@
           awtComponent.getWidth () - insets.left - insets.right;
         menuBar = (MenuBarPeer) ((MenuBar) bar).getPeer ();
         setMenuBarPeer (menuBar);
-        setMenuBarWidth (menuBar, menuBarWidth);
+        if (menuBarWidth > 0)
+          setMenuBarWidth (menuBar, menuBarWidth);
         menuBarHeight = getMenuBarHeight ();
         if (oldHeight != menuBarHeight)
           {
@@ -118,8 +120,9 @@
 
   public void setBounds (int x, int y, int width, int height)
   {
-    if (menuBar != null)
-      setMenuBarWidth (menuBar, width - insets.left - insets.right);
+    int menuBarWidth = width - insets.left - insets.right;
+    if (menuBar != null && menuBarWidth > 0)
+      setMenuBarWidth (menuBar, menuBarWidth);
 
     nativeSetBounds (x, y,
 		     width - insets.left - insets.right,
@@ -225,7 +228,8 @@
         || frame_width != awtComponent.getWidth()
         || frame_height != awtComponent.getHeight())
       {
-        if (frame_width != awtComponent.getWidth() && menuBar != null)
+        if (frame_width != awtComponent.getWidth() && menuBar != null
+            && width > 0)
           setMenuBarWidth (menuBar, width);
 
         setBoundsCallback ((Window) awtComponent,
Index: gnu/java/awt/peer/gtk/GtkImage.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/awt/peer/gtk/GtkImage.java,v
retrieving revision 1.4.8.3
diff -u -r1.4.8.3 GtkImage.java
--- gnu/java/awt/peer/gtk/GtkImage.java	5 Aug 2004 13:59:13 -0000	1.4.8.3
+++ gnu/java/awt/peer/gtk/GtkImage.java	25 Nov 2004 02:31:27 -0000
@@ -230,7 +230,7 @@
 	     int offset, int scansize)
   {
     setPixels (x, y, width, height, cm, convertPixels (pixels), offset,
-	       scansize);
+               scansize);
 
     if (observer != null)
       observer.imageUpdate (this,
@@ -255,7 +255,8 @@
 
     if (scansize == width && height == 1)
       {
-	System.arraycopy (pixels, offset, 
+        // Copy contents of pixels array into pixel cache.
+	System.arraycopy (pixels, offset,
 			  pixelCache, y * this.width + x,
 			  pixels.length - offset);
       }
@@ -274,7 +275,7 @@
     if (status == ImageConsumer.STATICIMAGEDONE && isCacheable)
       isLoaded = true;
 
-    if (status == ImageConsumer.SINGLEFRAMEDONE)
+    if (status == ImageConsumer.SINGLEFRAME)
       isCacheable = false;
 
     if (observer != null)
@@ -289,7 +290,7 @@
 				-1, -1, -1, -1);
       }
 
-    if (source != null)
+    if (source != null && status != ImageConsumer.SINGLEFRAME)
       source.removeConsumer (this);
   }
 
Index: gnu/java/awt/peer/gtk/GtkImagePainter.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/awt/peer/gtk/GtkImagePainter.java,v
retrieving revision 1.2.18.5
diff -u -r1.2.18.5 GtkImagePainter.java
--- gnu/java/awt/peer/gtk/GtkImagePainter.java	2 Sep 2004 21:26:21 -0000	1.2.18.5
+++ gnu/java/awt/peer/gtk/GtkImagePainter.java	25 Nov 2004 02:31:27 -0000
@@ -42,6 +42,7 @@
 import java.awt.Rectangle;
 import java.awt.image.ColorModel;
 import java.awt.image.ImageConsumer;
+import java.awt.image.ImageObserver;
 import java.util.Hashtable;
 
 public class GtkImagePainter implements Runnable, ImageConsumer
@@ -57,10 +58,11 @@
   boolean flipX, flipY;
   Rectangle clip;
   int s_width, s_height;
+  ImageObserver observer;
 
   public
   GtkImagePainter (GtkImage image, GdkGraphics gc, int x, int y, 
-		   int width, int height, Color bgcolor)
+		   int width, int height, Color bgcolor, ImageObserver o)
   {
     this.image = image;
     this.gc = (GdkGraphics) gc.create ();
@@ -74,6 +76,7 @@
     flipX = flipY = false;
     s_width = s_height = 0;
     clip = null;
+    observer = o;
 
     run ();
   }
@@ -82,7 +85,7 @@
   GtkImagePainter (GtkImage image, GdkGraphics gc, 
 		   int dx1, int dy1, int dx2, int dy2,
 		   int sx1, int sy1, int sx2, int sy2,
-		   Color bgcolor)
+		   Color bgcolor, ImageObserver o)
   {
     this.image = image;
     this.gc = (GdkGraphics) gc.create ();
@@ -91,6 +94,7 @@
     redBG = bgcolor.getRed ();
     greenBG = bgcolor.getGreen ();
     blueBG = bgcolor.getBlue ();
+    observer = o;
 
     this.width = Math.abs (dx2 - dx1);
     this.height = Math.abs (dy2 - dy1);
@@ -126,7 +130,7 @@
 
     if (model.equals (ColorModel.getRGBdefault ()))
       return pixels;
-    
+
     int ret[] = new int[pixels.length];
 
     for (int i = 0; i < pixels.length; i++)
@@ -180,6 +184,11 @@
 	        startX + x, startY + y,
 		width, height, convertPixels (pixels, model), offset,
 		scansize, affine);
+
+    if (observer != null)
+      observer.imageUpdate (image,
+			    ImageObserver.SOMEBITS,
+			    x, y, width, height);
   }
 
   public void 
@@ -247,5 +256,17 @@
   imageComplete (int status)
   {
     image.imageComplete(status);
+
+    if (observer != null)
+      {
+	if (status == ImageConsumer.IMAGEERROR)
+	  observer.imageUpdate (null,
+				ImageObserver.ERROR,
+				-1, -1, -1, -1);
+	else
+	  observer.imageUpdate (null,
+				ImageObserver.ALLBITS,
+				-1, -1, -1, -1);
+      }
   }
 }
Index: java/applet/Applet.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/applet/Applet.java,v
retrieving revision 1.3.36.5
diff -u -r1.3.36.5 Applet.java
--- java/applet/Applet.java	27 May 2004 19:43:01 -0000	1.3.36.5
+++ java/applet/Applet.java	25 Nov 2004 02:31:27 -0000
@@ -77,6 +77,12 @@
   /** The applet stub for this applet. */
   private transient AppletStub stub;
 
+  /** Some applets call setSize in their constructors.  In that case,
+      these fields are used to store width and height values until a
+      stub is set. */
+  private transient int width;
+  private transient int height;
+
   /**
    * The accessibility context for this applet.
    *
@@ -106,6 +112,9 @@
   public final void setStub(AppletStub stub)
   {
     this.stub = stub;
+
+    if (width != 0 && height != 0)
+      stub.appletResize (width, height);
   }
 
   /**
@@ -173,7 +182,13 @@
    */
   public void resize(int width, int height)
   {
-    stub.appletResize(width, height);
+    if (stub == null)
+      {
+        this.width = width;
+        this.height = height;
+      }
+    else
+      stub.appletResize(width, height);
   }
 
   /**
Index: java/awt/Component.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Component.java,v
retrieving revision 1.37.2.27
diff -u -r1.37.2.27 Component.java
--- java/awt/Component.java	23 Nov 2004 13:11:57 -0000	1.37.2.27
+++ java/awt/Component.java	25 Nov 2004 02:31:27 -0000
@@ -1380,7 +1380,7 @@
             shouldRepaintSelf = parentBounds.intersects(newBounds);
           }
 
-        if (shouldRepaintParent)
+        if (shouldRepaintParent && parent != null)
           parent.repaint(oldx, oldy, oldwidth, oldheight);
         if (shouldRepaintSelf)
           repaint();
Index: java/awt/image/MemoryImageSource.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/image/MemoryImageSource.java,v
retrieving revision 1.5.16.4
diff -u -r1.5.16.4 MemoryImageSource.java
--- java/awt/image/MemoryImageSource.java	27 Sep 2004 15:14:32 -0000	1.5.16.4
+++ java/awt/image/MemoryImageSource.java	25 Nov 2004 02:31:28 -0000
@@ -52,8 +52,16 @@
     private Vector consumers = new Vector();
 
     /**
-       Constructs an ImageProducer from memory
-    */
+     * Construct an image producer that reads image data from a byte
+     * array.
+     *
+     * @param w width of image
+     * @param h height of image
+     * @param cm the color model used to represent pixel values
+     * @param pix a byte array of pixel values
+     * @param off the offset into the array at which the first pixel is stored
+     * @param scan the number of array elements that represents a single pixel row
+     */
     public MemoryImageSource(int w, int h, ColorModel cm,
 			     byte pix[], int off, int scan)
     {
@@ -73,12 +81,19 @@
 	scansize = scan;
 	this.props = props;
 	int max = (( scansize > width ) ? scansize : width );
-	pixelb = new byte[ max  * height ];
-	System.arraycopy( pix, 0, pixelb, 0, max * height );
+	pixelb = pix;
     }
     /**
-       Constructs an ImageProducer from memory
-    */
+     * Construct an image producer that reads image data from an
+     * integer array.
+     *
+     * @param w width of image
+     * @param h height of image
+     * @param cm the color model used to represent pixel values
+     * @param pix an integer array of pixel values
+     * @param off the offset into the array at which the first pixel is stored
+     * @param scan the number of array elements that represents a single pixel row
+     */
     public MemoryImageSource(int w, int h, ColorModel cm,
 			     int pix[], int off, int scan)
     {
@@ -99,8 +114,7 @@
 	scansize = scan;
 	this.props = props;
 	int max = (( scansize > width ) ? scansize : width );
-	pixeli = new int[ max  * height ];
-	System.arraycopy( pix, 0, pixeli, 0, max * height );
+	pixeli = pix;
     }
     /**
        Constructs an ImageProducer from memory using the default RGB ColorModel
@@ -165,7 +179,10 @@
 	for(int i = 0; i < list.size(); i++) {
 	    ic = (ImageConsumer) list.elementAt(i);
 	    sendPicture( ic );
-	    ic.imageComplete( ImageConsumer.STATICIMAGEDONE );
+            if (animated)
+              ic.imageComplete( ImageConsumer.SINGLEFRAME );
+            else
+              ic.imageComplete( ImageConsumer.STATICIMAGEDONE );
 	}	
     }
 
@@ -259,13 +276,14 @@
 			    }
 			    if( pixeli != null ) {
 				int[] pixelbuf = new int[w * h];
-				for (int row = y; row < h; row++)
-				    System.arraycopy(pixeli, row * scansize + x + offset, pixelbuf, row * w, w);
+				for (int row = y; row < y + h; row++)
+				    System.arraycopy(pixeli, row * scansize + x + offset, pixelbuf, 0, w * h);
 				ic.setPixels( x, y, w, h, cm, pixelbuf, 0, w );
 			    } else {
 				byte[] pixelbuf = new byte[w * h];
-				for (int row = y; row < h; row++)
-				    System.arraycopy(pixelb, row * scansize + x + offset, pixelbuf, row * w, w);
+				for (int row = y; row < y + h; row++)
+                                  System.arraycopy(pixelb, row * scansize + x + offset, pixelbuf, 0, w * h);
+
 				ic.setPixels( x, y, w, h, cm, pixelbuf, 0, w );
 			    }
 			    ic.imageComplete( ImageConsumer.SINGLEFRAME );
@@ -304,13 +322,13 @@
 			    }
 			    if( pixeli != null ) {
 				int[] pixelbuf = new int[w * h];
-				for (int row = y; row < h; row++)
-				    System.arraycopy(pixeli, row * scansize + x + offset, pixelbuf, row * w, w);
+				for (int row = y; row < y + h; row++)
+				    System.arraycopy(pixeli, row * scansize + x + offset, pixelbuf, 0, w * h);
 				ic.setPixels( x, y, w, h, cm, pixelbuf, 0, w );
 			    } else {
 				byte[] pixelbuf = new byte[w * h];
-				for (int row = y; row < h; row++)
-				    System.arraycopy(pixelb, row * scansize + x + offset, pixelbuf, row * w, w);
+				for (int row = y; row < y + h; row++)
+				    System.arraycopy(pixelb, row * scansize + x + offset, pixelbuf, 0, w * h);
 				ic.setPixels( x, y, w, h, cm, pixelbuf, 0, w );
 			    }
 			    if( framenotify == true )
Index: jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c,v
retrieving revision 1.5.2.13
diff -u -r1.5.2.13 gnu_java_awt_peer_gtk_GdkGraphics.c
--- jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c	7 Nov 2004 00:04:27 -0000	1.5.2.13
+++ jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c	25 Nov 2004 02:31:31 -0000
@@ -150,6 +150,7 @@
 {
   struct graphics *g;
 
+  
   g = (struct graphics *) NSA_DEL_PTR (env, obj);
 
   if (!g) return;		/* dispose has been called more than once */
@@ -222,7 +223,7 @@
   pango_layout_iter_free (iter);
   pango_layout_set_text (pfont->layout, "", -1);
 
-  /* gdk_flush (); */
+  gdk_flush ();
   gdk_threads_leave ();
 
   (*env)->ReleaseStringUTFChars (env, str, cstr);
@@ -240,7 +241,7 @@
   gdk_draw_line (g->drawable, g->gc, 
 		 x + g->x_offset, y + g->y_offset, 
 		 x2 + g->x_offset, y2 + g->y_offset);
-  /* gdk_flush (); */
+  gdk_flush ();
   gdk_threads_leave ();
 }
 
@@ -256,7 +257,7 @@
 
   gdk_draw_rectangle (g->drawable, g->gc, TRUE, 
 		      x + g->x_offset, y + g->y_offset, width, height);
-  /* gdk_flush (); */
+  gdk_flush ();
   gdk_threads_leave ();
 }
 
@@ -271,7 +272,7 @@
   gdk_threads_enter ();
   gdk_draw_rectangle (g->drawable, g->gc, FALSE, 
 		      x + g->x_offset, y + g->y_offset, width, height);
-  /* gdk_flush (); */
+  gdk_flush ();
   gdk_threads_leave ();
 }
 
@@ -291,7 +292,7 @@
 			(GdkWindow *)g->drawable,
 			x + g->x_offset, y + g->y_offset,
 			width, height);
-  /* gdk_flush (); */
+  gdk_flush ();
   gdk_threads_leave ();
 }
 
@@ -312,7 +313,7 @@
 			(GdkWindow *)g2->drawable,
 			0 + g2->x_offset, 0 + g2->y_offset, 
 			width, height);
-  /* gdk_flush (); */
+  gdk_flush ();
   gdk_threads_leave ();
 }
 
@@ -503,7 +504,7 @@
   gdk_draw_arc (g->drawable, g->gc, FALSE, 
 		x + g->x_offset, y + g->y_offset, 
 		width, height, angle1 << 6, angle2 << 6);
-  /* gdk_flush (); */
+  gdk_flush ();
   gdk_threads_leave ();
 }  
 
@@ -548,7 +549,7 @@
 
   gdk_threads_enter ();
   gdk_draw_lines (g->drawable, g->gc, points, npoints);
-  /* gdk_flush (); */
+  gdk_flush ();
   gdk_threads_leave ();
 
   g_free (points);
@@ -573,7 +574,7 @@
 
   gdk_threads_enter ();
   gdk_draw_lines (g->drawable, g->gc, points, npoints);
-  /* gdk_flush (); */
+  gdk_flush ();
   gdk_threads_leave ();
 
   g_free (points);
@@ -592,7 +593,7 @@
 			     g->x_offset, g->y_offset);
   gdk_threads_enter ();
   gdk_draw_polygon (g->drawable, g->gc, TRUE, points, npoints);
-  /* gdk_flush (); */
+  gdk_flush ();
   gdk_threads_leave ();
 
   g_free (points);
@@ -611,7 +612,7 @@
   gdk_draw_arc (g->drawable, g->gc, TRUE, 
 		x + g->x_offset, y + g->y_offset, 
 		width, height, angle1 << 6, angle2 << 6);
-  /* gdk_flush (); */
+  gdk_flush ();
   gdk_threads_leave ();
 }  
 
@@ -627,7 +628,7 @@
   gdk_draw_arc (g->drawable, g->gc, FALSE, 
 		x + g->x_offset, y + g->y_offset, 
 		width, height, 0, 23040);
-  /* gdk_flush (); */
+  gdk_flush ();
   gdk_threads_leave ();
 }  
 
@@ -643,7 +644,7 @@
   gdk_draw_arc (g->drawable, g->gc, TRUE, 
 		x + g->x_offset, y + g->y_offset, 
 		width, height, 0, 23040);
-  /* gdk_flush (); */
+  gdk_flush ();
   gdk_threads_leave ();
 }
 
Index: jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c,v
retrieving revision 1.2.16.3
diff -u -r1.2.16.3 gnu_java_awt_peer_gtk_GtkImagePainter.c
--- jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c	7 Nov 2004 00:04:27 -0000	1.2.16.3
+++ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c	25 Nov 2004 02:31:31 -0000
@@ -148,6 +148,12 @@
 
   gdk_threads_enter ();
 
+  if (!g || !GDK_IS_DRAWABLE (g->drawable))
+    {
+      gdk_threads_leave ();
+      return;
+    }
+
   gdk_draw_rgb_image (g->drawable,
 		      g->gc,
 		      x + g->x_offset, 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]