Conditionally bundle gulp image_decoders
-specific code in src/core/jbig2.js
(PR 9729 follow-up)
This method/function was added only for the `gulp image_decoders`-builds, and is completely unused elsewhere (e.g. in the Firefox PDF Viewer). While this only reduces the size of the *built* `pdf.worker.js` file by a little over 1 kB, it can't hurt to remove completely unused code from the "normal" builds.
This commit is contained in:
parent
87fdb0eb42
commit
e82ad79eb9
@ -1473,8 +1473,7 @@ function processSegment(segment, visitor) {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Jbig2Error(
|
throw new Jbig2Error(
|
||||||
`segment type ${header.typeName}(${header.type})` +
|
`segment type ${header.typeName}(${header.type}) is not implemented`
|
||||||
" is not implemented"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const callbackName = "on" + header.typeName;
|
const callbackName = "on" + header.typeName;
|
||||||
@ -1500,6 +1499,9 @@ function parseJbig2Chunks(chunks) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function parseJbig2(data) {
|
function parseJbig2(data) {
|
||||||
|
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("IMAGE_DECODERS")) {
|
||||||
|
throw new Error("Not implemented: parseJbig2");
|
||||||
|
}
|
||||||
const end = data.length;
|
const end = data.length;
|
||||||
let position = 0;
|
let position = 0;
|
||||||
|
|
||||||
@ -2560,6 +2562,9 @@ class Jbig2Image {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parse(data) {
|
parse(data) {
|
||||||
|
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("IMAGE_DECODERS")) {
|
||||||
|
throw new Error("Not implemented: Jbig2Image.parse");
|
||||||
|
}
|
||||||
const { imgData, width, height } = parseJbig2(data);
|
const { imgData, width, height } = parseJbig2(data);
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
|
Loading…
Reference in New Issue
Block a user