commit
7c7fb4bcee
12
pdf.js
12
pdf.js
@ -715,7 +715,6 @@ var PredictorStream = (function predictorStream() {
|
|||||||
var columns = this.columns = params.get('Columns') || 1;
|
var columns = this.columns = params.get('Columns') || 1;
|
||||||
|
|
||||||
this.pixBytes = (colors * bits + 7) >> 3;
|
this.pixBytes = (colors * bits + 7) >> 3;
|
||||||
// add an extra pixByte to represent the pixel left of column 0
|
|
||||||
this.rowBytes = (columns * colors * bits + 7) >> 3;
|
this.rowBytes = (columns * colors * bits + 7) >> 3;
|
||||||
|
|
||||||
DecodeStream.call(this);
|
DecodeStream.call(this);
|
||||||
@ -798,10 +797,12 @@ var PredictorStream = (function predictorStream() {
|
|||||||
var currentRow = buffer.subarray(bufferLength, bufferLength + rowBytes);
|
var currentRow = buffer.subarray(bufferLength, bufferLength + rowBytes);
|
||||||
var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
|
var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
|
||||||
if (prevRow.length == 0)
|
if (prevRow.length == 0)
|
||||||
prevRow = currentRow;
|
prevRow = new Uint8Array(rowBytes);
|
||||||
|
|
||||||
switch (predictor) {
|
switch (predictor) {
|
||||||
case 0:
|
case 0:
|
||||||
|
for (var i = 0; i < rowBytes; ++i)
|
||||||
|
currentRow[i] = rawBytes[i];
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
for (var i = 0; i < pixBytes; ++i)
|
for (var i = 0; i < pixBytes; ++i)
|
||||||
@ -824,8 +825,11 @@ var PredictorStream = (function predictorStream() {
|
|||||||
case 4:
|
case 4:
|
||||||
// we need to save the up left pixels values. the simplest way
|
// we need to save the up left pixels values. the simplest way
|
||||||
// is to create a new buffer
|
// is to create a new buffer
|
||||||
for (var i = 0; i < pixBytes; ++i)
|
for (var i = 0; i < pixBytes; ++i) {
|
||||||
currentRow[i] = rawBytes[i];
|
var up = prevRow[i];
|
||||||
|
var c = rawBytes[i];
|
||||||
|
currentRow[i] = up + c;
|
||||||
|
}
|
||||||
for (; i < rowBytes; ++i) {
|
for (; i < rowBytes; ++i) {
|
||||||
var up = prevRow[i];
|
var up = prevRow[i];
|
||||||
var upLeft = prevRow[i - pixBytes];
|
var upLeft = prevRow[i - pixBytes];
|
||||||
|
Loading…
Reference in New Issue
Block a user