Handle device gray and pass in the color transform option.
This commit is contained in:
parent
493805d952
commit
073af78307
@ -797,16 +797,21 @@ var JpegStream = (function jpegStream() {
|
|||||||
// Flag indicating wether the image can be natively loaded.
|
// Flag indicating wether the image can be natively loaded.
|
||||||
this.isNative = true;
|
this.isNative = true;
|
||||||
|
|
||||||
|
this.colorTransform = -1;
|
||||||
|
|
||||||
if (isAdobeImage(bytes)) {
|
if (isAdobeImage(bytes)) {
|
||||||
// when bug 674619 land, let's check if browser can do
|
// when bug 674619 land, let's check if browser can do
|
||||||
// normal cmyk and then we won't have to the following
|
// normal cmyk and then we won't have to the following
|
||||||
var cs = xref.fetchIfRef(dict.get('ColorSpace'));
|
var cs = xref.fetchIfRef(dict.get('ColorSpace'));
|
||||||
if (isName(cs) && cs.name === 'DeviceCMYK') {
|
|
||||||
this.isNative = false;
|
// DeviceRGB and DeviceGray are the only Adobe images that work natively
|
||||||
this.bytes = bytes;
|
if (isName(cs) && (cs.name === 'DeviceRGB' || cs.name === 'DeviceGray')) {
|
||||||
} else {
|
|
||||||
bytes = fixAdobeImage(bytes);
|
bytes = fixAdobeImage(bytes);
|
||||||
this.src = bytesToString(bytes);
|
this.src = bytesToString(bytes);
|
||||||
|
} else {
|
||||||
|
this.colorTransform = dict.get('ColorTransform');
|
||||||
|
this.isNative = false;
|
||||||
|
this.bytes = bytes;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.src = bytesToString(bytes);
|
this.src = bytesToString(bytes);
|
||||||
@ -820,7 +825,7 @@ var JpegStream = (function jpegStream() {
|
|||||||
constructor.prototype.ensureBuffer = function jpegStreamEnsureBuffer(req) {
|
constructor.prototype.ensureBuffer = function jpegStreamEnsureBuffer(req) {
|
||||||
if (this.bufferLength)
|
if (this.bufferLength)
|
||||||
return;
|
return;
|
||||||
var jpegImage = new JpegImage();
|
var jpegImage = new JpegImage(this.colorTransform);
|
||||||
jpegImage.parse(this.bytes);
|
jpegImage.parse(this.bytes);
|
||||||
var width = jpegImage.width;
|
var width = jpegImage.width;
|
||||||
var height = jpegImage.height;
|
var height = jpegImage.height;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user