mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Update LibGDX March 29, 2020, Use Google cache
(reverted the cache so there's room for dependency like android-support-v4, permissions in the future, lighter than cache2k)
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -104,24 +104,6 @@
|
||||
<artifactId>gdx-backend-android</artifactId>
|
||||
<version>1.9.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cache2k</groupId>
|
||||
<artifactId>cache2k-base-bom</artifactId>
|
||||
<version>1.2.4.Final</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cache2k</groupId>
|
||||
<artifactId>cache2k-core</artifactId>
|
||||
<version>1.2.4.Final</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cache2k</groupId>
|
||||
<artifactId>cache2k-api</artifactId>
|
||||
<version>1.2.4.Final</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
||||
@@ -30,20 +30,6 @@
|
||||
-dontwarn org.apache.logging.log4j.**
|
||||
-dontwarn module-info
|
||||
|
||||
# mandatory proguard rules for cache2k to keep the core implementation
|
||||
-dontwarn org.cache2k.impl.xmlConfiguration.**
|
||||
-dontwarn org.cache2k.impl.serverSide.**
|
||||
-keep interface org.cache2k.spi.Cache2kCoreProvider
|
||||
-keep public class * extends org.cache2k.spi.Cache2kCoreProvider
|
||||
# optional proguard rules for cache2k, to keep XML configuration code
|
||||
# if only programmatic configuration is used, these rules may be ommitted
|
||||
-keep interface org.cache2k.core.spi.CacheConfigurationProvider
|
||||
-keep public class * extends org.cache2k.core.spi.CacheConfigurationProvider
|
||||
-keepclassmembers public class * extends org.cache2k.configuration.ConfigurationBean {
|
||||
public void set*(...);
|
||||
public ** get*();
|
||||
}
|
||||
|
||||
-keep class forge.** { *; }
|
||||
-keep class com.thoughtworks.xstream.** { *; }
|
||||
-keep class org.apache.commons.lang3.** { *; }
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -75,23 +75,5 @@
|
||||
<artifactId>gdx-backend-robovm</artifactId>
|
||||
<version>1.9.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cache2k</groupId>
|
||||
<artifactId>cache2k-base-bom</artifactId>
|
||||
<version>1.2.4.Final</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cache2k</groupId>
|
||||
<artifactId>cache2k-core</artifactId>
|
||||
<version>1.2.4.Final</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cache2k</groupId>
|
||||
<artifactId>cache2k-api</artifactId>
|
||||
<version>1.2.4.Final</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -80,23 +80,5 @@
|
||||
<artifactId>commons-cli</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cache2k</groupId>
|
||||
<artifactId>cache2k-base-bom</artifactId>
|
||||
<version>1.2.4.Final</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cache2k</groupId>
|
||||
<artifactId>cache2k-core</artifactId>
|
||||
<version>1.2.4.Final</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cache2k</groupId>
|
||||
<artifactId>cache2k-api</artifactId>
|
||||
<version>1.2.4.Final</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -70,24 +70,6 @@
|
||||
<artifactId>gdx-freetype</artifactId>
|
||||
<version>1.9.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cache2k</groupId>
|
||||
<artifactId>cache2k-base-bom</artifactId>
|
||||
<version>1.2.4.Final</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cache2k</groupId>
|
||||
<artifactId>cache2k-core</artifactId>
|
||||
<version>1.2.4.Final</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cache2k</groupId>
|
||||
<artifactId>cache2k-api</artifactId>
|
||||
<version>1.2.4.Final</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -22,6 +22,8 @@ import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Pixmap.Format;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import forge.ImageKeys;
|
||||
import forge.card.CardEdition;
|
||||
import forge.game.card.CardView;
|
||||
@@ -32,11 +34,11 @@ import forge.model.FModel;
|
||||
import forge.properties.ForgeConstants;
|
||||
import forge.util.ImageUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.cache2k.Cache;
|
||||
import org.cache2k.Cache2kBuilder;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* This class stores ALL card images in a cache with soft values. this means
|
||||
@@ -56,13 +58,10 @@ public class ImageCache {
|
||||
// short prefixes to save memory
|
||||
|
||||
private static final Set<String> missingIconKeys = new HashSet<>();
|
||||
private static final Cache<String, Texture> cache = new Cache2kBuilder<String, Texture>() {}
|
||||
.name("cache")
|
||||
.eternal(true)
|
||||
.permitNullValues(true)
|
||||
.disableStatistics(true)
|
||||
.loader(new ImageLoader())
|
||||
.build();
|
||||
private static final LoadingCache<String, Texture> cache = CacheBuilder.newBuilder()
|
||||
.maximumSize(400)
|
||||
.expireAfterAccess(15, TimeUnit.MINUTES)
|
||||
.build(new ImageLoader());
|
||||
public static final Texture defaultImage;
|
||||
public static FImage BlackBorder = FSkinImage.IMG_BORDER_BLACK;
|
||||
public static FImage WhiteBorder = FSkinImage.IMG_BORDER_WHITE;
|
||||
@@ -85,7 +84,7 @@ public class ImageCache {
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
cache.clear();
|
||||
cache.invalidateAll();
|
||||
missingIconKeys.clear();
|
||||
}
|
||||
|
||||
@@ -134,7 +133,7 @@ public class ImageCache {
|
||||
Texture image;
|
||||
if (useDefaultIfNotFound) {
|
||||
// Load from file and add to cache if not found in cache initially.
|
||||
image = cache.get(imageKey);
|
||||
image = cache.getIfPresent(imageKey);
|
||||
|
||||
if (image != null) { return image; }
|
||||
|
||||
@@ -165,7 +164,11 @@ public class ImageCache {
|
||||
return image;
|
||||
}
|
||||
public static void preloadCache(Iterable<String> keys) {
|
||||
cache.getAll(keys);
|
||||
try {
|
||||
cache.getAll(keys);
|
||||
} catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static TextureRegion croppedBorderImage(Texture image, boolean fullborder) {
|
||||
if (!fullborder)
|
||||
|
||||
@@ -8,8 +8,8 @@ import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.TextureData;
|
||||
import com.badlogic.gdx.graphics.glutils.PixmapTextureData;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import forge.FThreads;
|
||||
import org.cache2k.integration.CacheLoader;
|
||||
|
||||
import forge.Forge;
|
||||
import forge.ImageKeys;
|
||||
|
||||
Reference in New Issue
Block a user