Stop streams from being sent from worker for indexed color spaces.

This commit is contained in:
Brendan Dahl 2012-08-16 15:22:28 -07:00
parent c9c5ae32d9
commit fd416d3788
3 changed files with 14 additions and 1 deletions

View File

@ -139,6 +139,9 @@ var ColorSpace = (function ColorSpaceClosure() {
var baseIndexedCS = ColorSpace.parseToIR(cs[1], xref, res); var baseIndexedCS = ColorSpace.parseToIR(cs[1], xref, res);
var hiVal = cs[2] + 1; var hiVal = cs[2] + 1;
var lookup = xref.fetchIfRef(cs[3]); var lookup = xref.fetchIfRef(cs[3]);
if (isStream(lookup)) {
lookup = lookup.getBytes();
}
return ['IndexedCS', baseIndexedCS, hiVal, lookup]; return ['IndexedCS', baseIndexedCS, hiVal, lookup];
case 'Separation': case 'Separation':
case 'DeviceN': case 'DeviceN':
@ -260,14 +263,18 @@ var IndexedCS = (function IndexedCSClosure() {
var baseNumComps = base.numComps; var baseNumComps = base.numComps;
var length = baseNumComps * highVal; var length = baseNumComps * highVal;
var lookupArray = new Uint8Array(length); var lookupArray;
if (isStream(lookup)) { if (isStream(lookup)) {
lookupArray = new Uint8Array(length);
var bytes = lookup.getBytes(length); var bytes = lookup.getBytes(length);
lookupArray.set(bytes); lookupArray.set(bytes);
} else if (isString(lookup)) { } else if (isString(lookup)) {
lookupArray = new Uint8Array(length);
for (var i = 0; i < length; ++i) for (var i = 0; i < length; ++i)
lookupArray[i] = lookup.charCodeAt(i); lookupArray[i] = lookup.charCodeAt(i);
} else if (lookup instanceof Uint8Array) {
lookupArray = lookup;
} else { } else {
error('Unrecognized lookup table: ' + lookup); error('Unrecognized lookup table: ' + lookup);
} }

BIN
test/pdfs/issue1985.pdf Normal file

Binary file not shown.

View File

@ -658,5 +658,11 @@
"pageLimit": 1, "pageLimit": 1,
"link": true, "link": true,
"type": "load" "type": "load"
},
{ "id": "issue1985",
"file": "pdfs/issue1985.pdf",
"md5": "2ac7c68e26a8ef797aead15e4875cc6d",
"rounds": 1,
"type": "load"
} }
] ]