faster imageToShape

This commit is contained in:
2015-03-18 00:10:18 +01:00
parent 553999ddba
commit c24f753adb
4 changed files with 215 additions and 25 deletions
@@ -1979,13 +1979,17 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
if (swf == null) {
return;
}
List<Tag> tags = new ArrayList<>(swf.tags);
List<Tag> toRemove = new ArrayList<>();
for (Tag tag : tags) {
System.out.println(tag.getClass());
if (!(tag instanceof ABCContainerTag || tag instanceof ASMSource)) {
swf.removeTag(tag, true);
toRemove.add(tag);
}
}
swf.removeTags(toRemove, true);
refreshTree(swf);
}
@@ -45,7 +45,9 @@ import java.awt.event.MouseEvent;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JMenu;
@@ -519,8 +521,18 @@ public class TagTreeContextMenu extends JPopupMenu implements ActionListener {
}
if (View.showConfirmDialog(this, confirmationMessage, mainPanel.translate("message.confirm"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
Map<SWF, List<Tag>> tagsToRemoveBySwf = new HashMap<>();
for (Tag tag : tagsToRemove) {
tag.getSwf().removeTag(tag, removeDependencies);
SWF swf = tag.getSwf();
if (!tagsToRemoveBySwf.containsKey(swf)) {
tagsToRemoveBySwf.put(swf, new ArrayList<>());
}
tagsToRemoveBySwf.get(swf).add(tag);
}
for (SWF swf : tagsToRemoveBySwf.keySet()) {
swf.removeTags(tagsToRemoveBySwf.get(swf), removeDependencies);
}
mainPanel.refreshTree(null);