1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-24 09:08:07 +02:00

[api-minor] Generate images in the worker instead of the main thread.

We introduced the use of OffscreenCanvas in #14754 and this patch aims
to use them for all kind of images.
It'll slightly improve performances (and maybe slightly decrease memory use).
Since an image can be rendered in using some transfer maps but because of
OffscreenCanvas we don't have the underlying pixels array the transfer maps
stuff is re-implemented in using the SVG filter feComponentTransfer.
This commit is contained in:
Calixte Denizet 2023-02-15 17:14:04 +01:00
parent 9640add1f7
commit fd03cd5493
13 changed files with 700 additions and 89 deletions

View file

@ -2655,7 +2655,11 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
});
it("gets operatorList with JPEG image (issue 4888)", async function () {
const loadingTask = getDocument(buildGetDocumentParams("cmykjpeg.pdf"));
const loadingTask = getDocument(
buildGetDocumentParams("cmykjpeg.pdf", {
isOffscreenCanvasSupported: false,
})
);
const pdfDoc = await loadingTask.promise;
const pdfPage = await pdfDoc.getPage(1);
@ -3089,7 +3093,11 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
EXPECTED_WIDTH = 2550,
EXPECTED_HEIGHT = 3300;
const loadingTask = getDocument(buildGetDocumentParams("issue11878.pdf"));
const loadingTask = getDocument(
buildGetDocumentParams("issue11878.pdf", {
isOffscreenCanvasSupported: false,
})
);
const pdfDoc = await loadingTask.promise;
let firstImgData = null;

View file

@ -61,7 +61,11 @@ describe("SVGGraphics", function () {
let page;
beforeAll(async function () {
loadingTask = getDocument(buildGetDocumentParams("xobject-image.pdf"));
loadingTask = getDocument(
buildGetDocumentParams("xobject-image.pdf", {
isOffscreenCanvasSupported: false,
})
);
const doc = await loadingTask.promise;
page = await doc.getPage(1);
});