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

Fallback to built-in image decoding if the NativeImageDecoder fails

In particular this means that if 'JpegDecode', in `src/display/api.js`, fails we'll fallback to the built-in JPEG decoder.
This commit is contained in:
Jonas Jenwald 2018-02-01 15:32:09 +01:00
parent 2570717e77
commit 76afe1018b
2 changed files with 9 additions and 6 deletions

View file

@ -80,11 +80,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var colorSpace = dict.get('ColorSpace', 'CS');
colorSpace = ColorSpace.parse(colorSpace, this.xref, this.resources,
this.pdfFunctionFactory);
var numComps = colorSpace.numComps;
var decodePromise = this.handler.sendWithPromise('JpegDecode',
[image.getIR(this.forceDataSchema), numComps]);
return decodePromise.then(function (message) {
var data = message.data;
return this.handler.sendWithPromise('JpegDecode', [
image.getIR(this.forceDataSchema), colorSpace.numComps
]).then(function({ data, width, height, }) {
return new Stream(data, 0, data.length, image.dict);
});
},