Fixed: AS1/2 print/printNum/printAsBitmap/printAsBitmapNum not correctly handling bmovie boundingBox parameter

This commit is contained in:
Jindra Petřík
2025-09-06 17:39:54 +02:00
parent 5d8d753c37
commit 973dcf68d3
6 changed files with 34 additions and 2 deletions

View File

@@ -93,6 +93,12 @@ public class PrintActionItem extends ActionItem {
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator;
String charset = asGenerator.getCharset();
if (boundingBox instanceof DirectValueActionItem) {
DirectValueActionItem directValue = ((DirectValueActionItem) boundingBox);
if (directValue.isString() && "bmovie".equals(directValue.getAsString())) {
return toSourceMerge(localData, generator, asGenerator.pushConstTargetItem("print:"), target, new ActionGetURL2(0, false, false, charset), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}, charset) : null);
}
}
return toSourceMerge(localData, generator, new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("print:#"), boundingBox, true), target, new ActionGetURL2(0, false, false, charset), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}, charset) : null);
}

View File

@@ -93,6 +93,12 @@ public class PrintAsBitmapActionItem extends ActionItem {
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator;
String charset = asGenerator.getCharset();
if (boundingBox instanceof DirectValueActionItem) {
DirectValueActionItem directValue = ((DirectValueActionItem) boundingBox);
if (directValue.isString() && "bmovie".equals(directValue.getAsString())) {
return toSourceMerge(localData, generator, asGenerator.pushConstTargetItem("printasbitmap:"), target, new ActionGetURL2(0, false, false, charset), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}, charset) : null);
}
}
return toSourceMerge(localData, generator, new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("printasbitmap:#"), boundingBox, true), target, new ActionGetURL2(0, false, false, charset), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}, charset) : null);
}

View File

@@ -100,6 +100,13 @@ public class PrintAsBitmapNumActionItem extends ActionItem {
} else {
lev = new StringAddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("_level"), num);
}
if (boundingBox instanceof DirectValueActionItem) {
DirectValueActionItem directValue = ((DirectValueActionItem) boundingBox);
if (directValue.isString() && "bmovie".equals(directValue.getAsString())) {
return toSourceMerge(localData, generator, asGenerator.pushConstTargetItem("printasbitmap:"), lev, new ActionGetURL2(0, false, false, charset), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}, charset) : null);
}
}
return toSourceMerge(localData, generator, new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("printasbitmap:#"), boundingBox, true), lev, new ActionGetURL2(0, false, false, charset), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}, charset) : null);
}

View File

@@ -100,6 +100,12 @@ public class PrintNumActionItem extends ActionItem {
} else {
lev = new StringAddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("_level"), num);
}
if (boundingBox instanceof DirectValueActionItem) {
DirectValueActionItem directValue = ((DirectValueActionItem) boundingBox);
if (directValue.isString() && "bmovie".equals(directValue.getAsString())) {
return toSourceMerge(localData, generator, asGenerator.pushConstTargetItem("print:"), lev, new ActionGetURL2(0, false, false, charset), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}, charset) : null);
}
}
return toSourceMerge(localData, generator, new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("print:#"), boundingBox, true), lev, new ActionGetURL2(0, false, false, charset), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}, charset) : null);
}

View File

@@ -258,6 +258,12 @@ public class ActionGetURL2 extends Action {
} else if (urlStr.startsWith(fscommandPrefix)) {
urlString = new DirectValueActionItem(urlStr.substring(fscommandPrefix.length()));
doFSCommand = true;
} else if (urlStr.equals("print:")) {
printType = new DirectValueActionItem("bmovie");
doPrint = true;
} else if (urlStr.equals("printasbitmap:")) {
printType = new DirectValueActionItem("bmovie");
doPrintAsBitmap = true;
}
} else if (urlString instanceof StringAddActionItem) {
StringAddActionItem sa = (StringAddActionItem) urlString;
@@ -289,8 +295,7 @@ public class ActionGetURL2 extends Action {
if (doUnload) {
output.add(new UnLoadMovieNumActionItem(this, lineStartAction, num));
} else if (doPrint) {
output.add(new PrintNumActionItem(this, lineStartAction, num,
printType));
output.add(new PrintNumActionItem(this, lineStartAction, num, printType));
} else if (doPrintAsBitmap) {
output.add(new PrintAsBitmapNumActionItem(this, lineStartAction, num, printType));
} else {