diff options
author | Bryce McKinlay <mckinlay@redhat.com> | 2002-01-25 04:41:10 +0000 |
---|---|---|
committer | Bryce McKinlay <mckinlay@redhat.com> | 2002-01-25 04:41:10 +0000 |
commit | 30161e4541b48410a522ad98e393687f4e58e110 (patch) | |
tree | 7a88fac57d44e2c13b7f16c81cb74a3d4a5d994e /java/awt | |
parent | 3d0ccec064bd96fab09c7ba073889027e3930e19 (diff) | |
download | classpath-30161e4541b48410a522ad98e393687f4e58e110.tar.gz |
* java/awt/image/PixelGrabber.java (grabPixels()): Call grabPixels(0).
(grabPixels(long)): Wait to be notified that the ImageProducer has
completed.
Diffstat (limited to 'java/awt')
-rw-r--r-- | java/awt/image/PixelGrabber.java | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/java/awt/image/PixelGrabber.java b/java/awt/image/PixelGrabber.java index efa98856c..65e831e98 100644 --- a/java/awt/image/PixelGrabber.java +++ b/java/awt/image/PixelGrabber.java @@ -155,15 +155,7 @@ public class PixelGrabber implements ImageConsumer */ public boolean grabPixels() throws InterruptedException { - startGrabbing(); - while ( (status != ImageObserver.ALLBITS ) || - (status != ImageObserver.ERROR ) || - (status != ImageObserver.ABORT ) ); - - if( status == ImageObserver.ALLBITS ) - return true; - else - return false; + return grabPixels(0); } /** @@ -176,24 +168,17 @@ public class PixelGrabber implements ImageConsumer */ public synchronized boolean grabPixels(long ms) throws InterruptedException { - long start = System.currentTimeMillis(); startGrabbing(); - while ( (status != ImageObserver.ALLBITS ) || - (status != ImageObserver.ERROR ) || - (status != ImageObserver.ABORT ) ) - { - if( (System.currentTimeMillis() - start ) >= ms ) - { - abortGrabbing(); - throw new InterruptedException(); - } - } - - if( status == ImageObserver.ALLBITS ) + + if (ms < 0) + return (status == ImageObserver.ALLBITS); + + wait(ms); + + if (status == ImageObserver.ALLBITS) return true; else return false; - } /** |