Ignore:
Timestamp:
2015-08-08T12:30:05+02:00 (9 years ago)
Author:
wiktorn
Message:

Performance improvements.

  • MemoryTileCache now can be initialized with desired cache size
  • Tile.loadPlaceholderFromCache now uses lazy evaluation and created BufferedImage only when something is found in cache. This dramatically improves MapView drawing when a lot of tiles is missing
File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/MemoryTileCache.java

    r31434 r31466  
    2323     * Default cache size
    2424     */
    25     protected int cacheSize = 200;
     25    protected int cacheSize;
    2626
    2727    protected final Map<String, CacheEntry> hash;
     
    3636     */
    3737    public MemoryTileCache() {
     38        this(200);
     39    }
     40
     41    /**
     42     * Constructs a new {@code MemoryTileCache}.
     43     * @param cacheSize size of the cache
     44     */
     45    public MemoryTileCache(int cacheSize) {
     46        this.cacheSize = cacheSize;
    3847        hash = new HashMap<>(cacheSize);
    3948        lruTiles = new CacheLinkedListElement();
    4049    }
     50
    4151
    4252    @Override
Note: See TracChangeset for help on using the changeset viewer.