Ignore:
Timestamp:
2008-01-30T18:02:38+01:00 (18 years ago)
Author:
gebner
Message:

Part one of patch by Dave Hansen <dave@…>

  • Remove unused imports
  • Main.debug
  • Make attribute merging aware of TIGER-import attributes
  • Better upload progress information
  • Retry uploads
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r431 r529  
    3939         * The icon cache
    4040         */
    41         private static Map<URL, Image> cache = new HashMap<URL, Image>();
     41        private static Map<String, Image> cache = new HashMap<String, Image>();
    4242
    4343        /**
     
    7575                        subdir += "/";
    7676                String ext = name.indexOf('.') != -1 ? "" : ".png";
     77                String full_name = subdir+name+ext;
    7778
    78                 URL path = getImageUrl(subdir+name+ext);
    79                 if (path == null)
    80                         return null;
    81                
    82                 Image img = cache.get(path);
     79                Image img = cache.get(full_name);
    8380                if (img == null) {
     81                        // getImageUrl() does a ton of "stat()" calls and gets expensive
     82                        // and redundant when you have a whole ton of objects.  So,
     83                        // index the cache by the name of the icon we're looking for
     84                        // and don't bother to create a URL unless we're actually
     85                        // creating the image.
     86                        URL path = getImageUrl(full_name);
     87                        if (path == null)
     88                                return null;
    8489                        img = Toolkit.getDefaultToolkit().createImage(path);
    85                         cache.put(path, img);
     90                        cache.put(full_name, img);
    8691                }
     92       
    8793                return new ImageIcon(img);
    8894        }
Note: See TracChangeset for help on using the changeset viewer.