Explorar o código

PDF.js version 1.0.353

Yury Delendik %!s(int64=10) %!d(string=hai) anos
pai
achega
086323bd62
Modificáronse 5 ficheiros con 64 adicións e 30 borrados
  1. 1 1
      bower.json
  2. 30 13
      build/pdf.combined.js
  3. 2 2
      build/pdf.js
  4. 30 13
      build/pdf.worker.js
  5. 1 1
      package.json

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "pdfjs-dist",
-  "version": "1.0.351",
+  "version": "1.0.353",
   "keywords": [
     "Mozilla",
     "pdf",

+ 30 - 13
build/pdf.combined.js

@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 
-PDFJS.version = '1.0.351';
-PDFJS.build = 'cab0430';
+PDFJS.version = '1.0.353';
+PDFJS.build = '480e093';
 
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it
@@ -20202,11 +20202,11 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
         var bitStrideLength = (width + 7) >> 3;
         var imgArray = image.getBytes(bitStrideLength * height);
         var decode = dict.get('Decode', 'D');
-        var canTransfer = image instanceof DecodeStream;
         var inverseDecode = (!!decode && decode[0] > 0);
 
         imgData = PDFImage.createMask(imgArray, width, height,
-                                      canTransfer, inverseDecode);
+                                      image instanceof DecodeStream,
+                                      inverseDecode);
         imgData.cached = true;
         args = [imgData];
         operatorList.addOp(OPS.paintImageMaskXObject, args);
@@ -35426,23 +35426,40 @@ var PDFImage = (function PDFImageClosure() {
   };
 
   PDFImage.createMask =
-      function PDFImage_createMask(imgArray, width, height, canTransfer,
-                                   inverseDecode) {
-    // If imgArray came from a DecodeStream, we're safe to transfer it.
-    // Otherwise, copy it.
+      function PDFImage_createMask(imgArray, width, height,
+                                   imageIsFromDecodeStream, inverseDecode) {
+
+    // |imgArray| might not contain full data for every pixel of the mask, so
+    // we need to distinguish between |computedLength| and |actualLength|.
+    // In particular, if inverseDecode is true, then the array we return must
+    // have a length of |computedLength|.
+
+    var computedLength = ((width + 7) >> 3) * height;
     var actualLength = imgArray.byteLength;
-    var data;
-    if (canTransfer) {
+    var haveFullData = computedLength == actualLength;
+    var data, i;
+
+    if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
+      // imgArray came from a DecodeStream and its data is in an appropriate
+      // form, so we can just transfer it.
       data = imgArray;
-    } else {
+    } else if (!inverseDecode) {
       data = new Uint8Array(actualLength);
       data.set(imgArray);
+    } else {
+      data = new Uint8Array(computedLength);
+      data.set(imgArray);
+      for (i = actualLength; i < computedLength; i++) {
+        data[i] = 0xff;
+      }
     }
-    // Invert if necessary. It's safe to modify the array -- whether it's the
+
+    // If necessary, invert the original mask data (but not any extra we might
+    // have added above). It's safe to modify the array -- whether it's the
     // original or a copy, we're about to transfer it anyway, so nothing else
     // in this thread can be relying on its contents.
     if (inverseDecode) {
-      for (var i = 0; i < actualLength; i++) {
+      for (i = 0; i < actualLength; i++) {
         data[i] = ~data[i];
       }
     }

+ 2 - 2
build/pdf.js

@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 
-PDFJS.version = '1.0.351';
-PDFJS.build = 'cab0430';
+PDFJS.version = '1.0.353';
+PDFJS.build = '480e093';
 
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it

+ 30 - 13
build/pdf.worker.js

@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 
-PDFJS.version = '1.0.351';
-PDFJS.build = 'cab0430';
+PDFJS.version = '1.0.353';
+PDFJS.build = '480e093';
 
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it
@@ -15686,11 +15686,11 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
         var bitStrideLength = (width + 7) >> 3;
         var imgArray = image.getBytes(bitStrideLength * height);
         var decode = dict.get('Decode', 'D');
-        var canTransfer = image instanceof DecodeStream;
         var inverseDecode = (!!decode && decode[0] > 0);
 
         imgData = PDFImage.createMask(imgArray, width, height,
-                                      canTransfer, inverseDecode);
+                                      image instanceof DecodeStream,
+                                      inverseDecode);
         imgData.cached = true;
         args = [imgData];
         operatorList.addOp(OPS.paintImageMaskXObject, args);
@@ -30910,23 +30910,40 @@ var PDFImage = (function PDFImageClosure() {
   };
 
   PDFImage.createMask =
-      function PDFImage_createMask(imgArray, width, height, canTransfer,
-                                   inverseDecode) {
-    // If imgArray came from a DecodeStream, we're safe to transfer it.
-    // Otherwise, copy it.
+      function PDFImage_createMask(imgArray, width, height,
+                                   imageIsFromDecodeStream, inverseDecode) {
+
+    // |imgArray| might not contain full data for every pixel of the mask, so
+    // we need to distinguish between |computedLength| and |actualLength|.
+    // In particular, if inverseDecode is true, then the array we return must
+    // have a length of |computedLength|.
+
+    var computedLength = ((width + 7) >> 3) * height;
     var actualLength = imgArray.byteLength;
-    var data;
-    if (canTransfer) {
+    var haveFullData = computedLength == actualLength;
+    var data, i;
+
+    if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
+      // imgArray came from a DecodeStream and its data is in an appropriate
+      // form, so we can just transfer it.
       data = imgArray;
-    } else {
+    } else if (!inverseDecode) {
       data = new Uint8Array(actualLength);
       data.set(imgArray);
+    } else {
+      data = new Uint8Array(computedLength);
+      data.set(imgArray);
+      for (i = actualLength; i < computedLength; i++) {
+        data[i] = 0xff;
+      }
     }
-    // Invert if necessary. It's safe to modify the array -- whether it's the
+
+    // If necessary, invert the original mask data (but not any extra we might
+    // have added above). It's safe to modify the array -- whether it's the
     // original or a copy, we're about to transfer it anyway, so nothing else
     // in this thread can be relying on its contents.
     if (inverseDecode) {
-      for (var i = 0; i < actualLength; i++) {
+      for (i = 0; i < actualLength; i++) {
         data[i] = ~data[i];
       }
     }

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "pdfjs-dist",
-  "version": "1.0.351",
+  "version": "1.0.353",
   "description": "Generic build of Mozilla's PDF.js library.",
   "keywords": [
     "Mozilla",