On Fri, 2003-11-07 at 15:00, Tom Tromey wrote:
> >>>>> "Tom" == Thomas Fitzsimmons <[EMAIL PROTECTED]> writes:
> 
> Tom> This patch fixes various problems related to image loading.  It also
> Tom> implements Component.imageUpdate, GtkToolkit.prepareImage and the
> Tom> byte-array GtkToolkit.createImage method.
> 
> Looks good.
> 
> Tom> -    // FIXME - gcj local: GdkPixbufDecoder doesn't work.
> Tom> -    // return new GtkImage (new GdkPixbufDecoder (filename), null);
> Tom> -    return null;
> Tom> +    return new GtkImage (new GdkPixbufDecoder (filename), null);
> 
> I don't remember why I commented out this code in libgcj, other than
> what the comment says.  I assume it is ok to enable now?
> 

Yes, we can remove these FIXMEs since Graydon fixed GdkPixbufDecoder.

> Tom> +    boolean incrementalDraw = Boolean.getBoolean ("awt.image.incrementalDraw");
> Tom> +    Long redrawRate = Long.getLong ("awt.image.redrawrate");
> 
> Should these be computed once, at class init time?

Yes, looking again, I think they should.

> Or do we want to recompute them each time this method is called?
> 
> Also, I forget where and how we're documenting properties we
> recognize.  I know this has come up before though.  These two should
> at least be mentioned in the javadoc for the method.
> 

Yup, they're already mentioned in the existing javadoc.

Are the attached changes to Component.java ok?  If so, I'll check them
in along with the rest of the patch.

Tom

Index: java/awt/Component.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Component.java,v
retrieving revision 1.29
diff -u -r1.29 Component.java
--- java/awt/Component.java	20 Sep 2003 21:30:39 -0000	1.29
+++ java/awt/Component.java	11 Nov 2003 21:22:58 -0000
@@ -555,6 +555,17 @@
    */
   transient BufferStrategy bufferStrategy;
 
+  /**
+   * The system properties that affect image updating.
+   */
+  transient private static boolean incrementalDraw;
+  transient private static Long redrawRate;
+
+  static
+  {
+    incrementalDraw = Boolean.getBoolean ("awt.image.incrementalDraw");
+    redrawRate = Long.getLong ("awt.image.redrawrate");
+  }
 
   // Public and protected API.
 
@@ -1832,7 +1843,9 @@
    * @param y the Y coordinate
    * @param w the width
    * @param h the height
-   * @return true if the image has been fully loaded
+   * @return false if the image is completely loaded, loading has been
+   * aborted, or an error has occurred.  true if more updates are
+   * required.
    * @see ImageObserver
    * @see Graphics#drawImage(Image, int, int, Color, ImageObserver)
    * @see Graphics#drawImage(Image, int, int, ImageObserver)
@@ -1842,8 +1855,24 @@
    */
   public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h)
   {
-    // XXX Implement.
-    throw new Error("not implemented");
+    if ((flags & (FRAMEBITS|ALLBITS)) != 0)
+      repaint ();
+    else if ((flags & SOMEBITS) != 0)
+      {
+	if (incrementalDraw)
+	  {
+	    if (redrawRate != null)
+	      {
+		long tm = redrawRate.longValue();
+		if (tm < 0)
+		  tm = 0;
+		repaint (tm);
+	      }
+	    else
+	      repaint (100);
+	  }
+      }
+    return (flags & (ALLBITS|ABORT|ERROR)) == 0;
   }
 
   /**
@@ -1854,8 +1883,11 @@
    */
   public Image createImage(ImageProducer producer)
   {
-    // XXX What if peer or producer is null?
-    return peer.createImage(producer);
+    // Sun allows producer to be null.
+    if (peer != null)
+      return peer.createImage(producer);
+    else
+      return getToolkit().createImage(producer);
   }
 
   /**
@@ -1930,6 +1962,9 @@
    */
   public boolean prepareImage(Image image, ImageObserver observer)
   {
+    if (image == null)
+      throw new NullPointerException ();
+
     return prepareImage(image, image.getWidth(observer),
                         image.getHeight(observer), observer);
   }
_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to