|
|
@ -901,7 +901,7 @@ var PDFPageProxy = (function PDFPageProxyClosure() { |
|
|
|
stats.time('Rendering'); |
|
|
|
stats.time('Rendering'); |
|
|
|
internalRenderTask.initializeGraphics(transparency); |
|
|
|
internalRenderTask.initializeGraphics(transparency); |
|
|
|
internalRenderTask.operatorListChanged(); |
|
|
|
internalRenderTask.operatorListChanged(); |
|
|
|
}, complete); |
|
|
|
}).catch(complete); |
|
|
|
|
|
|
|
|
|
|
|
return renderTask; |
|
|
|
return renderTask; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -2103,6 +2103,7 @@ var RenderTask = (function RenderTaskClosure() { |
|
|
|
* @ignore |
|
|
|
* @ignore |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
var InternalRenderTask = (function InternalRenderTaskClosure() { |
|
|
|
var InternalRenderTask = (function InternalRenderTaskClosure() { |
|
|
|
|
|
|
|
let canvasInRendering = new WeakMap(); |
|
|
|
|
|
|
|
|
|
|
|
function InternalRenderTask(callback, params, objs, commonObjs, operatorList, |
|
|
|
function InternalRenderTask(callback, params, objs, commonObjs, operatorList, |
|
|
|
pageNumber, canvasFactory) { |
|
|
|
pageNumber, canvasFactory) { |
|
|
@ -2125,6 +2126,7 @@ var InternalRenderTask = (function InternalRenderTaskClosure() { |
|
|
|
this._continueBound = this._continue.bind(this); |
|
|
|
this._continueBound = this._continue.bind(this); |
|
|
|
this._scheduleNextBound = this._scheduleNext.bind(this); |
|
|
|
this._scheduleNextBound = this._scheduleNext.bind(this); |
|
|
|
this._nextBound = this._next.bind(this); |
|
|
|
this._nextBound = this._next.bind(this); |
|
|
|
|
|
|
|
this._canvas = params.canvasContext.canvas; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
InternalRenderTask.prototype = { |
|
|
|
InternalRenderTask.prototype = { |
|
|
@ -2132,6 +2134,16 @@ var InternalRenderTask = (function InternalRenderTaskClosure() { |
|
|
|
initializeGraphics: |
|
|
|
initializeGraphics: |
|
|
|
function InternalRenderTask_initializeGraphics(transparency) { |
|
|
|
function InternalRenderTask_initializeGraphics(transparency) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this._canvas) { |
|
|
|
|
|
|
|
if (canvasInRendering.has(this._canvas)) { |
|
|
|
|
|
|
|
throw new Error( |
|
|
|
|
|
|
|
'Cannot use the same canvas during multiple render() operations. ' + |
|
|
|
|
|
|
|
'Use different canvas or ensure previous operations were ' + |
|
|
|
|
|
|
|
'cancelled or completed.'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
canvasInRendering.set(this._canvas, this); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.cancelled) { |
|
|
|
if (this.cancelled) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -2163,6 +2175,9 @@ var InternalRenderTask = (function InternalRenderTaskClosure() { |
|
|
|
cancel: function InternalRenderTask_cancel() { |
|
|
|
cancel: function InternalRenderTask_cancel() { |
|
|
|
this.running = false; |
|
|
|
this.running = false; |
|
|
|
this.cancelled = true; |
|
|
|
this.cancelled = true; |
|
|
|
|
|
|
|
if (this._canvas) { |
|
|
|
|
|
|
|
canvasInRendering.delete(this._canvas); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ((typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PDFJS_NEXT')) || |
|
|
|
if ((typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PDFJS_NEXT')) || |
|
|
|
getDefaultSetting('pdfjsNext')) { |
|
|
|
getDefaultSetting('pdfjsNext')) { |
|
|
@ -2223,6 +2238,9 @@ var InternalRenderTask = (function InternalRenderTaskClosure() { |
|
|
|
this.running = false; |
|
|
|
this.running = false; |
|
|
|
if (this.operatorList.lastChunk) { |
|
|
|
if (this.operatorList.lastChunk) { |
|
|
|
this.gfx.endDrawing(); |
|
|
|
this.gfx.endDrawing(); |
|
|
|
|
|
|
|
if (this._canvas) { |
|
|
|
|
|
|
|
canvasInRendering.delete(this._canvas); |
|
|
|
|
|
|
|
} |
|
|
|
this.callback(); |
|
|
|
this.callback(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|