1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 17:48:07 +02:00

Add a new parameter to JpegImage.getData to indicate the source of the image data (issue 9513)

The purpose of this patch is to provide a better default behaviour when `JpegImage` is used to parse standalone JPEG images with CMYK colour spaces.
Since the issue that the patch concerns is somewhat of a special-case, the implementation utilizes the already existing decode support in an attempt to minimize the impact w.r.t. code size.

*Please note:* It's always possible for the user of `JpegImage` to control image inversion, and thus override the new behaviour, by simply passing a custom `decodeTransform` array upon initialization.
This commit is contained in:
Jonas Jenwald 2018-09-02 13:55:27 +02:00
parent 47bf12cbac
commit 663922f93f
3 changed files with 36 additions and 11 deletions

View file

@ -97,8 +97,12 @@ let JpegStream = (function JpegStreamClosure() {
const jpegImage = new JpegImage(jpegOptions);
jpegImage.parse(this.bytes);
let data = jpegImage.getData(this.drawWidth, this.drawHeight,
this.forceRGB);
let data = jpegImage.getData({
width: this.drawWidth,
height: this.drawHeight,
forceRGB: this.forceRGB,
isSourcePDF: true,
});
this.buffer = data;
this.bufferLength = data.length;
this.eof = true;