]> git.parisson.com Git - pdf.js.git/commitdiff
Fixed predictor
authorsbarman <sbarman@L3CWZ5T.(none)>
Sat, 18 Jun 2011 20:06:54 +0000 (13:06 -0700)
committersbarman <sbarman@L3CWZ5T.(none)>
Sat, 18 Jun 2011 20:06:54 +0000 (13:06 -0700)
pdf.js

diff --git a/pdf.js b/pdf.js
index b75ce91ecc24357ea61f5d8efbdd6d5da6677710..6a1589ddeae541271d2536022e75a0015aacb425 100644 (file)
--- 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);