mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-24 09:08:07 +02:00
Improve performance with image masks (bug 857031)
- it aims to partially fix performance issue reported: https://bugzilla.mozilla.org/show_bug.cgi?id=857031; - the idea is too avoid to use byte arrays but use ImageBitmap which are a way faster to draw: * an ImageBitmap is Transferable which means that it can be built in the worker instead of in the main thread: - this is achieved in using an OffscreenCanvas when it's available, there is a bug to enable them for pdf.js: https://bugzilla.mozilla.org/show_bug.cgi?id=1763330; - or in using createImageBitmap: in Firefox a task is sent to the main thread to build the bitmap so it's slightly slower than using an OffscreenCanvas. * it's transfered from the worker to the main thread by "reference"; * the byte buffers used to create the image data have a very short lifetime and ergo the memory used is globally less than before. - Use the localImageCache for the mask; - Fix the pdf issue4436r.pdf: it was expected to have a binary stream for the image; - Move the singlePixel trick from operator_list to image: this way we can use this trick even if it isn't in a set as defined in operator_list.
This commit is contained in:
parent
2b673a6941
commit
040fcae5ab
11 changed files with 256 additions and 65 deletions
Binary file not shown.
|
@ -959,6 +959,8 @@ async function startBrowser(browserName, startUrl = "") {
|
|||
print_printer: "PDF",
|
||||
"print.printer_PDF.print_to_file": true,
|
||||
"print.printer_PDF.print_to_filename": printFile,
|
||||
// Enable OffscreenCanvas
|
||||
"gfx.offscreencanvas.enabled": true,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -5576,7 +5576,7 @@
|
|||
},
|
||||
{ "id": "issue4436",
|
||||
"file": "pdfs/issue4436r.pdf",
|
||||
"md5": "4e43d692d213f56674fcac92110c7364",
|
||||
"md5": "f5dc60cce342ac8d165069a80d23b92e",
|
||||
"rounds": 1,
|
||||
"link": false,
|
||||
"type": "eq"
|
||||
|
|
|
@ -1666,7 +1666,7 @@ describe("api", function () {
|
|||
|
||||
expect(fingerprints1).not.toEqual(fingerprints2);
|
||||
|
||||
expect(fingerprints1).toEqual(["2f695a83d6e7553c24fc08b7ac69712d", null]);
|
||||
expect(fingerprints1).toEqual(["657428c0628e329f9a281fb6d2d092d4", null]);
|
||||
expect(fingerprints2).toEqual(["04c7126b34a46b6d4d6e7a1eff7edcb6", null]);
|
||||
|
||||
await Promise.all([loadingTask1.destroy(), loadingTask2.destroy()]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue