1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

Check if the Decode entry is non-default when deciding if JPEG images are natively supported/decodable (issue 6238)

Tentatively fixes 6238.
This commit is contained in:
Jonas Jenwald 2015-07-20 23:30:05 +02:00
parent 862342189f
commit 385e2e5aaf
4 changed files with 15 additions and 4 deletions

View file

@ -942,7 +942,8 @@ var JpegStream = (function JpegStreamClosure() {
JpegStream.prototype.isNativelySupported =
function JpegStream_isNativelySupported(xref, res) {
var cs = ColorSpace.parse(this.dict.get('ColorSpace', 'CS'), xref, res);
return cs.name === 'DeviceGray' || cs.name === 'DeviceRGB';
return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') &&
cs.isDefaultDecode(this.dict.get('Decode', 'D'));
};
/**
* Checks if the image can be decoded by the browser.
@ -950,8 +951,8 @@ var JpegStream = (function JpegStreamClosure() {
JpegStream.prototype.isNativelyDecodable =
function JpegStream_isNativelyDecodable(xref, res) {
var cs = ColorSpace.parse(this.dict.get('ColorSpace', 'CS'), xref, res);
var numComps = cs.numComps;
return numComps === 1 || numComps === 3;
return (cs.numComps === 1 || cs.numComps === 3) &&
cs.isDefaultDecode(this.dict.get('Decode', 'D'));
};
return JpegStream;