1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

[api-minor] Remove the WebGL implementation

Reasons for the removal include:
 - This functionality was always somewhat experimental and has never been enabled by default, partly because of worries about rendering bugs caused by e.g. bad/outdated graphics drivers.

 - After the initial implementation, in PR 4286 (back in 2014), no additional functionality has been added to the WebGL implementation.

 - The vast majority of all documents do not benefit from WebGL rendering, since only a couple of *specific* features are supported (e.g. some Soft Masks and Patterns).

 - There is, and has always been, *zero* test-coverage for the WebGL implementation.

 - Overall performance, in the PDF.js library, has improved since the experimental WebGL implementation was added.

Rather than shipping unused *and* untested code, it seems reasonable to simply remove the WebGL implementation for now; thanks to version control it's always possible to bring back the code should the need ever arise.
This commit is contained in:
Jonas Jenwald 2021-05-09 15:54:26 +02:00
parent 99eac86478
commit 2ba4b65ca8
9 changed files with 28 additions and 608 deletions

View file

@ -354,9 +354,6 @@ const PDFViewerApplication = {
if ("disablehistory" in hashParams) {
AppOptions.set("disableHistory", hashParams.disablehistory === "true");
}
if ("webgl" in hashParams) {
AppOptions.set("enableWebGL", hashParams.webgl === "true");
}
if ("verbosity" in hashParams) {
AppOptions.set("verbosity", hashParams.verbosity | 0);
}
@ -511,7 +508,6 @@ const PDFViewerApplication = {
findController,
scriptingManager: pdfScriptingManager,
renderer: AppOptions.get("renderer"),
enableWebGL: AppOptions.get("enableWebGL"),
l10n: this.l10n,
textLayerMode: AppOptions.get("textLayerMode"),
imageResourcesPath: AppOptions.get("imageResourcesPath"),
@ -1520,8 +1516,7 @@ const PDFViewerApplication = {
console.log(
`PDF ${pdfDocument.fingerprint} [${info.PDFFormatVersion} ` +
`${(info.Producer || "-").trim()} / ${(info.Creator || "-").trim()}] ` +
`(PDF.js: ${version || "-"}` +
`${this.pdfViewer.enableWebGL ? " [WebGL]" : ""})`
`(PDF.js: ${version || "-"})`
);
let pdfTitle = info?.Title;

View file

@ -70,11 +70,6 @@ const defaultOptions = {
value: true,
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
},
enableWebGL: {
/** @type {boolean} */
value: false,
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
},
externalLinkRel: {
/** @type {string} */
value: "noopener noreferrer nofollow",

View file

@ -73,8 +73,6 @@ const DEFAULT_CACHE_SIZE = 10;
* @property {boolean} [enablePrintAutoRotate] - Enables automatic rotation of
* landscape pages upon printing. The default is `false`.
* @property {string} renderer - 'canvas' or 'svg'. The default is 'canvas'.
* @property {boolean} [enableWebGL] - Enables WebGL accelerated rendering for
* some operations. The default value is `false`.
* @property {boolean} [useOnlyCssZoom] - Enables CSS only zooming. The default
* value is `false`.
* @property {number} [maxCanvasPixels] - The maximum supported canvas size in
@ -194,7 +192,6 @@ class BaseViewer {
this.renderInteractiveForms = options.renderInteractiveForms !== false;
this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
this.renderer = options.renderer || RendererType.CANVAS;
this.enableWebGL = options.enableWebGL || false;
this.useOnlyCssZoom = options.useOnlyCssZoom || false;
this.maxCanvasPixels = options.maxCanvasPixels;
this.l10n = options.l10n || NullL10n;
@ -550,7 +547,6 @@ class BaseViewer {
imageResourcesPath: this.imageResourcesPath,
renderInteractiveForms: this.renderInteractiveForms,
renderer: this.renderer,
enableWebGL: this.enableWebGL,
useOnlyCssZoom: this.useOnlyCssZoom,
maxCanvasPixels: this.maxCanvasPixels,
l10n: this.l10n,

View file

@ -55,8 +55,6 @@ import { viewerCompatibilityParams } from "./viewer_compatibility.js";
* @property {boolean} renderInteractiveForms - Turns on rendering of
* interactive form elements. The default value is `true`.
* @property {string} renderer - 'canvas' or 'svg'. The default is 'canvas'.
* @property {boolean} [enableWebGL] - Enables WebGL accelerated rendering for
* some operations. The default value is `false`.
* @property {boolean} [useOnlyCssZoom] - Enables CSS only zooming. The default
* value is `false`.
* @property {number} [maxCanvasPixels] - The maximum supported canvas size in
@ -105,7 +103,6 @@ class PDFPageView {
this.xfaLayerFactory = options.xfaLayerFactory;
this.structTreeLayerFactory = options.structTreeLayerFactory;
this.renderer = options.renderer || RendererType.CANVAS;
this.enableWebGL = options.enableWebGL || false;
this.l10n = options.l10n || NullL10n;
this.paintTask = null;
@ -728,7 +725,6 @@ class PDFPageView {
canvasContext: ctx,
transform,
viewport: this.viewport,
enableWebGL: this.enableWebGL,
renderInteractiveForms: this.renderInteractiveForms,
optionalContentConfigPromise: this._optionalContentConfigPromise,
};