Ticket #16510: cache_v2.patch
| File cache_v2.patch, 1.2 KB (added by , 8 years ago) |
|---|
-
ImageProvider.java
306 306 * The icon cache 307 307 */ 308 308 private static final Map<String, ImageResource> cache = new HashMap<>(); 309 private static final Map<String, ImageIcon> typeCache = new HashMap<>(); 309 310 310 311 /** 311 312 * Caches the image data for rotated versions of the same image. … … 836 837 synchronized (cache) { 837 838 cache.clear(); 838 839 } 840 synchronized (typeCache) { 841 typeCache.clear(); 842 } 839 843 } 840 844 841 845 /** … … 1473 1477 */ 1474 1478 public static ImageIcon get(OsmPrimitiveType type) { 1475 1479 CheckParameterUtil.ensureParameterNotNull(type, "type"); 1476 return get("data", type.getAPIName()); 1480 synchronized (typeCache) { 1481 ImageIcon ii = typeCache.get(type.getAPIName()); 1482 if (ii == null) { 1483 ii = get("data", type.getAPIName()); 1484 if (ii != null) 1485 typeCache.put(type.getAPIName(), ii); 1486 } 1487 return ii; 1488 } 1477 1489 } 1478 1490 1479 1491 /**
