mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
In src/core/jpg.js
, ensure that the Adobe JPEG marker always takes precedence, even when the color transform code is zero
According to the PDF specification, please see http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#G6.2394361, if an Adobe JPEG marker is present it should always take precedence. This even seem to be consistent with the existing comment that is present in the code. Hence it seems reasonable to interpret `transformCode === 0` as no color conversion being necessary. Fixes the rendering of page 1 in `issue-4926` (from the test-suite), when the built-in `src/core/jpg.js` image decoder is used.
This commit is contained in:
parent
11e95712d4
commit
e2ea9b693c
1 changed files with 8 additions and 7 deletions
|
@ -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() {
|
|||
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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue