2003/12/16 20:55:24
authordavid <david@xwt.org>
Fri, 30 Jan 2004 07:42:55 +0000 (07:42 +0000)
committerdavid <david@xwt.org>
Fri, 30 Jan 2004 07:42:55 +0000 (07:42 +0000)
darcs-hash:20040130074255-0c9ea-a78d7093cafc10ddd9acab654395a1811cbad93d.gz

src/org/xwt/Picture.java
src/org/xwt/translators/GIF.java
src/org/xwt/translators/PNG.java

index eb32928..f0eafec 100644 (file)
@@ -30,11 +30,11 @@ public class Picture {
     public static Picture load(final Res r, final Scheduler.Task callback) {
         Picture ret = (Picture)cache.get(r);
         if (ret == null) cache.put(r, ret = Platform.createPicture(r));
+        final Picture p = ret;
         if (!ret.isLoaded && callback != null)
             new java.lang.Thread() { public void run() {
                 try {
                     PushbackInputStream pbis = new PushbackInputStream(r.getInputStream());
-                    Picture p = null;
                     int firstByte = pbis.read();
                     if (firstByte == -1) throw new JSExn("empty stream reading image");
                     pbis.unread(firstByte);
index 53dca2b..d2cfed8 100644 (file)
@@ -60,7 +60,7 @@ public class GIF {
     private static Queue instances = new Queue(10);
 
     public static void load(InputStream is, Picture p) {
-        GIF g = (GIF)instances.remove();
+        GIF g = (GIF)instances.remove(false);
         if (g == null) g = new GIF();
         try {
             g._load(is, p);
index a514ff4..a3578f9 100644 (file)
@@ -29,7 +29,7 @@ public class PNG {
     private static Queue instances = new Queue(10);
 
     public static void load(InputStream is, Picture p) {
-        PNG g = (PNG)instances.remove();
+        PNG g = (PNG)instances.remove(false);
         if (g == null) g = new PNG();
         try {
             g._load(is, p);