Merge origin/master

This commit is contained in:
Jindra Petřík
2015-12-05 10:54:11 +01:00
12 changed files with 226 additions and 62 deletions

View File

@@ -956,7 +956,8 @@ public final class SWF implements SWFContainerItem, Timelined {
* Constructs an empty SWF
*/
public SWF() {
version = SWF.DEFAULT_VERSION;
displayRect = new RECT(0, 1, 0, 1);
}
/**
@@ -1099,7 +1100,7 @@ public final class SWF implements SWFContainerItem, Timelined {
}
}
getASMs(true); // Add scriptNames to ASMs
getASMs(true); // Add scriptNames to ASMs
}
@Override

View File

@@ -60,16 +60,18 @@ public class BinaryDataExporter {
int currentIndex = 1;
for (final Tag t : tags) {
if (t instanceof DefineBinaryDataTag) {
DefineBinaryDataTag bdt = (DefineBinaryDataTag) t;
if (evl != null) {
evl.handleExportingEvent("binarydata", currentIndex, count, t.getName());
}
int characterID = ((DefineBinaryDataTag) t).getCharacterId();
int characterID = bdt.getCharacterId();
final File file = new File(outdir + File.separator + characterID + ".bin");
String ext = bdt.innerSwf == null ? ".bin" : ".swf";
final File file = new File(outdir + File.separator + characterID + ext);
new RetryTask(() -> {
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) {
fos.write(((DefineBinaryDataTag) t).binaryData.getRangeData());
fos.write(bdt.binaryData.getRangeData());
}
}, handler).run();

View File

@@ -400,7 +400,7 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
* @throws IOException
*/
public void writeTag(SWFOutputStream sos) throws IOException {
if (isModified()) {
if (Configuration.debugCopy.get() || isModified()) {
byte[] newData = getData();
byte[] newHeaderData = getHeader(newData.length);
sos.write(newHeaderData);
@@ -463,16 +463,9 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
if (Configuration.debugCopy.get()) {
// todo: honfika: why only the following tags?
if (this instanceof DefineSpriteTag
|| this instanceof DefineButtonTag || this instanceof DefineButton2Tag
|| this instanceof DefineFont3Tag
|| this instanceof DoABCTag || this instanceof DoABC2Tag
|| this instanceof PlaceObject2Tag || this instanceof PlaceObject3Tag || this instanceof PlaceObject4Tag) {
byte[] originalData = getOriginalData();
if (originalData != null) {
os = new CopyOutputStream(os, new ByteArrayInputStream(getOriginalData()));
}
byte[] originalData = getOriginalData();
if (originalData != null) {
os = new CopyOutputStream(os, new ByteArrayInputStream(getOriginalData()));
}
}

View File

@@ -107,7 +107,7 @@ public abstract class StaticTextTag extends TextTag {
for (TEXTRECORD tr : textRecords) {
for (GLYPHENTRY ge : tr.glyphEntries) {
glyphBits = SWFOutputStream.enlargeBitCountU(glyphBits, ge.glyphIndex);
advanceBits = SWFOutputStream.enlargeBitCountS(advanceBits, ge.glyphAdvance);
advanceBits = SWFOutputStream.enlargeBitCountU(advanceBits, ge.glyphAdvance);
}
}