Reduce the memory usage of the operator list.
This commit is contained in:
parent
a6e7f2226a
commit
f4942b11f8
8 changed files with 288 additions and 155 deletions
|
@ -481,10 +481,10 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
|||
*/
|
||||
_renderPageChunk: function PDFPageProxy_renderPageChunk(operatorListChunk) {
|
||||
// Add the new chunk to the current operator list.
|
||||
Util.concatenateToArray(this.operatorList.fnArray,
|
||||
operatorListChunk.fnArray);
|
||||
Util.concatenateToArray(this.operatorList.argsArray,
|
||||
operatorListChunk.argsArray);
|
||||
for (var i = 0, ii = operatorListChunk.length; i < ii; i++) {
|
||||
this.operatorList.fnArray.push(operatorListChunk.fnArray[i]);
|
||||
this.operatorList.argsArray.push(operatorListChunk.argsArray[i]);
|
||||
}
|
||||
this.operatorList.lastChunk = operatorListChunk.lastChunk;
|
||||
|
||||
// Notify all the rendering tasks there are more operators to be consumed.
|
||||
|
@ -1094,7 +1094,7 @@ var InternalRenderTask = (function InternalRenderTaskClosure() {
|
|||
this.operatorListIdx,
|
||||
this._continue.bind(this),
|
||||
this.stepper);
|
||||
if (this.operatorListIdx === this.operatorList.fnArray.length) {
|
||||
if (this.operatorListIdx === this.operatorList.argsArray.length) {
|
||||
this.running = false;
|
||||
if (this.operatorList.lastChunk) {
|
||||
this.gfx.endDrawing();
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
/* globals ColorSpace, DeviceCmykCS, DeviceGrayCS, DeviceRgbCS, error,
|
||||
FONT_IDENTITY_MATRIX, IDENTITY_MATRIX, ImageData, isArray, isNum,
|
||||
Pattern, TilingPattern, TODO, Util, warn, assert, info,
|
||||
TextRenderingMode */
|
||||
TextRenderingMode, OPS */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -538,7 +538,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||
|
||||
var commonObjs = this.commonObjs;
|
||||
var objs = this.objs;
|
||||
var fnName;
|
||||
var fnId;
|
||||
var slowCommands = this.slowCommands;
|
||||
|
||||
while (true) {
|
||||
|
@ -547,10 +547,10 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||
return i;
|
||||
}
|
||||
|
||||
fnName = fnArray[i];
|
||||
fnId = fnArray[i];
|
||||
|
||||
if (fnName !== 'dependency') {
|
||||
this[fnName].apply(this, argsArray[i]);
|
||||
if (fnId !== OPS.dependency) {
|
||||
this[fnId].apply(this, argsArray[i]);
|
||||
} else {
|
||||
var deps = argsArray[i];
|
||||
for (var n = 0, nn = deps.length; n < nn; n++) {
|
||||
|
@ -580,7 +580,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||
// If the execution took longer then a certain amount of time, shedule
|
||||
// to continue exeution after a short delay.
|
||||
// However, this is only possible if a 'continueCallback' is passed in.
|
||||
if (continueCallback && slowCommands[fnName] && Date.now() > endTime) {
|
||||
if (continueCallback && slowCommands[fnId] && Date.now() > endTime) {
|
||||
setTimeout(continueCallback, 0);
|
||||
return i;
|
||||
}
|
||||
|
@ -1867,6 +1867,10 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||
}
|
||||
};
|
||||
|
||||
for (var op in OPS) {
|
||||
CanvasGraphics.prototype[OPS[op]] = CanvasGraphics.prototype[op];
|
||||
}
|
||||
|
||||
return CanvasGraphics;
|
||||
})();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue