Reduce the memory usage of the operator list.

This commit is contained in:
Brendan Dahl 2013-11-13 11:43:38 -08:00
parent a6e7f2226a
commit f4942b11f8
8 changed files with 288 additions and 155 deletions

View file

@ -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();