Skip to content

Commit

Permalink
Fixes issue mozilla#6071
Browse files Browse the repository at this point in the history
Corrects readBlockTiff() case for 1-bit depth TIFF images incorporated in
the PDF.

Corrected sintaxe according to style guide.
  • Loading branch information
josealeixopc committed Dec 6, 2016
1 parent 46d2c89 commit 8a6c163
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/core/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -740,14 +740,15 @@ var PredictorStream = (function PredictorStreamClosure() {
var i;

if (bits === 1) {
var complement = 0;
var bitOrder = 0;
for (i = 0; i < rowBytes; ++i) {
var c = rawBytes[i];
inbuf = (inbuf << 8) | c;
// bitwise addition is exclusive or
// first shift inbuf and then add
buffer[pos++] = (c ^ (inbuf >> colors)) & 0xFF;
// truncate inbuf (assumes colors < 16)
inbuf &= 0xFFFF;
inbuf = (inbuf << 8) | (rawBytes[i] & 0xFF);
for (bitOrder = 7; bitOrder >= 0; --bitOrder) {
complement = (complement + (inbuf >> bitOrder)) & 0x1;
outbuf = (outbuf << 1) | complement;
}
buffer[pos++] = (outbuf & 0xFF);
}
} else if (bits === 8) {
for (i = 0; i < colors; ++i) {
Expand Down

0 comments on commit 8a6c163

Please sign in to comment.