mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 06:10:47 +00:00
faster imageToShape
This commit is contained in:
@@ -87,7 +87,7 @@ public class IdentifiersDeobfuscation {
|
||||
if (s == null) {
|
||||
return false;
|
||||
}
|
||||
String reservedWords[] = as3 ? reservedWordsAS3 : reservedWordsAS2;
|
||||
String[] reservedWords = as3 ? reservedWordsAS3 : reservedWordsAS2;
|
||||
for (String rw : reservedWords) {
|
||||
if (rw.equals(s.trim())) {
|
||||
return true;
|
||||
|
||||
@@ -861,12 +861,12 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
}
|
||||
}
|
||||
|
||||
/* preload shape tags
|
||||
for (Tag tag : tags) {
|
||||
if (tag instanceof ShapeTag) {
|
||||
((ShapeTag) tag).getShapes();
|
||||
}
|
||||
}*/
|
||||
/*preload shape tags*/
|
||||
for (Tag tag : tags) {
|
||||
if (tag instanceof ShapeTag) {
|
||||
((ShapeTag) tag).getShapes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1063,7 +1063,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
break;
|
||||
}
|
||||
case 'Z': { // ZWS
|
||||
byte lzmaprop[] = new byte[9];
|
||||
byte[] lzmaprop = new byte[9];
|
||||
is.read(lzmaprop);
|
||||
sis = new SWFInputStream(null, lzmaprop);
|
||||
sis.readUI32("LZMAsize"); // compressed LZMA data size = compressed SWF - 17 byte,
|
||||
|
||||
@@ -154,7 +154,7 @@ public class ZippedSWFBundle implements SWFBundle {
|
||||
ZipEntry entryIn;
|
||||
ZipEntry entryOut;
|
||||
|
||||
byte swfData[] = Helper.readStream(swfIs);
|
||||
byte[] swfData = Helper.readStream(swfIs);
|
||||
|
||||
try {
|
||||
while ((entryIn = zis.getNextEntry()) != null) {
|
||||
@@ -169,7 +169,7 @@ public class ZippedSWFBundle implements SWFBundle {
|
||||
zos.putNextEntry(entryOut);
|
||||
Helper.copyStream(src, zos, entryOut.getSize() == -1 ? Long.MAX_VALUE : entryOut.getSize());
|
||||
zos.closeEntry();
|
||||
zis.closeEntry();
|
||||
zis.closeEntry();
|
||||
}
|
||||
} finally {
|
||||
zis.close();
|
||||
|
||||
@@ -132,7 +132,7 @@ public abstract class AVM2Item extends GraphTargetItem {
|
||||
ops.add(o);
|
||||
}
|
||||
}
|
||||
int opArr[] = new int[ops.size()];
|
||||
int[] opArr = new int[ops.size()];
|
||||
for (int i = 0; i < ops.size(); i++) {
|
||||
opArr[i] = ops.get(i);
|
||||
}
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public class InitVectorAVM2Item extends AVM2Item {
|
||||
List<Integer> openedNamespaces;
|
||||
|
||||
private int allNsSet(ABC abc) {
|
||||
int nssa[] = new int[openedNamespaces.size()];
|
||||
int[] nssa = new int[openedNamespaces.size()];
|
||||
for (int i = 0; i < openedNamespaces.size(); i++) {
|
||||
nssa[i] = openedNamespaces.get(i);
|
||||
}
|
||||
|
||||
+2
-2
@@ -178,7 +178,7 @@ public class ASM3Parser {
|
||||
}
|
||||
loopn:
|
||||
for (int n = 1; n < constants.getNamespaceSetCount(); n++) {
|
||||
int nss[] = constants.getNamespaceSet(n).namespaces;
|
||||
int[] nss = constants.getNamespaceSet(n).namespaces;
|
||||
if (nss.length != namespaceList.size()) {
|
||||
continue;
|
||||
}
|
||||
@@ -189,7 +189,7 @@ public class ASM3Parser {
|
||||
}
|
||||
return n;
|
||||
}
|
||||
int nss[] = new int[namespaceList.size()];
|
||||
int[] nss = new int[namespaceList.size()];
|
||||
for (int i = 0; i < nss.length; i++) {
|
||||
nss[i] = namespaceList.get(i);
|
||||
}
|
||||
|
||||
+6
-6
@@ -158,7 +158,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
}
|
||||
|
||||
public List<GraphSourceItem> generate(SourceGeneratorLocalData localData, GetDescendantsAVM2Item item) throws CompilationException {
|
||||
int nssa[] = new int[item.openedNamespaces.size()];
|
||||
int[] nssa = new int[item.openedNamespaces.size()];
|
||||
for (int i = 0; i < item.openedNamespaces.size(); i++) {
|
||||
nssa[i] = item.openedNamespaces.get(i);
|
||||
}
|
||||
@@ -332,7 +332,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
trueBody.addAll(toInsList(AssignableAVM2Item.getTemp(localData, this, xmlListReg)));
|
||||
trueBody.addAll(toInsList(AssignableAVM2Item.getTemp(localData, this, counterReg)));
|
||||
trueBody.addAll(toInsList(AssignableAVM2Item.getTemp(localData, this, tempVal1)));
|
||||
int nss[] = new int[item.openedNamespaces.size()];
|
||||
int[] nss = new int[item.openedNamespaces.size()];
|
||||
for (int i = 0; i < item.openedNamespaces.size(); i++) {
|
||||
nss[i] = item.openedNamespaces.get(i);
|
||||
}
|
||||
@@ -1583,9 +1583,9 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
int param_types[] = new int[paramTypes.size()];
|
||||
ValueKind optional[] = new ValueKind[paramValues.size()];
|
||||
//int param_names[] = new int[paramNames.size()];
|
||||
int[] param_types = new int[paramTypes.size()];
|
||||
ValueKind[] optional = new ValueKind[paramValues.size()];
|
||||
//int[] param_names = new int[paramNames.size()];
|
||||
for (int i = 0; i < paramTypes.size(); i++) {
|
||||
param_types[i] = typeName(localData, paramTypes.get(i));
|
||||
//param_names[i] = str(paramNames.get(i));
|
||||
@@ -1931,7 +1931,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
}
|
||||
TypeItem sup = (TypeItem) un;
|
||||
int propId = resolveType(localData, sup, abc, allABCs);
|
||||
int nss[] = new int[]{abc.constants.constant_multiname.get(propId).namespace_index};
|
||||
int[] nss = new int[]{abc.constants.constant_multiname.get(propId).namespace_index};
|
||||
return abc.constants.getMultinameId(new Multiname(Multiname.MULTINAME, abc.constants.constant_multiname.get(propId).name_index, 0, abc.constants.getNamespaceSetId(new NamespaceSet(nss), true), 0, new ArrayList<Integer>()), true);
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ public class ConstructSomethingAVM2Item extends CallAVM2Item {
|
||||
}
|
||||
|
||||
private int allNsSetWithVec(ABC abc) {
|
||||
int nssa[] = new int[openedNamespaces.size() + 1];
|
||||
int[] nssa = new int[openedNamespaces.size() + 1];
|
||||
for (int i = 0; i < openedNamespaces.size(); i++) {
|
||||
nssa[i] = openedNamespaces.get(i);
|
||||
}
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ public class IndexAVM2Item extends AssignableAVM2Item {
|
||||
}
|
||||
|
||||
private int allNsSet(ABC abc) {
|
||||
int nssa[] = new int[openedNamespaces.size()];
|
||||
int[] nssa = new int[openedNamespaces.size()];
|
||||
for (int i = 0; i < openedNamespaces.size(); i++) {
|
||||
nssa[i] = openedNamespaces.get(i);
|
||||
}
|
||||
|
||||
+1
-1
@@ -169,7 +169,7 @@ public class NameAVM2Item extends AssignableAVM2Item {
|
||||
}
|
||||
|
||||
private int allNsSet(ABC abc) {
|
||||
int nssa[] = new int[openedNamespaces.size()];
|
||||
int[] nssa = new int[openedNamespaces.size()];
|
||||
for (int i = 0; i < openedNamespaces.size(); i++) {
|
||||
nssa[i] = openedNamespaces.get(i);
|
||||
}
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ public class NamespacedAVM2Item extends AssignableAVM2Item {
|
||||
}
|
||||
|
||||
private int allNsSet(ABC abc) {
|
||||
int nssa[] = new int[openedNamespaces.size()];
|
||||
int[] nssa = new int[openedNamespaces.size()];
|
||||
for (int i = 0; i < openedNamespaces.size(); i++) {
|
||||
nssa[i] = openedNamespaces.get(i);
|
||||
}
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
|
||||
}
|
||||
|
||||
private int allNsSet() {
|
||||
int nssa[] = new int[openedNamespaces.size()];
|
||||
int[] nssa = new int[openedNamespaces.size()];
|
||||
for (int i = 0; i < openedNamespaces.size(); i++) {
|
||||
nssa[i] = openedNamespaces.get(i);
|
||||
}
|
||||
|
||||
+2
-2
@@ -187,7 +187,7 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
|
||||
}
|
||||
|
||||
private int allNsSet(ABC abc) {
|
||||
int nssa[] = new int[openedNamespaces.size()];
|
||||
int[] nssa = new int[openedNamespaces.size()];
|
||||
for (int i = 0; i < openedNamespaces.size(); i++) {
|
||||
nssa[i] = openedNamespaces.get(i);
|
||||
}
|
||||
@@ -292,7 +292,7 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
|
||||
public GraphTargetItem resolve(GraphTargetItem thisType, List<GraphTargetItem> paramTypes, List<String> paramNames, ABC abc, List<ABC> otherAbcs, List<MethodBody> callStack, List<AssignableAVM2Item> variables) throws CompilationException {
|
||||
List<String> parts = new ArrayList<>();
|
||||
if (name.contains(".")) {
|
||||
String partsArr[] = name.split("\\.");
|
||||
String[] partsArr = name.split("\\.");
|
||||
parts.addAll(Arrays.asList(partsArr));
|
||||
} else {
|
||||
parts.add(name);
|
||||
|
||||
@@ -730,7 +730,7 @@ public class Configuration {
|
||||
public static File getPlayerSWC() {
|
||||
File libsdir = getFlashLibPath();
|
||||
if (libsdir != null && libsdir.exists()) {
|
||||
File libs[] = libsdir.listFiles(new FilenameFilter() {
|
||||
File[] libs = libsdir.listFiles(new FilenameFilter() {
|
||||
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
|
||||
@@ -255,7 +255,7 @@ public class FrameExporter {
|
||||
try (FileOutputStream fos = new FileOutputStream(fh); FileInputStream fis = new FileInputStream(fmin)) {
|
||||
fos.write(Utf8Helper.getBytes(CanvasShapeExporter.getHtmlPrefix(width, height)));
|
||||
fos.write(Utf8Helper.getBytes(CanvasShapeExporter.getJsPrefix()));
|
||||
byte buf[] = new byte[1000];
|
||||
byte[] buf = new byte[1000];
|
||||
int cnt;
|
||||
while ((cnt = fis.read(buf)) > 0) {
|
||||
fos.write(buf, 0, cnt);
|
||||
@@ -337,14 +337,14 @@ public class FrameExporter {
|
||||
new RetryTask(new RunnableIOEx() {
|
||||
@Override
|
||||
public void run() throws IOException {
|
||||
File f = new File(foutdir + File.separator + (fframes.get(fi) + 1) + ".png");
|
||||
try (FileOutputStream fos = new FileOutputStream(f)) {
|
||||
ImageHelper.write(frameImages.next(), "PNG", fos);
|
||||
}
|
||||
ret.add(f);
|
||||
File file = new File(foutdir + File.separator + (fframes.get(fi) + 1) + ".png");
|
||||
ImageHelper.write(frameImages.next(), "PNG", file);
|
||||
ret.add(file);
|
||||
}
|
||||
}, handler).run();
|
||||
}
|
||||
|
||||
//ShapeExporterBase.clearCache();
|
||||
break;
|
||||
case PDF:
|
||||
new RetryTask(new RunnableIOEx() {
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ImageTag;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -92,9 +91,7 @@ public class ImageExporter {
|
||||
if (ffileFormat.equals("bmp")) {
|
||||
BMPFile.saveBitmap(imageTag.getImage().getBufferedImage(), file);
|
||||
} else {
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
ImageHelper.write(imageTag.getImage().getBufferedImage(), ffileFormat.toUpperCase(Locale.ENGLISH), fos);
|
||||
}
|
||||
ImageHelper.write(imageTag.getImage().getBufferedImage(), ffileFormat.toUpperCase(Locale.ENGLISH), file);
|
||||
}
|
||||
}
|
||||
}, handler).run();
|
||||
|
||||
@@ -127,9 +127,7 @@ public class ShapeExporter {
|
||||
m.scale(settings.zoom);
|
||||
st.toImage(0, 0, 0, new RenderContext(), img, m, new CXFORMWITHALPHA());
|
||||
if (settings.mode == ShapeExportMode.PNG) {
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
ImageHelper.write(img.getBufferedImage(), "PNG", fos);
|
||||
}
|
||||
ImageHelper.write(img.getBufferedImage(), "PNG", file);
|
||||
} else {
|
||||
BMPFile.saveBitmap(img.getBufferedImage(), file);
|
||||
}
|
||||
|
||||
+6
-1
@@ -47,6 +47,8 @@ import java.util.logging.Logger;
|
||||
*/
|
||||
public class AS2ScriptExporter {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(AS2ScriptExporter.class.getName());
|
||||
|
||||
public List<File> exportAS2ScriptsTimeout(final AbortRetryIgnoreHandler handler, final String outdir, final Map<String, ASMSource> asms, final ScriptExportMode exportMode, final EventListener evl) throws IOException {
|
||||
try {
|
||||
List<File> result = CancellableWorker.call(new Callable<List<File>>() {
|
||||
@@ -57,7 +59,10 @@ public class AS2ScriptExporter {
|
||||
}
|
||||
}, Configuration.exportTimeout.get(), TimeUnit.SECONDS);
|
||||
return result;
|
||||
} catch (ExecutionException | InterruptedException | TimeoutException ex) {
|
||||
} catch (TimeoutException ex) {
|
||||
logger.log(Level.SEVERE, Helper.formatTimeToText(Configuration.exportTimeout.get()) + " ActionScript export limit reached", ex);
|
||||
} catch (ExecutionException | InterruptedException ex) {
|
||||
logger.log(Level.SEVERE, "Error during AS2 export", ex);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -508,4 +508,8 @@ public abstract class ShapeExporterBase implements IShapeExporter {
|
||||
v1.add(v2.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearCache() {
|
||||
exportDataCache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ public class BMPFile extends Component {
|
||||
|
||||
//--- Private variable declaration
|
||||
//--- Bitmap file header
|
||||
private final byte bitmapFileHeader[] = new byte[14];
|
||||
private final byte[] bitmapFileHeader = new byte[14];
|
||||
|
||||
private final byte bfType[] = {'B', 'M'};
|
||||
private final byte[] bfType = {'B', 'M'};
|
||||
|
||||
private int bfSize = 0;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class BMPFile extends Component {
|
||||
private final int bfOffBits = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE;
|
||||
|
||||
//--- Bitmap info header
|
||||
private final byte bitmapInfoHeader[] = new byte[40];
|
||||
private final byte[] bitmapInfoHeader = new byte[40];
|
||||
|
||||
private final int biSize = BITMAPINFOHEADER_SIZE;
|
||||
|
||||
@@ -74,7 +74,7 @@ public class BMPFile extends Component {
|
||||
private final int biClrImportant = 0;
|
||||
|
||||
//--- Bitmap raw data
|
||||
private int bitmap[];
|
||||
private int[] bitmap;
|
||||
|
||||
//--- File section
|
||||
private FileOutputStream fo;
|
||||
@@ -148,7 +148,7 @@ public class BMPFile extends Component {
|
||||
int lastRowIndex;
|
||||
int pad;
|
||||
int padCount;
|
||||
byte rgb[] = new byte[3];
|
||||
byte[] rgb = new byte[3];
|
||||
size = (biWidth * biHeight);
|
||||
pad = (biWidth * 3) % 4;
|
||||
rowCount = 1;
|
||||
@@ -221,7 +221,7 @@ public class BMPFile extends Component {
|
||||
*/
|
||||
|
||||
private byte[] intToWord(int parValue) {
|
||||
byte retValue[] = new byte[2];
|
||||
byte[] retValue = new byte[2];
|
||||
retValue[0] = (byte) (parValue & 0x00FF);
|
||||
retValue[1] = (byte) ((parValue >> 8) & 0x00FF);
|
||||
return (retValue);
|
||||
@@ -234,7 +234,7 @@ public class BMPFile extends Component {
|
||||
*/
|
||||
|
||||
private byte[] intToDWord(int parValue) {
|
||||
byte retValue[] = new byte[4];
|
||||
byte[] retValue = new byte[4];
|
||||
retValue[0] = (byte) (parValue & 0x00FF);
|
||||
retValue[1] = (byte) ((parValue >> 8) & 0x000000FF);
|
||||
retValue[2] = (byte) ((parValue >> 16) & 0x000000FF);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class FontHelper {
|
||||
*/
|
||||
public static Map<String, Map<String, Font>> getInstalledFonts() {
|
||||
Map<String, Map<String, Font>> ret = new HashMap<>();
|
||||
Font fonts[] = null;
|
||||
Font[] fonts = null;
|
||||
|
||||
try {
|
||||
|
||||
@@ -194,7 +194,7 @@ public class FontHelper {
|
||||
withKerningAttrs.put(TextAttribute.KERNING, TextAttribute.KERNING_ON);
|
||||
Font withKerningFont = Font.getFont(withKerningAttrs);
|
||||
GlyphVector withKerningVector = withKerningFont.layoutGlyphVector(getFontRenderContext(withKerningFont), chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT);
|
||||
int withKerningX[] = new int[availableChars.size()];
|
||||
int[] withKerningX = new int[availableChars.size()];
|
||||
for (int i = 0; i < availableChars.size(); i++) {
|
||||
withKerningX[i] = withKerningVector.getGlyphLogicalBounds(i * 2 + 1).getBounds().x;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.helpers;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@@ -47,6 +48,10 @@ public class ImageHelper {
|
||||
return in;
|
||||
}
|
||||
|
||||
public static void write(BufferedImage image, String formatName, File output) throws IOException {
|
||||
ImageIO.write(image, formatName, output);
|
||||
}
|
||||
|
||||
public static void write(BufferedImage image, String formatName, OutputStream output) throws IOException {
|
||||
ImageIO.write(image, formatName, output);
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ public class DefineSoundTag extends CharacterTag implements SoundTag {
|
||||
boolean newSoundSize = false;
|
||||
boolean newSoundType = false;
|
||||
long newSoundSampleCount = -1;
|
||||
byte newSoundData[];
|
||||
byte[] newSoundData;
|
||||
switch (newSoundFormat) {
|
||||
case SoundFormat.FORMAT_UNCOMPRESSED_LITTLE_ENDIAN:
|
||||
try (AudioInputStream audioIs = AudioSystem.getAudioInputStream(new BufferedInputStream(is))) {
|
||||
@@ -238,7 +238,7 @@ public class DefineSoundTag extends CharacterTag implements SoundTag {
|
||||
case SoundFormat.FORMAT_MP3:
|
||||
BufferedInputStream bis = new BufferedInputStream(is);
|
||||
loadID3v2(bis);
|
||||
byte mp3data[] = Helper.readStream(bis);
|
||||
byte[] mp3data = Helper.readStream(bis);
|
||||
|
||||
final int ID3_V1_LENTGH = 128;
|
||||
final int ID3_V1_EXT_LENGTH = 227;
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ public class DefineExternalGradient extends Tag {
|
||||
sos.writeUI16(gradientId);
|
||||
sos.writeUI16(bitmapsFormat);
|
||||
sos.writeUI16(gradientSize);
|
||||
byte fileNameBytes[] = fileName.getBytes();
|
||||
byte[] fileNameBytes = fileName.getBytes();
|
||||
sos.writeUI8(fileNameBytes.length);
|
||||
sos.write(fileNameBytes);
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -64,7 +64,7 @@ public class DefineExternalImage extends Tag {
|
||||
sos.writeUI16(bitmapFormat);
|
||||
sos.writeUI16(targetWidth);
|
||||
sos.writeUI16(targetHeight);
|
||||
byte fileNameBytes[] = fileName.getBytes();
|
||||
byte[] fileNameBytes = fileName.getBytes();
|
||||
sos.writeUI8(fileNameBytes.length);
|
||||
sos.write(fileNameBytes);
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -68,10 +68,10 @@ public class DefineExternalImage2 extends Tag {
|
||||
sos.writeUI16(bitmapFormat);
|
||||
sos.writeUI16(targetWidth);
|
||||
sos.writeUI16(targetHeight);
|
||||
byte exportNameBytes[] = exportName.getBytes();
|
||||
byte[] exportNameBytes = exportName.getBytes();
|
||||
sos.writeUI8(exportNameBytes.length);
|
||||
sos.write(exportNameBytes);
|
||||
byte fileNameBytes[] = fileName.getBytes();
|
||||
byte[] fileNameBytes = fileName.getBytes();
|
||||
sos.writeUI8(fileNameBytes.length);
|
||||
sos.write(fileNameBytes);
|
||||
if (extraData != null) {
|
||||
|
||||
@@ -33,7 +33,7 @@ public class DefineGradientMap extends Tag {
|
||||
|
||||
public static final int ID = 1004;
|
||||
|
||||
public int indices[];
|
||||
public int[] indices;
|
||||
|
||||
/**
|
||||
* Gets data bytes
|
||||
|
||||
@@ -77,7 +77,7 @@ public class ExporterInfo extends Tag {
|
||||
sos.writeUI16(bitmapFormat);
|
||||
sos.writeUI8(prefix.length);
|
||||
sos.write(prefix);
|
||||
byte swfNameBytes[] = swfName.getBytes();
|
||||
byte[] swfNameBytes = swfName.getBytes();
|
||||
sos.writeUI8(swfNameBytes.length);
|
||||
sos.write(swfNameBytes);
|
||||
if (codeOffsets != null) {
|
||||
|
||||
@@ -52,9 +52,9 @@ public class FontTextureInfo extends Tag {
|
||||
|
||||
public int nominalGlyphSz;
|
||||
|
||||
public TEXGLYPH texGlyphs[];
|
||||
public TEXGLYPH[] texGlyphs;
|
||||
|
||||
public FONTINFO fonts[];
|
||||
public FONTINFO[] fonts;
|
||||
|
||||
public static final int TEXTURE_FORMAT_DEFAULT = 0;
|
||||
|
||||
@@ -75,7 +75,7 @@ public class FontTextureInfo extends Tag {
|
||||
try {
|
||||
sos.writeUI32(textureID);
|
||||
sos.writeUI16(textureFormat);
|
||||
byte fileNameBytes[] = fileName.getBytes();
|
||||
byte[] fileNameBytes = fileName.getBytes();
|
||||
sos.writeUI8(fileNameBytes.length);
|
||||
sos.write(fileNameBytes);
|
||||
sos.writeUI16(textureWidth);
|
||||
|
||||
@@ -52,7 +52,7 @@ public class CLIPACTIONRECORD implements ASMSource, Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public static final String KEYNAMES[] = {
|
||||
public static final String[] KEYNAMES = {
|
||||
null,
|
||||
"<Left>",
|
||||
"<Right>",
|
||||
|
||||
+6
-5
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
*/
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.types.annotations.parser;
|
||||
|
||||
import com.jpexs.decompiler.flash.types.annotations.Conditional;
|
||||
@@ -113,7 +114,7 @@ public class ConditionEvaluator {
|
||||
}
|
||||
|
||||
private String prepareCond() {
|
||||
String vals[] = cond.value();
|
||||
String[] vals = cond.value();
|
||||
if (vals == null || vals.length == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -254,9 +254,9 @@ public class Filtering {
|
||||
int width = src.getWidth();
|
||||
int height = src.getHeight();
|
||||
BufferedImage retImg = new BufferedImage(width, height, src.getType());
|
||||
int srcPixels[] = getRGB(src);
|
||||
int[] srcPixels = getRGB(src);
|
||||
|
||||
int revPixels[] = new int[srcPixels.length];
|
||||
int[] revPixels = new int[srcPixels.length];
|
||||
for (int i = 0; i < srcPixels.length; i++) {
|
||||
revPixels[i] = (srcPixels[i] & 0xffffff) + ((255 - ((srcPixels[i] >> 24) & 0xff)) << 24);
|
||||
}
|
||||
@@ -333,7 +333,7 @@ public class Filtering {
|
||||
break;
|
||||
}
|
||||
|
||||
int mask[] = null;
|
||||
int[] mask = null;
|
||||
if (type == INNER) {
|
||||
mask = srcPixels;
|
||||
}
|
||||
@@ -348,7 +348,7 @@ public class Filtering {
|
||||
retc.drawImage(shadowIm, 0, 0, null);
|
||||
retc.drawImage(hilightIm, 0, 0, null);
|
||||
|
||||
int ret[] = getRGB(retImg);
|
||||
int[] ret = getRGB(retImg);
|
||||
blur(ret, width, height, blurX, blurY, iterations, mask);
|
||||
|
||||
for (int i = 0; i < srcPixels.length; i++) {
|
||||
@@ -390,7 +390,7 @@ public class Filtering {
|
||||
int width = src.getWidth();
|
||||
int height = src.getHeight();
|
||||
int[] srcPixels = getRGB(src);
|
||||
int shadow[] = new int[srcPixels.length];
|
||||
int[] shadow = new int[srcPixels.length];
|
||||
for (int i = 0; i < srcPixels.length; i++) {
|
||||
int alpha = (srcPixels[i] >> 24) & 0xff;
|
||||
if (inner) {
|
||||
@@ -450,13 +450,13 @@ public class Filtering {
|
||||
double angleRad = angle / 180 * Math.PI;
|
||||
double moveX = (distance * Math.cos(angleRad));
|
||||
double moveY = (distance * Math.sin(angleRad));
|
||||
int srcPixels[] = getRGB(src);
|
||||
int revPixels[] = new int[srcPixels.length];
|
||||
int[] srcPixels = getRGB(src);
|
||||
int[] revPixels = new int[srcPixels.length];
|
||||
for (int i = 0; i < srcPixels.length; i++) {
|
||||
revPixels[i] = (srcPixels[i] & 0xffffff) + ((255 - ((srcPixels[i] >> 24) & 0xff)) << 24);
|
||||
}
|
||||
|
||||
int shadow[] = new int[srcPixels.length];
|
||||
int[] shadow = new int[srcPixels.length];
|
||||
for (int i = 0; i < srcPixels.length; i++) {
|
||||
shadow[i] = 0 + ((cut(strength * ((srcPixels[i] >> 24) & 0xff))) << 24);
|
||||
}
|
||||
@@ -464,7 +464,7 @@ public class Filtering {
|
||||
Color colorAlpha = new Color(0, 0, 0, 0);
|
||||
shadow = moveRGB(width, height, shadow, moveX, moveY, colorAlpha);
|
||||
|
||||
int mask[] = null;
|
||||
int[] mask = null;
|
||||
if (type == INNER) {
|
||||
mask = srcPixels;
|
||||
}
|
||||
@@ -549,7 +549,7 @@ public class Filtering {
|
||||
changeColors.filter(sourceRaster, displayRaster);
|
||||
return new SerializableImage(src.getColorModel(), displayRaster, true, null);*/
|
||||
BufferedImage dst = new BufferedImage(src.getWidth(), src.getHeight(), src.getType());
|
||||
int pixels[] = getRGB(src.getBufferedImage()).clone();
|
||||
int[] pixels = getRGB(src.getBufferedImage()).clone();
|
||||
for (int i = 0; i < pixels.length; i++) {
|
||||
int rgb = pixels[i];
|
||||
int a = (rgb >> 24) & 0xff;
|
||||
@@ -599,7 +599,7 @@ public class Filtering {
|
||||
int redAddTerm, int greenAddTerm, int blueAddTerm, int alphaAddTerm,
|
||||
int redMultTerm, int greenMultTerm, int blueMultTerm, int alphaMultTerm) {
|
||||
BufferedImage dst = new BufferedImage(src.getWidth(), src.getHeight(), src.getType());
|
||||
int pixels[] = getRGB(src.getBufferedImage()).clone();
|
||||
int[] pixels = getRGB(src.getBufferedImage()).clone();
|
||||
for (int i = 0; i < pixels.length; i++) {
|
||||
int rgb = pixels[i];
|
||||
int a = (rgb >> 24) & 0xff;
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class EdgeType implements Serializable {
|
||||
|
||||
private static final int sizes[] = new int[]{1, 2, 1, 2, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 9};
|
||||
private static final int[] sizes = new int[]{1, 2, 1, 2, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 9};
|
||||
|
||||
private static final int Edge_H12 = 0; // 2 bytes
|
||||
|
||||
@@ -70,7 +70,7 @@ public class EdgeType implements Serializable {
|
||||
|
||||
private static final int Edge_Quad = 3;
|
||||
|
||||
public int data[];
|
||||
public int[] data;
|
||||
|
||||
public EdgeType(boolean vertical, int v) {
|
||||
data = new int[]{vertical ? Edge_VLine : Edge_HLine, v};
|
||||
@@ -163,7 +163,7 @@ public class EdgeType implements Serializable {
|
||||
int nb = sizes[firstByte & 0xF];
|
||||
byte raw1, raw2, raw3, raw4, raw5, raw6, raw7, raw8, raw9;
|
||||
raw1 = (byte) sis.readUI8("byte1");
|
||||
int data[] = new int[5];
|
||||
int[] data = new int[5];
|
||||
|
||||
switch (firstByte & 0xF) {
|
||||
case Edge_H12:
|
||||
|
||||
@@ -27,7 +27,7 @@ public class FONTINFO implements Serializable {
|
||||
|
||||
public int fontId;
|
||||
|
||||
public GLYPHIDX glyphIndices[];
|
||||
public GLYPHIDX[] glyphIndices;
|
||||
|
||||
public FONTINFO(int fontId, int numGlyphs, GLYPHIDX[] glyphIndices) {
|
||||
this.fontId = fontId;
|
||||
|
||||
@@ -68,7 +68,7 @@ public class FontType implements Serializable {
|
||||
leading = sis.readSI16("leading");
|
||||
long numGlyphs = sis.readUI32("numGlyphs");
|
||||
long glyphBytesLen = sis.readUI32("glyphBytesLen");
|
||||
byte glyphBytes[] = new byte[(int) glyphBytesLen];
|
||||
byte[] glyphBytes = new byte[(int) glyphBytesLen];
|
||||
sis.read(glyphBytes);
|
||||
glyphInfo = new ArrayList<>();
|
||||
for (int i = 0; i < numGlyphs; i++) {
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
*/
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.types.sound;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
@@ -42,8 +43,8 @@ public class MP3Decoder extends SoundDecoder {
|
||||
Bitstream bitstream = new Bitstream(new ByteArrayInputStream(sis.readBytesEx(sis.available(), "soundStream")));
|
||||
SampleBuffer buf;
|
||||
while ((buf = readFrame(decoder, bitstream)) != null) {
|
||||
short audio[] = buf.getBuffer();
|
||||
byte d[] = new byte[buf.getBufferLength() * 2];
|
||||
short[] audio = buf.getBuffer();
|
||||
byte[] d = new byte[buf.getBufferLength() * 2];
|
||||
for (int i = 0; i < buf.getBufferLength(); i++) {
|
||||
int s = audio[i];
|
||||
d[i * 2] = (byte) (s & 0xff);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class NellyMoserDecoder extends SoundDecoder {
|
||||
@Override
|
||||
public void decode(SWFInputStream sis, OutputStream os) throws IOException {
|
||||
soundFormat.stereo = false;
|
||||
float audioD[] = new float[NELLY_SAMPLES];
|
||||
float[] audioD = new float[NELLY_SAMPLES];
|
||||
|
||||
final float[] state = new float[64];
|
||||
|
||||
@@ -48,11 +48,11 @@ public class NellyMoserDecoder extends SoundDecoder {
|
||||
for (int j = 0; j < blockCount; j++) {
|
||||
byte[] block = sis.readBytesEx(NELLY_BLOCK_LEN, "block");
|
||||
CodecImpl.decode(state, block, audioD);
|
||||
short audio[] = new short[NELLY_SAMPLES];
|
||||
short[] audio = new short[NELLY_SAMPLES];
|
||||
for (int i = 0; i < audioD.length; i++) {
|
||||
audio[i] = (short) (audioD[i]);
|
||||
}
|
||||
byte d[] = new byte[audio.length * 2];
|
||||
byte[] d = new byte[audio.length * 2];
|
||||
for (int i = 0; i < audio.length; i++) {
|
||||
int s = audio[i];
|
||||
d[i * 2] = (byte) (s & 0xff);
|
||||
|
||||
@@ -1972,7 +1972,7 @@ public class XFLConverter {
|
||||
embeddedCharacters = embeddedCharacters.replace(".", "");
|
||||
boolean hasAllRanges = false;
|
||||
for (int r = 0; r < CharacterRanges.rangeCount(); r++) {
|
||||
int codes[] = CharacterRanges.rangeCodes(r);
|
||||
int[] codes = CharacterRanges.rangeCodes(r);
|
||||
boolean hasAllInRange = true;
|
||||
for (int i = 0; i < codes.length; i++) {
|
||||
if (!fontChars.contains("" + (char) codes[i])) {
|
||||
|
||||
@@ -159,7 +159,7 @@ public class FileHashMap<K, V> extends AbstractMap<K, V> implements Freed {
|
||||
long ofs = offsets.get(key);
|
||||
int len = lengths.get(key);
|
||||
file.seek(ofs);
|
||||
byte data[] = new byte[len];
|
||||
byte[] data = new byte[len];
|
||||
file.readFully(data);
|
||||
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data));
|
||||
try {
|
||||
@@ -187,7 +187,7 @@ public class FileHashMap<K, V> extends AbstractMap<K, V> implements Freed {
|
||||
oos = new ObjectOutputStream(baos);
|
||||
oos.writeObject(value);
|
||||
oos.flush();
|
||||
byte data[] = baos.toByteArray();
|
||||
byte[] data = baos.toByteArray();
|
||||
if (offsets.containsKey(key)) {
|
||||
long origOffset = offsets.get(key);
|
||||
int origLen = lengths.get(key);
|
||||
|
||||
@@ -873,8 +873,8 @@ public class Helper {
|
||||
}
|
||||
|
||||
public static String escapeHTML(String text) {
|
||||
String from[] = new String[]{"&", "<", ">", "\"", "'", "/"};
|
||||
String to[] = new String[]{"&", "<", ">", """, "'", "/"};
|
||||
String[] from = new String[]{"&", "<", ">", "\"", "'", "/"};
|
||||
String[] to = new String[]{"&", "<", ">", """, "'", "/"};
|
||||
for (int i = 0; i < from.length; i++) {
|
||||
text = text.replace(from[i], to[i]);
|
||||
}
|
||||
@@ -897,11 +897,14 @@ public class Helper {
|
||||
Area area = new Area();
|
||||
Rectangle rectangle = new Rectangle();
|
||||
int y1, y2;
|
||||
for (int x = 0; x < image.getWidth(); x++) {
|
||||
int width = image.getWidth();
|
||||
int height = image.getHeight();
|
||||
int[] imgData = image.getRGB(0, 0, width, height, null, 0, width);
|
||||
for (int x = 0; x < width; x++) {
|
||||
y1 = Integer.MAX_VALUE;
|
||||
y2 = -1;
|
||||
for (int y = 0; y < image.getHeight(); y++) {
|
||||
int rgb = image.getRGB(x, y);
|
||||
for (int y = 0; y < height; y++) {
|
||||
int rgb = imgData[width * y + x];
|
||||
rgb = rgb >>> 24;
|
||||
if (rgb > 0) {
|
||||
if (y1 == Integer.MAX_VALUE) {
|
||||
|
||||
Reference in New Issue
Block a user