var PredictorStream = (function() {
function constructor(stream, params) {
- var predictor = params.get("Predictor") || 1;
- this.predictor = predictor;
+ var predictor = this.predictor = params.get("Predictor") || 1;
if (predictor <= 1)
return stream; // no prediction
if (params.has("EarlyChange")) {
error("EarlyChange predictor parameter is not supported");
}
- var colors = params.get("Colors") || 1;
- this.colors = colors;
- var bits = params.get("BitsPerComponent") || 8;
- this.bits = bits;
- var columns = params.get("Columns") || 1;
- this.columns = columns;
+ var colors = this.colors = params.get("Colors") || 1;
+ var bits = this.bits = params.get("BitsPerComponent") || 8;
+ var columns = this.columns = params.get("Columns") || 1;
- var pixBytes = (colors * bits + 7) >> 3;
- this.pixBytes = pixBytes;
+ var pixBytes = this.pixBytes = (colors * bits + 7) >> 3;
// add an extra pixByte to represent the pixel left of column 0
- var rowBytes = ((columns * colors * bits + 7) >> 3) + pixBytes;
- this.rowBytes = rowBytes;
+ var rowBytes = this.rowBytes = ((columns * colors * bits + 7) >> 3) + pixBytes;
this.currentRow = new Uint8Array(rowBytes);
this.bufferLength = rowBytes;
inbuf = (inbuf << 8) | (rawBytes[j++] & 0xFF);
inbits += 8;
}
- compArray[kk] = (compArray[kk] + (inbuf >>
- (inbits - bits))) & bitMask;
+ compArray[kk] = (compArray[kk] +
+ (inbuf >> (inbits - bits))) & bitMask;
inbits -= bits;
outbuf = (outbuf << bits) | compArray[kk];
outbits += bits;
}
if (outbits > 0) {
currentRow[k++] = (outbuf << (8 - outbits)) +
- (inbuf & ((1 << (8 - outbits)) - 1))
+ (inbuf & ((1 << (8 - outbits)) - 1))
}
}
this.pos = pixBytes;
this.pos = pixBytes;
},
getByte : function() {
- if (this.pos >= this.bufferLength) {
+ if (this.pos >= this.bufferLength)
this.readRow();
- }
return this.currentRow[this.pos++];
},
getBytes : function(n) {
var i, bytes;
bytes = new Uint8Array(n);
for (i = 0; i < n; ++i) {
- if (this.pos >= this.bufferLength) {
+ if (this.pos >= this.bufferLength)
this.readRow();
- }
bytes[i] = this.currentRow[this.pos++];
}
return bytes;
return String.formCharCode(this.getByte());
},
lookChar : function() {
- if (this.pos >= this.bufferLength) {
+ if (this.pos >= this.bufferLength)
this.readRow();
- }
return String.formCharCode(this.currentRow[this.pos]);
},
skip : function(n) {
case "DeviceGray":
case "G":
this.numComps = 1;
+ break;
case "DeviceRGB":
this.numComps = 3;
break;