Rearranged predictor interface

This commit is contained in:
sbarman 2011-06-17 13:32:26 -07:00
parent 5baaa758f1
commit ce09870e2b

39
pdf.js
View File

@ -232,23 +232,6 @@ var FlateStream = (function() {
]), 5]; ]), 5];
function constructor(stream, params) { function constructor(stream, params) {
if (IsDict(params)) {
var predType = params.get("Predictor");
if (predType && predType > 1) {
var colors = params.get("Colors");
if (!colors)
colors = 1;
var bpc = params.get("BitsPerComponent");
if (!bpc)
bpc = 8;
var cols = params.get("Columns");
if (!cols)
cols = 1;
this.pred = new FilterPredictor(this, predType, cols,
colors, bpc);
}
}
this.stream = stream; this.stream = stream;
this.dict = stream.dict; this.dict = stream.dict;
var cmf = stream.getByte(); var cmf = stream.getByte();
@ -1297,9 +1280,25 @@ var Parser = (function() {
}, },
makeFilter: function(stream, name, params) { makeFilter: function(stream, name, params) {
if (name == "FlateDecode" || name == "Fl") { if (name == "FlateDecode" || name == "Fl") {
if (params) var flateStr = new FlateStream(stream);
error("params not supported yet for FlateDecode"); if (IsDict(params)) {
return new FlateStream(stream); var predType = params.get("Predictor");
if (predType && predType > 1) {
var colors = params.get("Colors");
if (!colors)
colors = 1;
var bpc = params.get("BitsPerComponent");
if (!bpc)
bpc = 8;
var cols = params.get("Columns");
if (!cols)
cols = 1;
flateStr = new FilterPredictor(flateStr, predType, cols,
colors, bpc);
}
}
return flateStr;
} else { } else {
error("filter '" + name + "' not supported yet"); error("filter '" + name + "' not supported yet");
} }