return ready-to-run closure from compile that captures its objpool
This commit is contained in:
parent
b9771416ba
commit
aecc4ebbb7
10
pdf.js
10
pdf.js
@ -1684,7 +1684,7 @@ var CanvasGraphics = (function() {
|
|||||||
|
|
||||||
execute: function(stream, xref, resources) {
|
execute: function(stream, xref, resources) {
|
||||||
if (!stream.execute)
|
if (!stream.execute)
|
||||||
this.compile(stream, xref, resources);
|
stream.execute = this.compile(stream, xref, resources);
|
||||||
|
|
||||||
var savedXref = this.xref, savedRes = this.res, savedXobjs = this.xobjs;
|
var savedXref = this.xref, savedRes = this.res, savedXobjs = this.xobjs;
|
||||||
this.xref = xref;
|
this.xref = xref;
|
||||||
@ -1692,7 +1692,7 @@ var CanvasGraphics = (function() {
|
|||||||
this.xobjs = this.res.get("XObject") || new Dict();
|
this.xobjs = this.res.get("XObject") || new Dict();
|
||||||
this.xobjs = this.xref.fetchIfRef(this.xobjs);
|
this.xobjs = this.xref.fetchIfRef(this.xobjs);
|
||||||
|
|
||||||
stream.execute(this, stream.objpool);
|
stream.execute(this);
|
||||||
|
|
||||||
this.xobjs = savedXobjs;
|
this.xobjs = savedXobjs;
|
||||||
this.res = savedRes;
|
this.res = savedRes;
|
||||||
@ -1724,7 +1724,7 @@ var CanvasGraphics = (function() {
|
|||||||
assertWellFormed(fn, "Unknown command '" + cmd + "'");
|
assertWellFormed(fn, "Unknown command '" + cmd + "'");
|
||||||
// TODO figure out how to type-check vararg functions
|
// TODO figure out how to type-check vararg functions
|
||||||
|
|
||||||
src += "gfx.";
|
src += "this.";
|
||||||
src += fn;
|
src += fn;
|
||||||
src += "(";
|
src += "(";
|
||||||
src += args.map(emitArg).join(",");
|
src += args.map(emitArg).join(",");
|
||||||
@ -1739,8 +1739,8 @@ var CanvasGraphics = (function() {
|
|||||||
|
|
||||||
src += "}";
|
src += "}";
|
||||||
|
|
||||||
stream.execute = new Function("gfx", "objpool", src);
|
var fn = new Function("objpool", src);
|
||||||
stream.objpool = objpool;
|
return function (gfx) { fn.call(gfx, objpool); };
|
||||||
},
|
},
|
||||||
|
|
||||||
endDrawing: function() {
|
endDrawing: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user