}
var pe = this.pe = new PartialEvaluator();
- return this.IRQueue = pe.getIRQueue(content, xref, resources, fonts, images, this.pageNumber + "_");
+ var IRQueue = {};
+ return this.IRQueue = pe.getIRQueue(content, xref, resources, IRQueue, fonts, images, this.pageNumber + "_");
},
ensureFonts: function(fonts, callback) {
};
constructor.prototype = {
- getIRQueue: function(stream, xref, resources, fonts, images, uniquePrefix) {
+ getIRQueue: function(stream, xref, resources, queue, fonts, images, uniquePrefix) {
uniquePrefix = uniquePrefix || "";
+ if (!queue.argsArray) {
+ queue.argsArray = []
+ }
+ if (!queue.fnArray) {
+ queue.fnArray = [];
+ }
+
+ var fnArray = queue.fnArray, argsArray = queue.argsArray;
resources = xref.fetchIfRef(resources) || new Dict();
var xobjs = xref.fetchIfRef(resources.get('XObject')) || new Dict();
var patterns = xref.fetchIfRef(resources.get('Pattern')) || new Dict();
var parser = new Parser(new Lexer(stream), false);
- var args = [], argsArray = [], fnArray = [], obj;
+ var args = [], obj;
var res = resources;
while (!IsEOF(obj = parser.getObj())) {
// Type1 is TilingPattern
if (typeNum == 1) {
+ // TODO: Add dependency here.
// Create an IR of the pattern code.
var codeIR = this.getIRQueue(pattern, xref,
- dict.get('Resources'), fonts, images, uniquePrefix);
+ dict.get('Resources'), {}, fonts, images, uniquePrefix);
args = TilingPattern.getIR(codeIR, dict);
}
);
if ('Form' == type.name) {
- // console.log("got xobj that is a Form");
- var raw = this.getIRQueue(xobj, xref, xobj.dict.get('Resources'),
- fonts, images, uniquePrefix);
var matrix = xobj.dict.get('Matrix');
var bbox = xobj.dict.get('BBox');
- args = [ raw, matrix, bbox ];
- fn = "paintFormXObject";
+
+ fnArray.push("paintFormXObjectBegin");
+ argsArray.push([ matrix, bbox ]);
+
+ // This adds the IRQueue of the xObj to the current queue.
+ this.getIRQueue(xobj, xref, xobj.dict.get('Resources'), queue,
+ fonts, images, uniquePrefix);
+
+
+ fn = "paintFormXObjectEnd";
+ args = [];
} else if ('Image' == type.name) {
var image = xobj;
var dict = image.dict;
this.paintImageXObject(null, image, true);
},
- paintFormXObject: function(IRQueue, matrix, bbox) {
+ paintFormXObjectBegin: function(matrix, bbox) {
this.save();
if (matrix && IsArray(matrix) && 6 == matrix.length)
this.clip();
this.endPath();
}
+ },
- // this.execute(code, this.xref, stream.dict.get('Resources'));
- this.executeIRQueue(IRQueue);
-
+ paintFormXObjectEnd: function() {
this.restore();
},