Do not wait for ALLBITS in ImageLoader since this never comes for animated GIFs!

This commit is contained in:
hns 2002-12-16 13:05:28 +00:00
parent 13f6e778d4
commit ec7cf8f4c5

View file

@ -104,9 +104,11 @@ public class ImageGenerator {
Image img; Image img;
int w, h; int w, h;
boolean waiting;
ImageLoader (Image img) { ImageLoader (Image img) {
this.img = img; this.img = img;
waiting = true;
} }
int getWidth () { int getWidth () {
@ -123,7 +125,10 @@ public class ImageGenerator {
if (w == -1 || h == -1) try { if (w == -1 || h == -1) try {
wait (30000); wait (30000);
} catch (InterruptedException x) { } catch (InterruptedException x) {
waiting = false;
return; return;
} finally {
waiting = false;
} }
// if width and height haven't been set, throw tantrum // if width and height haven't been set, throw tantrum
if (w == -1 || h == -1) { if (w == -1 || h == -1) {
@ -142,20 +147,14 @@ public class ImageGenerator {
w = width; w = width;
if (h == -1 && (infoflags & HEIGHT) > 0) if (h == -1 && (infoflags & HEIGHT) > 0)
h = height; h = height;
if (h > -1 && w > -1 && (infoflags & ALLBITS) > 0) { if (h > -1 && w > -1) {
// we know all we want to know. notify waiting thread that // we know all we want to know. notify waiting thread that
// the image is loaded and ready to be used. // the image is loaded and ready to be used.
notifyAll (); notifyAll ();
return false; return false;
} }
// check if there was an error // check if there was an error
if ((infoflags & ERROR) > 0) { if (!waiting || (infoflags & ERROR) > 0 || (infoflags & ABORT) > 0) {
notifyAll ();
return false;
}
// TODO: If image production was aborted, but no error was reported,
// we might want to start production again. For now, we just give up.
if ((infoflags & ABORT) > 0) {
notifyAll (); notifyAll ();
return false; return false;
} }