trackeditor: speed up image has alpha check with cache
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9269 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 778e5a9e6cffa0d31d147e3d866abab792c36596 Former-commit-id: c2cd977dd27321dacfa314aed068e0e0f6af096b
This commit is contained in:
parent
4f2334a23d
commit
8e3912c0ae
2 changed files with 10 additions and 3 deletions
|
@ -12,8 +12,10 @@ import java.io.File;
|
|||
import java.io.FileReader;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
|
@ -55,6 +57,7 @@ public class CheckDialog extends JDialog
|
|||
private Set<String> textures = new HashSet<String>();
|
||||
private String dataDirectory = null;
|
||||
private TrackData trackData = null;
|
||||
private Map<String,Boolean> imageHasAlpha = new HashMap<String, Boolean>();
|
||||
|
||||
public CheckDialog(EditorFrame editorFrame)
|
||||
{
|
||||
|
@ -1054,9 +1057,13 @@ public class CheckDialog extends JDialog
|
|||
{
|
||||
try
|
||||
{
|
||||
BufferedImage image = ImageIO.read(textureFile);
|
||||
if (!imageHasAlpha.containsKey(textureFile.getAbsolutePath()))
|
||||
{
|
||||
BufferedImage image = ImageIO.read(textureFile);
|
||||
imageHasAlpha.put(textureFile.getAbsolutePath(), image.getColorModel().hasAlpha());
|
||||
}
|
||||
|
||||
if (!image.getColorModel().hasAlpha())
|
||||
if (imageHasAlpha.get(textureFile.getAbsolutePath()))
|
||||
{
|
||||
doubleSided = true;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class Properties
|
|||
private static Properties instance = new Properties();
|
||||
private Vector<ActionListener> propertiesListeners = new Vector<ActionListener>();
|
||||
public final String title = "sd2-trackeditor";
|
||||
public final String version = "1.4.14";
|
||||
public final String version = "1.4.15";
|
||||
private String path;
|
||||
|
||||
private double imageScale = 1;
|
||||
|
|
Loading…
Reference in a new issue