mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 10:15:37 +02:00
Respect the 'ColorTransform' entry in the image dictionary when decoding JPEG images (bug 956965, issue 6574)
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=956965. Fixes 6574.
This commit is contained in:
parent
6c263c1994
commit
116ba19dd9
6 changed files with 56 additions and 15 deletions
|
@ -146,18 +146,26 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
*/
|
||||
NativeImageDecoder.isSupported =
|
||||
function NativeImageDecoder_isSupported(image, xref, res) {
|
||||
var cs = ColorSpace.parse(image.dict.get('ColorSpace', 'CS'), xref, res);
|
||||
var dict = image.dict;
|
||||
if (dict.has('DecodeParms') || dict.has('DP')) {
|
||||
return false;
|
||||
}
|
||||
var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
|
||||
return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') &&
|
||||
cs.isDefaultDecode(image.dict.getArray('Decode', 'D'));
|
||||
cs.isDefaultDecode(dict.getArray('Decode', 'D'));
|
||||
};
|
||||
/**
|
||||
* Checks if the image can be decoded by the browser.
|
||||
*/
|
||||
NativeImageDecoder.isDecodable =
|
||||
function NativeImageDecoder_isDecodable(image, xref, res) {
|
||||
var cs = ColorSpace.parse(image.dict.get('ColorSpace', 'CS'), xref, res);
|
||||
var dict = image.dict;
|
||||
if (dict.has('DecodeParms') || dict.has('DP')) {
|
||||
return false;
|
||||
}
|
||||
var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
|
||||
return (cs.numComps === 1 || cs.numComps === 3) &&
|
||||
cs.isDefaultDecode(image.dict.getArray('Decode', 'D'));
|
||||
cs.isDefaultDecode(dict.getArray('Decode', 'D'));
|
||||
};
|
||||
|
||||
function PartialEvaluator(pdfManager, xref, handler, pageIndex,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue