From 50c844c5b84cf6f8b8fb5cc95246d1975e3cccd4 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 12 Mar 2023 22:53:42 +0100 Subject: [PATCH] Stop including `isOffscreenCanvasSupported` in the "StartRenderPage" message With the previous commit this is now completely unused in API, hence it can be removed. This is done in a separate commit to make it easier to re-instate it, would the need ever arise. --- src/core/document.js | 2 -- src/display/api.js | 49 +++++++++++++++----------------------------- 2 files changed, 16 insertions(+), 35 deletions(-) diff --git a/src/core/document.js b/src/core/document.js index a1d3c6c06..b66f4d56c 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -417,8 +417,6 @@ class Page { this.resources, this.nonBlendModesSet ), - isOffscreenCanvasSupported: - this.evaluatorOptions.isOffscreenCanvasSupported, pageIndex: this.pageIndex, cacheKey, }); diff --git a/src/display/api.js b/src/display/api.js index 19afd48a8..d13e223dc 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -1521,25 +1521,19 @@ class PDFPageProxy { intentState.displayReadyCapability.promise, optionalContentConfigPromise, ]) - .then( - ([ - { transparency, isOffscreenCanvasSupported }, - optionalContentConfig, - ]) => { - if (this.#pendingCleanup) { - complete(); - return; - } - this._stats?.time("Rendering"); - - internalRenderTask.initializeGraphics({ - transparency, - isOffscreenCanvasSupported, - optionalContentConfig, - }); - internalRenderTask.operatorListChanged(); + .then(([transparency, optionalContentConfig]) => { + if (this.#pendingCleanup) { + complete(); + return; } - ) + this._stats?.time("Rendering"); + + internalRenderTask.initializeGraphics({ + transparency, + optionalContentConfig, + }); + internalRenderTask.operatorListChanged(); + }) .catch(complete); return renderTask; @@ -1763,7 +1757,7 @@ class PDFPageProxy { /** * @private */ - _startRenderPage(transparency, isOffscreenCanvasSupported, cacheKey) { + _startRenderPage(transparency, cacheKey) { const intentState = this._intentStates.get(cacheKey); if (!intentState) { return; // Rendering was cancelled. @@ -1772,10 +1766,7 @@ class PDFPageProxy { // TODO Refactor RenderPageRequest to separate rendering // and operator list logic - intentState.displayReadyCapability?.resolve({ - transparency, - isOffscreenCanvasSupported, - }); + intentState.displayReadyCapability?.resolve(transparency); } /** @@ -2737,11 +2728,7 @@ class WorkerTransport { } const page = this.#pageCache.get(data.pageIndex); - page._startRenderPage( - data.transparency, - data.isOffscreenCanvasSupported, - data.cacheKey - ); + page._startRenderPage(data.transparency, data.cacheKey); }); messageHandler.on("commonobj", ([id, type, exportedData]) => { @@ -3303,11 +3290,7 @@ class InternalRenderTask { }); } - initializeGraphics({ - transparency = false, - isOffscreenCanvasSupported = false, - optionalContentConfig, - }) { + initializeGraphics({ transparency = false, optionalContentConfig }) { if (this.cancelled) { return; }