var pe = this.pe = new PartialEvaluator(
xref, handler, 'p' + this.pageNumber + '_');
- var IRQueue = {};
- this.IRQueue = pe.getIRQueue(content, resources, IRQueue, dependency);
+ this.IRQueue = pe.getIRQueue(content, resources, dependency);
this.stats.timeEnd('Build IR Queue');
return this.IRQueue;
},
PartialEvaluator.prototype = {
getIRQueue: function partialEvaluatorGetIRQueue(stream, resources,
- queue, dependency) {
+ dependency, queue) {
var self = this;
var xref = this.xref;
var fontRes = resources.get('Font');
- // TODO: TOASK: Is it possible to get here? If so, what does
- // args[0].name should be like???
assert(fontRes, 'fontRes not available');
fontRes = xref.fetchIfRef(fontRes);
// Ensure the font is ready before the font is set
// and later on used for drawing.
- // TODO: This should get insert to the IRQueue only once per
+ // OPTIMIZE: This should get insert to the IRQueue only once per
// page.
insertDependency([loadedName]);
return loadedName;
}, handler, xref, resources, image, inline);
}
+ if (!queue)
+ queue = {};
+
if (!queue.argsArray) {
queue.argsArray = [];
}
if (typeNum == TILING_PATTERN) {
// Create an IR of the pattern code.
var depIdx = dependencyArray.length;
- var queueObj = {};
var codeIR = this.getIRQueue(pattern, dict.get('Resources') ||
- resources, queueObj, dependencyArray);
+ resources, dependencyArray);
// Add the dependencies that are required to execute the
// codeIR.
// This adds the IRQueue of the xObj to the current queue.
var depIdx = dependencyArray.length;
+ // Pass in the current `queue` object. That means the `fnArray`
+ // and the `argsArray` in this scope is reused and new commands
+ // are added to them.
this.getIRQueue(xobj, xobj.dict.get('Resources') || resources,
- queue, dependencyArray);
+ dependencyArray, queue);
// Add the dependencies that are required to execute the
// codeIR.
}
}
- return {
- fnArray: fnArray,
- argsArray: argsArray
- };
+ return queue;
},
extractDataStructures: function
properties.charProcIRQueues = {};
for (var key in charProcs.map) {
var glyphStream = xref.fetchIfRef(charProcs.map[key]);
- var queueObj = {};
properties.charProcIRQueues[key] =
- this.getIRQueue(glyphStream, fontResources, queueObj, dependency);
+ this.getIRQueue(glyphStream, fontResources, dependency);
}
}