2002-01-25 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* java/lang/natObject.cc (X86 compare_and_swap): Use +m constraint.
+
+ * java/awt/image/PixelGrabber.java (grabPixels()): Call grabPixels(0).
+ * java/awt/image/PixelGrabber.java (grabPixels(long)): Wait to be
+ notified that the ImageProducer has completed.
2002-01-24 Per Bothner <per@bothner.com>
*/
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);
}
/**
*/
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;
-
}
/**