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);
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);
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);