- Timestamp:
- 2020-08-29T13:33:21+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/StyleElement.java
r16553 r16959 171 171 172 172 private static class FontDescriptor { 173 publicString name;174 publicint style;175 publicint size;173 final String name; 174 final int style; 175 final int size; 176 176 177 177 FontDescriptor(String name, int style, int size) { … … 199 199 private static final Map<FontDescriptor, Font> FONT_MAP = new HashMap<>(); 200 200 201 private static Font getCachedFont(FontDescriptor fd) {202 Font f = FONT_MAP.get(fd);203 if (f != null) return f;204 f = new Font(fd.name, fd.style, fd.size);205 FONT_MAP.put(fd, f);206 return f;207 }208 209 201 private static Font getCachedFont(String name, int style, int size) { 210 return getCachedFont(new FontDescriptor(name, style,size));202 return FONT_MAP.computeIfAbsent(new FontDescriptor(name, style, size), fd -> new Font(fd.name, fd.style, fd.size)); 211 203 } 212 204
Note:
See TracChangeset
for help on using the changeset viewer.