Disable IOImage cache use for image loads

This commit is contained in:
Mike Primm 2011-08-26 03:48:42 +08:00 committed by mikeprimm
parent 04cc6aba43
commit 316440a4e0

View File

@ -369,6 +369,7 @@ public class TexturePack {
private void loadTerrainPNG(InputStream is) throws IOException { private void loadTerrainPNG(InputStream is) throws IOException {
int i, j; int i, j;
/* Load image */ /* Load image */
ImageIO.setUseCache(false);
BufferedImage img = ImageIO.read(is); BufferedImage img = ImageIO.read(is);
if(img == null) { throw new FileNotFoundException(); } if(img == null) { throw new FileNotFoundException(); }
terrain_width = img.getWidth(); terrain_width = img.getWidth();
@ -429,6 +430,7 @@ public class TexturePack {
/* Load image into image array */ /* Load image into image array */
private void loadImage(InputStream is, int idx) throws IOException { private void loadImage(InputStream is, int idx) throws IOException {
/* Load image */ /* Load image */
ImageIO.setUseCache(false);
BufferedImage img = ImageIO.read(is); BufferedImage img = ImageIO.read(is);
if(img == null) { throw new FileNotFoundException(); } if(img == null) { throw new FileNotFoundException(); }
imgs[idx] = new LoadedImage(); imgs[idx] = new LoadedImage();
@ -642,6 +644,7 @@ public class TexturePack {
} }
} }
BufferedImage img = DynmapBufferedImage.createBufferedImage(outbuf, terrain_width, terrain_height); BufferedImage img = DynmapBufferedImage.createBufferedImage(outbuf, terrain_width, terrain_height);
ImageIO.setUseCache(false);
ImageIO.write(img, "png", f); ImageIO.write(img, "png", f);
} }