MORPHGRADIENT fix

This commit is contained in:
Jindra Pet��k
2013-05-04 11:52:06 +02:00
parent 3bd79692ca
commit ea06712781
2 changed files with 4 additions and 4 deletions
@@ -2635,8 +2635,8 @@ public class SWFInputStream extends InputStream {
public MORPHGRADIENT readMORPHGRADIENT() throws IOException {
MORPHGRADIENT ret = new MORPHGRADIENT();
int numGradients = (int) readUI8();
numGradients = numGradients % 8; //there should be 1 to 8 but sometimes there is more. This modulo seems to be OK.
ret.numGradientsExtra = numGradients & 0xf8; //some extra data. Are these the same as in GRADIENT or just obfuscator junk???
numGradients = numGradients & 0x7;
ret.gradientRecords = new MORPHGRADRECORD[numGradients];
for (int i = 0; i < numGradients; i++) {
ret.gradientRecords[i] = readMORPHGRADRECORD();
@@ -1453,7 +1453,7 @@ public class SWFOutputStream extends OutputStream {
* @throws IOException
*/
public void writeMORPHGRADIENT(MORPHGRADIENT value, int shapeNum) throws IOException {
writeUB(4, value.gradientRecords.length);
writeUI8(value.gradientRecords.length + value.numGradientsExtra);
for (int i = 0; i < value.gradientRecords.length; i++) {
writeMORPHGRADRECORD(value.gradientRecords[i]);
}
@@ -1603,7 +1603,7 @@ public class SWFOutputStream extends OutputStream {
}
public void writeBytesZlib(byte data[]) throws IOException {
DeflaterOutputStream deflater = new DeflaterOutputStream(this,new Deflater(9));
DeflaterOutputStream deflater = new DeflaterOutputStream(this, new Deflater(9));
deflater.write(data);
deflater.finish();
}