1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Move the maybeValidDimensions check, used with JPEG images, to occur earlier (PR 11523 follow-up)

Given that the `NativeImageDecoder.{isSupported, isDecodable}` methods require both dictionary lookups *and* ColorSpace parsing, in hindsight it actually seems more reasonable to the `JpegStream.maybeValidDimensions` checks *first*.
This commit is contained in:
Jonas Jenwald 2020-04-26 12:01:22 +02:00
parent 7363308b97
commit 911c33f025
2 changed files with 4 additions and 4 deletions

View file

@ -549,13 +549,13 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
!softMask &&
!mask &&
image instanceof JpegStream &&
image.maybeValidDimensions &&
NativeImageDecoder.isSupported(
image,
this.xref,
resources,
this.pdfFunctionFactory
) &&
image.maybeValidDimensions
)
) {
// These JPEGs don't need any more processing so we can just send it.
return this.handler

View file

@ -36,13 +36,13 @@ class NativeImageDecoder {
canDecode(image) {
return (
image instanceof JpegStream &&
image.maybeValidDimensions &&
NativeImageDecoder.isDecodable(
image,
this.xref,
this.resources,
this.pdfFunctionFactory
) &&
image.maybeValidDimensions
)
);
}