From bf6eb30ef6f7433871d80c0972f9159517c2b870 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 18 Dec 2006 04:24:23 +0000 Subject: [PATCH] Whoops added scale caching to the wrong method. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@98 ed5b42cb-e716-0410-a449-f6a68f950b19 --- src/java/com/threerings/jme/util/ImageCache.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/java/com/threerings/jme/util/ImageCache.java b/src/java/com/threerings/jme/util/ImageCache.java index ac5668a0..6e1e4791 100644 --- a/src/java/com/threerings/jme/util/ImageCache.java +++ b/src/java/com/threerings/jme/util/ImageCache.java @@ -201,11 +201,10 @@ public class ImageCache * @param scale a scale factor to apply to the image. As with the flip setting, the scale * factor is not cached. */ - public Image getImage (String rsrcPath, float scale, boolean flip) - { + public Image getImage (String rsrcPath, float scale, boolean flip) + { // first check the cache - String key = rsrcPath + ":" + scale; - WeakReference iref = _imgcache.get(key); + WeakReference iref = _imgcache.get(rsrcPath); Image image; if (iref != null && (image = iref.get()) != null) { return image; @@ -225,7 +224,7 @@ public class ImageCache // create and cache a new JME image with the appropriate data image = createImage(bufimg, scale, flip); - _imgcache.put(key, new WeakReference(image)); + _imgcache.put(rsrcPath, new WeakReference(image)); return image; } @@ -252,7 +251,8 @@ public class ImageCache public BImage getBImage (String rsrcPath, float scale, boolean returnNull) { // first check the cache - WeakReference iref = _buicache.get(rsrcPath); + String key = rsrcPath + ":" + scale; + WeakReference iref = _buicache.get(key); BImage image; if (iref != null && (image = iref.get()) != null) { return image; @@ -277,7 +277,7 @@ public class ImageCache bufimg.getScaledInstance(Math.round(bufimg.getWidth()*scale), Math.round(bufimg.getHeight()*scale), BufferedImage.SCALE_SMOOTH), true); - _buicache.put(rsrcPath, new WeakReference(image)); + _buicache.put(key, new WeakReference(image)); return image; }