forked from External/mage
Add mechanism to register image caches and flush them all on GUI size change
This should avoid the issue of having lots of unused entries in caches if the GUI size is changed multiple times.
This commit is contained in:
parent
415c8cce7e
commit
1999dfe5c0
2 changed files with 36 additions and 0 deletions
34
Mage.Client/src/main/java/mage/client/util/ImageCaches.java
Normal file
34
Mage.Client/src/main/java/mage/client/util/ImageCaches.java
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.client.util;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author user
|
||||
*/
|
||||
public class ImageCaches {
|
||||
private static Vector<Map> IMAGE_CACHES;
|
||||
|
||||
static {
|
||||
IMAGE_CACHES = new Vector<Map>();
|
||||
}
|
||||
|
||||
public static Map register(Map map)
|
||||
{
|
||||
IMAGE_CACHES.add(map);
|
||||
return map;
|
||||
}
|
||||
|
||||
public static void flush()
|
||||
{
|
||||
for (Map map : IMAGE_CACHES) {
|
||||
map.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue