Split compilation up in preCompile and Compile.
This commit is contained in:
parent
e3dd329739
commit
0134143c67
28
pdf.js
28
pdf.js
@ -3408,7 +3408,7 @@ var Page = (function() {
|
||||
})
|
||||
},
|
||||
|
||||
compile: function(gfx, fonts, images) {
|
||||
preCompile: function(gfx, fonts, images) {
|
||||
if (this.code) {
|
||||
// content was compiled
|
||||
return;
|
||||
@ -3424,7 +3424,12 @@ var Page = (function() {
|
||||
content[i] = xref.fetchIfRef(content[i]);
|
||||
content = new StreamsSequenceStream(content);
|
||||
}
|
||||
this.code = gfx.compile(content, xref, resources, fonts, images);
|
||||
return gfx.preCompile(content, xref, resources, fonts, images);
|
||||
},
|
||||
|
||||
compile: function(gfx, fonts, images) {
|
||||
var preCompilation = this.preCompile(gfx, fonts, images);
|
||||
this.code = gfx.postCompile(preCompilation);
|
||||
},
|
||||
|
||||
ensureFonts: function(fonts, callback) {
|
||||
@ -4299,6 +4304,15 @@ var PartialEvaluator = (function() {
|
||||
gfx[fnArray[i]].apply(gfx, argsArray[i]);
|
||||
};
|
||||
},
|
||||
|
||||
evalFromRaw: function(raw) {
|
||||
return function(gfx) {
|
||||
var argsArray = raw.argsArray;
|
||||
var fnArray = raw.fnArray;
|
||||
for (var i = 0, length = argsArray.length; i < length; i++)
|
||||
gfx[fnArray[i]].apply(gfx, argsArray[i]);
|
||||
};
|
||||
},
|
||||
|
||||
extractEncoding: function(dict, xref, properties) {
|
||||
var type = properties.type, encoding;
|
||||
@ -4761,9 +4775,13 @@ var CanvasGraphics = (function() {
|
||||
this.ctx.scale(cw / mediaBox.width, ch / mediaBox.height);
|
||||
},
|
||||
|
||||
compile: function(stream, xref, resources, fonts, images) {
|
||||
var pe = new PartialEvaluator();
|
||||
return pe.evaluate(stream, xref, resources, fonts, images);
|
||||
preCompile: function(stream, xref, resources, fonts, images) {
|
||||
var pe = this.pe = new PartialEvaluator();
|
||||
return pe.evalRaw(stream, xref, resources, fonts, images);
|
||||
},
|
||||
|
||||
postCompile: function(raw) {
|
||||
return this.pe.evalFromRaw(raw);
|
||||
},
|
||||
|
||||
execute: function(code, xref, resources) {
|
||||
|
Loading…
Reference in New Issue
Block a user