1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

[api-major] Add openjpeg.wasm to pdf.js (bug 1935076)

In order to fix bug 1935076, we'll have to add a pure js fallback in case wasm is disabled
or simd isn't supported. Unfortunately, this fallback will take some space.

So, the main goal of this patch is to reduce the overall size (by ~93k).
As a side effect, it should make easier to use an other wasm file (which must export
_jp2_decode, _malloc and _free).
This commit is contained in:
Calixte Denizet 2025-01-15 20:20:11 +01:00
parent 711bf2bd12
commit 94b4b54ef6
21 changed files with 274 additions and 19 deletions

View file

@ -99,8 +99,11 @@ class DecodeStream extends BaseStream {
return this.buffer.subarray(pos, end);
}
async getImageData(length, decoderOptions = null) {
async getImageData(length, decoderOptions) {
if (!this.canAsyncDecodeImageFromBuffer) {
if (this.isAsyncDecoder) {
return this.decodeImage(null, decoderOptions);
}
return this.getBytes(length, decoderOptions);
}
const data = await this.stream.asyncGetBytes();