Browse Source

Merge pull request #8638 from Snuffleupagus/issue-4926-built-in-jpg

In `src/core/jpg.js`, ensure that the Adobe JPEG marker always takes precedence, even when the color transform code is zero
Tim van der Meij 8 years ago committed by GitHub
parent
commit
7ded895d0c
  1. 15
      src/core/jpg.js
  2. 1
      test/driver.js
  3. 9
      test/test_manifest.json

15
src/core/jpg.js

@ -958,12 +958,13 @@ var JpegImage = (function JpegImageClosure() { @@ -958,12 +958,13 @@ var JpegImage = (function JpegImageClosure() {
return data;
},
_isColorConversionNeeded: function isColorConversionNeeded() {
if (this.adobe && this.adobe.transformCode) {
// The adobe transform marker overrides any previous setting
return true;
} else if (this.numComponents === 3) {
if (!this.adobe && this.colorTransform === 0) {
_isColorConversionNeeded() {
if (this.adobe) {
// The adobe transform marker overrides any previous setting.
return !!this.adobe.transformCode;
}
if (this.numComponents === 3) {
if (this.colorTransform === 0) {
// If the Adobe transform marker is not present and the image
// dictionary has a 'ColorTransform' entry, explicitly set to `0`,
// then the colours should *not* be transformed.
@ -972,7 +973,7 @@ var JpegImage = (function JpegImageClosure() { @@ -972,7 +973,7 @@ var JpegImage = (function JpegImageClosure() {
return true;
}
// `this.numComponents !== 3`
if (!this.adobe && this.colorTransform === 1) {
if (this.colorTransform === 1) {
// If the Adobe transform marker is not present and the image
// dictionary has a 'ColorTransform' entry, explicitly set to `1`,
// then the colours should be transformed.

1
test/driver.js

@ -358,6 +358,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars @@ -358,6 +358,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars
PDFJS.getDocument({
url: absoluteUrl,
password: task.password,
nativeImageDecoderSupport: task.nativeImageDecoderSupport,
}).then((doc) => {
task.pdfDoc = doc;
this._nextPage(task, failure);

9
test/test_manifest.json

@ -3378,6 +3378,15 @@ @@ -3378,6 +3378,15 @@
"link": true,
"type": "eq"
},
{ "id": "issue4926-built-in-jpg",
"file": "pdfs/issue4926.pdf",
"md5": "ed881c8ea2f9bc4be94ecb7f2b2c149b",
"rounds": 1,
"link": true,
"lastPage": 1,
"type": "eq",
"nativeImageDecoderSupport": "none"
},
{ "id": "issue5592",
"file": "pdfs/issue5592.pdf",
"md5": "a0750f95afa80c880f7966df7062616c",

Loading…
Cancel
Save