From 609230ad07a155aee61f6583ca7d30bc9f2e75ac Mon Sep 17 00:00:00 2001 From: sbarman Date: Sat, 18 Jun 2011 13:06:54 -0700 Subject: [PATCH] Fixed predictor --- pdf.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pdf.js b/pdf.js index b75ce91ec..6a1589dde 100644 --- a/pdf.js +++ b/pdf.js @@ -519,8 +519,9 @@ var FilterPredictor = (function() { this.bits = bits; this.nVals = width * colors; - this.pixBytes = (colors * bits + 7) >> 3; - var rowBytes = (width * colors * bits + 7) >> 3; + var pixBytes = (colors * bits + 7) >> 3; + this.pixBytes = pixBytes; + var rowBytes = ((width * colors * bits + 7) >> 3) + pixBytes; this.rowBytes = rowBytes; if (width < 0 || colors < 0 || bits < 0 ||bits > 16) @@ -569,7 +570,7 @@ var FilterPredictor = (function() { for (var i = 0, ii = pixBytes + 1; i < ii; ++i) upLeftBuf.push(0); - for (var i = pixBytes, ii = rowBytes; i < ii; ++i) { + for (var i = pixBytes, ii = rowBytes + pixBytes + 1; i < ii; ++i) { for (var j = pixBytes; j > 0; --j) { upLeftBuf[j] = upLeftBuf[j - 1]; } @@ -2118,7 +2119,7 @@ var CanvasGraphics = (function() { var widths = xref.fetchIfRef(fontDict.get("Widths")); var firstChar = xref.fetchIfRef(fontDict.get("FirstChar")); - assertWellFormed(IsArray(widths) && IsInteger(firstChar), + assertWellFormed(IsArray(widths) && IsInt(firstChar), "invalid font Widths or FirstChar"); var charset = []; for (var j = 0; j < widths.length; j++) { @@ -2775,9 +2776,9 @@ var CanvasGraphics = (function() { if (bitsPerComponent != 8) error("unhandled number of bits per component"); - if (false && smask) { - if (maskColorSpace.numComps != 1) - error("Incorrect number of components in smask"); + if (smask) { + //if (maskColorSpace.numComps != 1) + // error("Incorrect number of components in smask"); var numComps = colorSpace.numComps; var imgArray = image.getBytes(numComps * w * h);