aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/awt/Component.java
diff options
context:
space:
mode:
authorThomas Fitzsimmons <fitzsim@redhat.com>2003-11-12 00:37:34 +0000
committerThomas Fitzsimmons <fitzsim@gcc.gnu.org>2003-11-12 00:37:34 +0000
commita5966c9ef9036294c09f0729f9950b90b1d1c3b5 (patch)
tree76d0f90da057662bc2f5deb1bc000be30244807e /libjava/java/awt/Component.java
parentc754c6f1311f79ce60dfdf9e8d61b9557a36808f (diff)
downloadgcc-a5966c9ef9036294c09f0729f9950b90b1d1c3b5.zip
gcc-a5966c9ef9036294c09f0729f9950b90b1d1c3b5.tar.gz
gcc-a5966c9ef9036294c09f0729f9950b90b1d1c3b5.tar.bz2
Makefile.am: Add GdkPixbufDecoder.java and gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
2003-11-11 Thomas Fitzsimmons <fitzsim@redhat.com> * Makefile.am: Add GdkPixbufDecoder.java and gnu_java_awt_peer_gtk_GdkPixbufDecoder.c * Makefile.in: Regenerate. * gnu/java/awt/image/ImageDecoder.java (ImageDecoder(byte[],int,int)): New constructor. (startProduction): Create ByteArrayInputStream when url and filename are null. (produce): Declare stream parameter as InputStream. * gnu/java/awt/image/XBMDecoder.java (produce): Declare stream parameter as InputStream. * gnu/java/awt/peer/gtk/GdkPixbufDecoder.java (GdkPixbufDecoder(byte[],int,int)): New constructor. (produce): Declare stream parameter as InputStream. * gnu/java/awt/peer/gtk/GtkComponentPeer.java (prepareImage): Throw NPE if image is null. Set image's observer before running PrepareImage thread. Pass image to startProduction. * gnu/java/awt/peer/gtk/GtkImage.java: Add null checks before calls to source's member functions. (observer): New field. (setObserver): New method. (setDimensions, setPixels, imageComplete): Call observer's imageUpdate. * gnu/java/awt/peer/gtk/GtkToolkit.java (checkImage, getImage): Return new GtkImage. (prepareImage): Implement. * java/awt/Component.java: Add static fields incrementalDraw and redrawRate. (imageUpdate): Implement. (createImage): Call Toolkit's createImage if peer is null. (prepareImage): Throw NPE if image is null. * java/awt/MediaTracker.java: Fix return value. From-SVN: r73476
Diffstat (limited to 'libjava/java/awt/Component.java')
-rw-r--r--libjava/java/awt/Component.java45
1 files changed, 40 insertions, 5 deletions
diff --git a/libjava/java/awt/Component.java b/libjava/java/awt/Component.java
index d70ed50..74b4dae 100644
--- a/libjava/java/awt/Component.java
+++ b/libjava/java/awt/Component.java
@@ -555,6 +555,17 @@ public abstract class Component
*/
transient BufferStrategy bufferStrategy;
+ /**
+ * The system properties that affect image updating.
+ */
+ private static transient boolean incrementalDraw;
+ private static transient Long redrawRate;
+
+ static
+ {
+ incrementalDraw = Boolean.getBoolean ("awt.image.incrementalDraw");
+ redrawRate = Long.getLong ("awt.image.redrawrate");
+ }
// Public and protected API.
@@ -1832,7 +1843,9 @@ public abstract class Component
* @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 abstract class Component
*/
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 abstract class Component
*/
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 abstract class Component
*/
public boolean prepareImage(Image image, ImageObserver observer)
{
+ if (image == null)
+ throw new NullPointerException ();
+
return prepareImage(image, image.getWidth(observer),
image.getHeight(observer), observer);
}