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:
Jonas Jenwald 2016-09-22 14:07:20 +02:00
parent 6c263c1994
commit 116ba19dd9
6 changed files with 56 additions and 15 deletions

View file

@ -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,