}
var CanvasGraphics = (function CanvasGraphicsClosure() {
- // Defines the time the executeIRQueue is going to be executing
+ // Defines the time the executeOperatorList is going to be executing
// before it stops and shedules a continue of execution.
var kExecutionTime = 50;
this.textLayer.beginLayout();
},
- executeIRQueue: function canvasGraphicsExecuteIRQueue(codeIR,
- executionStartIdx, continueCallback,
- stepper) {
- var argsArray = codeIR.argsArray;
- var fnArray = codeIR.fnArray;
+ executeOperatorList: function canvasGraphicsExecuteOperatorList(
+ operatorList,
+ executionStartIdx, continueCallback,
+ stepper) {
+ var argsArray = operatorList.argsArray;
+ var fnArray = operatorList.fnArray;
var i = executionStartIdx || 0;
var argsArrayLen = argsArray.length;
- // Sometimes the IRQueue to execute is empty.
+ // Sometimes the OperatorList to execute is empty.
if (argsArrayLen == i) {
return i;
}
i++;
- // If the entire IRQueue was executed, stop as were done.
+ // If the entire operatorList was executed, stop as were done.
if (i == argsArrayLen) {
return i;
}
return i;
}
- // If the IRQueue isn't executed completly yet OR the execution time
- // was short enough, do another execution round.
+ // If the operatorList isn't executed completely yet OR the execution
+ // time was short enough, do another execution round.
}
},
this.save();
ctx.scale(fontSize, fontSize);
ctx.transform.apply(ctx, fontMatrix);
- this.executeIRQueue(glyph.codeIRQueue);
+ this.executeOperatorList(glyph.operatorList);
this.restore();
var transformed = Util.applyTransform([glyph.width, 0], fontMatrix);
return shadow(this, 'rotate', rotate);
},
- startRenderingFromIRQueue: function pageStartRenderingFromIRQueue(
- IRQueue, fonts) {
+ startRenderingFromOperatorList: function pageStartRenderingFromOperatorList(
+ operatorList, fonts) {
var self = this;
- this.IRQueue = IRQueue;
+ this.operatorList = operatorList;
var displayContinuation = function pageDisplayContinuation() {
// Always defer call to display() to work around bug in
};
this.ensureFonts(fonts,
- function pageStartRenderingFromIRQueueEnsureFonts() {
- displayContinuation();
- });
+ function pageStartRenderingFromOperatorListEnsureFonts() {
+ displayContinuation();
+ }
+ );
},
- getIRQueue: function pageGetIRQueue(handler, dependency) {
- if (this.IRQueue) {
+ getOperatorList: function pageGetOperatorList(handler, dependency) {
+ if (this.operatorList) {
// content was compiled
- return this.IRQueue;
+ return this.operatorList;
}
this.stats.time('Build IR Queue');
var pe = this.pe = new PartialEvaluator(
xref, handler, 'p' + this.pageNumber + '_');
- this.IRQueue = pe.getIRQueue(content, resources, dependency);
+ this.operatorList = pe.getOperatorList(content, resources, dependency));
this.stats.timeEnd('Build IR Queue');
- return this.IRQueue;
+ return this.operatorList;
},
ensureFonts: function pageEnsureFonts(fonts, callback) {
rotate: this.rotate });
var startIdx = 0;
- var length = this.IRQueue.fnArray.length;
- var IRQueue = this.IRQueue;
+ var length = this.operatorList.fnArray.length;
+ var operatorList = this.operatorList;
var stepper = null;
if (PDFJS.pdfBug && StepperManager.enabled) {
stepper = StepperManager.create(this.pageNumber);
- stepper.init(IRQueue);
+ stepper.init(operatorList);
stepper.nextBreakPoint = stepper.getNextBreakPoint();
}
var self = this;
function next() {
- startIdx = gfx.executeIRQueue(IRQueue, startIdx, next, stepper);
+ startIdx =
+ gfx.executeOperatorList(operatorList, startIdx, next, stepper);
if (startIdx == length) {
gfx.endDrawing();
stats.timeEnd('Rendering');
startRendering: function pageStartRendering(ctx, callback, textLayer) {
var stats = this.stats;
stats.time('Overall');
- // If there is no displayReadyPromise yet, then the IRQueue was never
+ // If there is no displayReadyPromise yet, then the operatorList was never
// requested before. Make the request and create the promise.
if (!this.displayReadyPromise) {
this.pdf.startRendering(this);
this.displayReadyPromise = new Promise();
}
- // Once the IRQueue and fonts are loaded, perform the actual rendering.
+
+ // Once the operatorList and fonts are loaded, do the actual rendering.
this.displayReadyPromise.then(
function pageDisplayReadyPromise() {
var gfx = new CanvasGraphics(ctx, this.objs, textLayer);
var pageNum = data.pageNum;
var page = this.pageCache[pageNum];
var depFonts = data.depFonts;
+
page.stats.timeEnd('Page Request');
- page.startRenderingFromIRQueue(data.IRQueue, depFonts);
+ page.startRenderingFromOperatorList(data.operatorList, depFonts);
}, this);
messageHandler.on('obj', function pdfDocObj(data) {
};
PartialEvaluator.prototype = {
- getIRQueue: function partialEvaluatorGetIRQueue(stream, resources,
+ getOperatorList: function partialEvaluatorGetOperatorList(stream, resources,
dependency, queue) {
var self = this;
// Ensure the font is ready before the font is set
// and later on used for drawing.
- // OPTIMIZE: This should get insert to the IRQueue only once per
+ // OPTIMIZE: This should get insert to the operatorList only once per
// page.
insertDependency([loadedName]);
return loadedName;
if (typeNum == TILING_PATTERN) {
// Create an IR of the pattern code.
var depIdx = dependencyArray.length;
- var codeIR = this.getIRQueue(pattern, dict.get('Resources') ||
- resources, dependencyArray);
+ var operatorList = this.getOperatorList(pattern,
+ dict.get('Resources') || resources, dependencyArray);
// Add the dependencies that are required to execute the
- // codeIR.
+ // operatorList.
insertDependency(dependencyArray.slice(depIdx));
- args = TilingPattern.getIR(codeIR, dict, args);
+ args = TilingPattern.getIR(operatorList, dict, args);
}
else if (typeNum == SHADING_PATTERN) {
var shading = xref.fetchIfRef(dict.get('Shading'));
fnArray.push('paintFormXObjectBegin');
argsArray.push([matrix, bbox]);
- // This adds the IRQueue of the xObj to the current queue.
+ // This adds the operatorList 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,
+ this.getOperatorList(xobj,
+ xobj.dict.get('Resources') || resources,
dependencyArray, queue);
// Add the dependencies that are required to execute the
- // codeIR.
+ // operatorList.
insertDependency(dependencyArray.slice(depIdx));
fn = 'paintFormXObjectEnd';
var charProcs = xref.fetchIfRef(dict.get('CharProcs'));
var fontResources = xref.fetchIfRef(dict.get('Resources')) || resources;
properties.resources = fontResources;
- properties.charProcIRQueues = {};
+ properties.charProcOperatorLists = {};
for (var key in charProcs.map) {
var glyphStream = xref.fetchIfRef(charProcs.map[key]);
- properties.charProcIRQueues[key] =
- this.getIRQueue(glyphStream, fontResources, dependency);
+ properties.charProcOperatorList[key] =
+ this.getOperatorList(glyphStream, fontResources, dependency);
}
}
function Font(name, file, properties) {
this.name = name;
this.coded = properties.coded;
- this.charProcIRQueues = properties.charProcIRQueues;
+ this.charProcOperatorList = properties.charProcOperatorList;
this.resources = properties.resources;
this.sizes = [];
},
charToGlyph: function fonts_charToGlyph(charcode) {
- var fontCharCode, width, codeIRQueue;
+ var fontCharCode, width, operatorList;
var width = this.widths[charcode];
break;
case 'Type3':
var glyphName = this.differences[charcode] || this.encoding[charcode];
- codeIRQueue = this.charProcIRQueues[glyphName];
+ operatorList = this.charProcOperatorList[glyphName];
fontCharCode = charcode;
break;
case 'TrueType':
fontChar: String.fromCharCode(fontCharCode),
unicode: unicodeChars,
width: width,
- codeIRQueue: codeIRQueue
+ operatorList: operatorList
};
},
var MAX_PATTERN_SIZE = 512;
function TilingPattern(IR, color, ctx, objs) {
- var IRQueue = IR[2];
+ var operatorList = IR[2];
this.matrix = IR[3];
var bbox = IR[4];
var xstep = IR[5];
graphics.endPath();
}
- graphics.executeIRQueue(IRQueue);
+ graphics.executeOperatorList(operatorList);
this.canvas = tmpCanvas;
}
- TilingPattern.getIR = function tiling_getIR(codeIR, dict, args) {
+ TilingPattern.getIR = function tiling_getIR(operatorList, dict, args) {
var matrix = dict.get('Matrix');
var bbox = dict.get('BBox');
var xstep = dict.get('XStep');
var paintType = dict.get('PaintType');
return [
- 'TilingPattern', args, codeIR, matrix, bbox, xstep, ystep, paintType
+ 'TilingPattern', args, operatorList, matrix, bbox, xstep, ystep, paintType
];
};
var start = Date.now();
var dependency = [];
- var IRQueue = null;
+ var operatorList = null;
try {
var page = pdfModel.getPage(pageNum);
// Pre compile the pdf page and fetch the fonts/images.
- IRQueue = page.getIRQueue(handler, dependency);
+ operatorList = page.getOperatorList(handler, dependency);
} catch (e) {
var minimumStackMessage =
- 'worker.js: while trying to getPage() and getIRQueue()';
+ 'worker.js: while trying to getPage() and getOperatorList()';
// Turn the error into an obj that can be serialized
if (typeof e === 'string') {
return;
}
- console.log('page=%d - getIRQueue: time=%dms, len=%d', pageNum,
- Date.now() - start, IRQueue.fnArray.length);
+ console.log('page=%d - getOperatorList: time=%dms, len=%d', pageNum,
+ Date.now() - start, operatorList.fnArray.length);
// Filter the dependecies for fonts.
var fonts = {};
handler.send('page', {
pageNum: pageNum,
- IRQueue: IRQueue,
+ operatorList: operatorList,
depFonts: Object.keys(fonts)
});
}, this);