mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-12 21:21:04 +02:00
Merge pull request #20961 from calixteman/use_image_decoder_chrome
[api-minor] Use the ImageDecoder by default on Chrome
This commit is contained in:
commit
8142937ac4
@ -21,7 +21,6 @@ import {
|
|||||||
AbortException,
|
AbortException,
|
||||||
AnnotationMode,
|
AnnotationMode,
|
||||||
assert,
|
assert,
|
||||||
FeatureTest,
|
|
||||||
getVerbosityLevel,
|
getVerbosityLevel,
|
||||||
info,
|
info,
|
||||||
isNodeJS,
|
isNodeJS,
|
||||||
@ -166,17 +165,6 @@ const RENDERING_CANCELLED_TIMEOUT = 100; // ms
|
|||||||
* `ImageDecoder` in the worker. Primarily used to improve performance of
|
* `ImageDecoder` in the worker. Primarily used to improve performance of
|
||||||
* image conversion/rendering.
|
* image conversion/rendering.
|
||||||
* The default value is `true` in web environments and `false` in Node.js.
|
* The default value is `true` in web environments and `false` in Node.js.
|
||||||
*
|
|
||||||
* NOTE: Also temporarily disabled in Chromium browsers, until we no longer
|
|
||||||
* support the affected browser versions, because of various bugs:
|
|
||||||
*
|
|
||||||
* - Crashes when using the BMP decoder with huge images, e.g. issue6741.pdf;
|
|
||||||
* see https://issues.chromium.org/issues/374807001
|
|
||||||
*
|
|
||||||
* - Broken images when using the JPEG decoder with images that have custom
|
|
||||||
* colour profiles, e.g. GitHub discussion 19030;
|
|
||||||
* see https://issues.chromium.org/issues/378869810
|
|
||||||
*
|
|
||||||
* @property {number} [canvasMaxAreaInBytes] - The integer value is used to
|
* @property {number} [canvasMaxAreaInBytes] - The integer value is used to
|
||||||
* know when an image must be resized (uses `OffscreenCanvas` in the worker).
|
* know when an image must be resized (uses `OffscreenCanvas` in the worker).
|
||||||
* If it's -1 then a possibly slow algorithm is used to guess the max value.
|
* If it's -1 then a possibly slow algorithm is used to guess the max value.
|
||||||
@ -284,15 +272,9 @@ function getDocument(src = {}) {
|
|||||||
? src.isOffscreenCanvasSupported
|
? src.isOffscreenCanvasSupported
|
||||||
: !isNodeJS;
|
: !isNodeJS;
|
||||||
const isImageDecoderSupported =
|
const isImageDecoderSupported =
|
||||||
// eslint-disable-next-line no-nested-ternary
|
|
||||||
typeof src.isImageDecoderSupported === "boolean"
|
typeof src.isImageDecoderSupported === "boolean"
|
||||||
? src.isImageDecoderSupported
|
? src.isImageDecoderSupported
|
||||||
: // eslint-disable-next-line no-nested-ternary
|
: !isNodeJS;
|
||||||
typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")
|
|
||||||
? true
|
|
||||||
: typeof PDFJSDev !== "undefined" && PDFJSDev.test("CHROME")
|
|
||||||
? false
|
|
||||||
: !isNodeJS && (FeatureTest.platform.isFirefox || !globalThis.chrome);
|
|
||||||
const canvasMaxAreaInBytes = Number.isInteger(src.canvasMaxAreaInBytes)
|
const canvasMaxAreaInBytes = Number.isInteger(src.canvasMaxAreaInBytes)
|
||||||
? src.canvasMaxAreaInBytes
|
? src.canvasMaxAreaInBytes
|
||||||
: -1;
|
: -1;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user