small fixes

This commit is contained in:
Honfika
2014-04-30 16:08:39 +02:00
parent 93e3934d0a
commit 55fdd05ea7
4 changed files with 19 additions and 12 deletions

View File

@@ -2186,10 +2186,10 @@ public final class SWF implements TreeItem, Timelined {
sb.append("\tvar frame_cnt = ").append(timeline.getFrameCount()).append(";\r\n");
sb.append("\tframe = frame % frame_cnt;\r\n");
sb.append("\tswitch(frame){\r\n");
int maxDepth = timeline.getMaxDepth();
for (int frame = 0; frame < frames.size(); frame++) {
sb.append("\t\tcase ").append(frame).append(":\r\n");
Frame frameObj = timeline.frames.get(frame);
int maxDepth = timeline.getMaxDepth();
for (int i = 1; i <= maxDepth; i++) {
if (!frameObj.layers.containsKey(i)) {
continue;
@@ -2246,7 +2246,8 @@ public final class SWF implements TreeItem, Timelined {
List<SvgClip> clips = new ArrayList<>();
List<String> prevClips = new ArrayList<>();
for (int i = 1; i <= timeline.getMaxDepth(); i++) {
int maxDepth = timeline.getMaxDepth();
for (int i = 1; i <= maxDepth; i++) {
for (int c = 0; c < clips.size(); c++) {
if (clips.get(c).depth == i) {
exporter.setClip(prevClips.get(c));
@@ -2386,7 +2387,8 @@ public final class SWF implements TreeItem, Timelined {
List<Clip> clips = new ArrayList<>();
List<Shape> prevClips = new ArrayList<>();
for (int i = 1; i <= timeline.getMaxDepth(); i++) {
int maxDepth = timeline.getMaxDepth();
for (int i = 1; i <= maxDepth; i++) {
for (int c = 0; c < clips.size(); c++) {
if (clips.get(c).depth == i) {
g.setClip(prevClips.get(c));
@@ -2424,7 +2426,7 @@ public final class SWF implements TreeItem, Timelined {
Matrix drawMatrix = new Matrix();
int drawableFrameCount = drawable.getNumFrames();
if (drawableFrameCount == 0) {
continue;
drawableFrameCount = 1;
}
int dframe = (time + layer.time) % drawableFrameCount;
if (character instanceof ButtonTag) {

View File

@@ -465,7 +465,7 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay {
return Kernel32.INSTANCE.GetLastError();
}
int readNow = ibr.getValue();
System.arraycopy(data, readNow, res, read, readNow);
System.arraycopy(data, 0, res, read, readNow);
read += readNow;
}
return 0;
@@ -475,7 +475,7 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay {
// ignore
}
if (result != 0) {
if (result == Kernel32.ERROR_BROKEN_PIPE) {
if (result == Kernel32.ERROR_BROKEN_PIPE || result == -1) {
restartFlashPlayer();
throw new IOException("Pipe read error.");
} else {

View File

@@ -248,8 +248,9 @@ public class TimelineBodyPanel extends JPanel implements MouseListener {
if (p.x >= timeLine.getFrameCount()) {
p.x = timeLine.getFrameCount() - 1;
}
if (p.y > timeLine.getMaxDepth()) {
p.y = timeLine.getMaxDepth();
int maxDepth = timeLine.getMaxDepth();
if (p.y > maxDepth) {
p.y = maxDepth;
}
frameSelect(p.x, p.y);
}

View File

@@ -178,7 +178,8 @@ public class Timeline {
Frame fr = this.frames.get(frame);
sounds.addAll(fr.sounds);
soundClasses.addAll(fr.soundClasses);
for (int d = this.getMaxDepth(); d >= 0; d--) {
int maxDepth = this.getMaxDepth();
for (int d = maxDepth; d >= 0; d--) {
DepthState ds = fr.layers.get(d);
if (ds != null) {
CharacterTag c = swf.characters.get(ds.characterId);
@@ -208,7 +209,8 @@ public class Timeline {
public void getObjectsOutlines(int frame, int time, int ratio, DepthState stateUnderCursor, int mouseButton, Matrix transformation, List<DepthState> objs, List<Shape> outlines) {
Frame fr = this.frames.get(frame);
Stack<Clip> clips = new Stack<>();
for (int d = this.getMaxDepth(); d >= 0; d--) {
int maxDepth = this.getMaxDepth();
for (int d = maxDepth; d >= 0; d--) {
Clip currentClip = null;
for (int i = clips.size() - 1; i >= 0; i--) {
Clip cl = clips.get(i);
@@ -277,7 +279,8 @@ public class Timeline {
Frame fr = this.frames.get(frame);
Area area = new Area();
Stack<Clip> clips = new Stack<>();
for (int d = this.getMaxDepth(); d >= 0; d--) {
int maxDepth = this.getMaxDepth();
for (int d = maxDepth; d >= 0; d--) {
Clip currentClip = null;
for (int i = clips.size() - 1; i >= 0; i--) {
Clip cl = clips.get(i);
@@ -345,7 +348,8 @@ public class Timeline {
private boolean isSingleFrame(int frame) {
Frame frameObj = frames.get(frame);
for (int i = 1; i <= getMaxDepth(); i++) {
int maxDepth = this.getMaxDepth();
for (int i = 1; i <= maxDepth; i++) {
if (!frameObj.layers.containsKey(i)) {
continue;
}