2
0
Yury Delendik 10 жил өмнө
parent
commit
46f974442d
5 өөрчлөгдсөн 74 нэмэгдсэн , 34 устгасан
  1. 1 1
      bower.json
  2. 35 15
      build/pdf.combined.js
  3. 2 2
      build/pdf.js
  4. 35 15
      build/pdf.worker.js
  5. 1 1
      package.json

+ 1 - 1
bower.json

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

+ 35 - 15
build/pdf.combined.js

@@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 
-PDFJS.version = '1.0.696';
-PDFJS.build = '3ad972a';
+PDFJS.version = '1.0.698';
+PDFJS.build = '783d506';
 
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it
@@ -13156,6 +13156,8 @@ var CalRGBCS = (function CalRGBCSClosure() {
   var tempConvertMatrix1 = new Float32Array(3);
   var tempConvertMatrix2 = new Float32Array(3);
 
+  var DECODE_L_CONSTANT = Math.pow(((8 + 16) / 116), 3) / 8.0;
+
   function CalRGBCS(whitePoint, blackPoint, gamma, matrix) {
     this.name = 'CalRGB';
     this.numComps = 3;
@@ -13264,18 +13266,30 @@ var CalRGBCS = (function CalRGBCSClosure() {
       return -decodeL(-L);
     }
 
-    if (L > 80) {
+    if (L > 8.0) {
       return Math.pow(((L + 16) / 116), 3);
     }
 
-    return L * Math.pow(((8 + 16) / 116), 3) / 8.0;
+    return L * DECODE_L_CONSTANT;
   }
 
   function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
-    // For the BlackPoint calculation details, please see
+
+    // In case the blackPoint is already the default blackPoint then there is
+    // no need to do compensation.
+    if (sourceBlackPoint[0] === 0 &&
+        sourceBlackPoint[1] === 0 &&
+        sourceBlackPoint[2] === 0) {
+      result[0] = XYZ_Flat[0];
+      result[1] = XYZ_Flat[1];
+      result[2] = XYZ_Flat[2];
+      return;
+    }
+
+    // For the blackPoint calculation details, please see
     // http://www.adobe.com/content/dam/Adobe/en/devnet/photoshop/sdk/
     // AdobeBPC.pdf.
-    // The destination BlackPoint is the default BlackPoint [0, 0, 0].
+    // The destination blackPoint is the default blackPoint [0, 0, 0].
     var zeroDecodeL = decodeL(0);
 
     var X_DST = zeroDecodeL;
@@ -13303,6 +13317,15 @@ var CalRGBCS = (function CalRGBCSClosure() {
 
   function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
 
+    // In case the whitePoint is already flat then there is no need to do
+    // normalization.
+    if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
+      result[0] = XYZ_In[0];
+      result[1] = XYZ_In[1];
+      result[2] = XYZ_In[2];
+      return;
+    }
+
     var LMS = result;
     matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
 
@@ -13337,15 +13360,11 @@ var CalRGBCS = (function CalRGBCSClosure() {
     var BGG = Math.pow(B, cs.GG);
     var CGB = Math.pow(C, cs.GB);
 
-    // Computes intermediate variables M, L, N as per spec.
-    var M = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
-    var L = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
-    var N = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
-
-    // Decode XYZ, as per spec.
-    var X = M;
-    var Y = L;
-    var Z = N;
+    // Computes intermediate variables L, M, N as per spec.
+    // To decode X, Y, Z values map L, M, N directly to them.
+    var X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
+    var Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
+    var Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
 
     // The following calculations are based on this document:
     // http://www.adobe.com/content/dam/Adobe/en/devnet/photoshop/sdk/
@@ -13355,6 +13374,7 @@ var CalRGBCS = (function CalRGBCSClosure() {
     XYZ[1] = Y;
     XYZ[2] = Z;
     var XYZ_Flat = tempConvertMatrix2;
+
     normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
 
     var XYZ_Black = tempConvertMatrix1;

+ 2 - 2
build/pdf.js

@@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 
-PDFJS.version = '1.0.696';
-PDFJS.build = '3ad972a';
+PDFJS.version = '1.0.698';
+PDFJS.build = '783d506';
 
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it

+ 35 - 15
build/pdf.worker.js

@@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 
-PDFJS.version = '1.0.696';
-PDFJS.build = '3ad972a';
+PDFJS.version = '1.0.698';
+PDFJS.build = '783d506';
 
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it
@@ -7126,6 +7126,8 @@ var CalRGBCS = (function CalRGBCSClosure() {
   var tempConvertMatrix1 = new Float32Array(3);
   var tempConvertMatrix2 = new Float32Array(3);
 
+  var DECODE_L_CONSTANT = Math.pow(((8 + 16) / 116), 3) / 8.0;
+
   function CalRGBCS(whitePoint, blackPoint, gamma, matrix) {
     this.name = 'CalRGB';
     this.numComps = 3;
@@ -7234,18 +7236,30 @@ var CalRGBCS = (function CalRGBCSClosure() {
       return -decodeL(-L);
     }
 
-    if (L > 80) {
+    if (L > 8.0) {
       return Math.pow(((L + 16) / 116), 3);
     }
 
-    return L * Math.pow(((8 + 16) / 116), 3) / 8.0;
+    return L * DECODE_L_CONSTANT;
   }
 
   function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
-    // For the BlackPoint calculation details, please see
+
+    // In case the blackPoint is already the default blackPoint then there is
+    // no need to do compensation.
+    if (sourceBlackPoint[0] === 0 &&
+        sourceBlackPoint[1] === 0 &&
+        sourceBlackPoint[2] === 0) {
+      result[0] = XYZ_Flat[0];
+      result[1] = XYZ_Flat[1];
+      result[2] = XYZ_Flat[2];
+      return;
+    }
+
+    // For the blackPoint calculation details, please see
     // http://www.adobe.com/content/dam/Adobe/en/devnet/photoshop/sdk/
     // AdobeBPC.pdf.
-    // The destination BlackPoint is the default BlackPoint [0, 0, 0].
+    // The destination blackPoint is the default blackPoint [0, 0, 0].
     var zeroDecodeL = decodeL(0);
 
     var X_DST = zeroDecodeL;
@@ -7273,6 +7287,15 @@ var CalRGBCS = (function CalRGBCSClosure() {
 
   function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
 
+    // In case the whitePoint is already flat then there is no need to do
+    // normalization.
+    if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
+      result[0] = XYZ_In[0];
+      result[1] = XYZ_In[1];
+      result[2] = XYZ_In[2];
+      return;
+    }
+
     var LMS = result;
     matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
 
@@ -7307,15 +7330,11 @@ var CalRGBCS = (function CalRGBCSClosure() {
     var BGG = Math.pow(B, cs.GG);
     var CGB = Math.pow(C, cs.GB);
 
-    // Computes intermediate variables M, L, N as per spec.
-    var M = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
-    var L = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
-    var N = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
-
-    // Decode XYZ, as per spec.
-    var X = M;
-    var Y = L;
-    var Z = N;
+    // Computes intermediate variables L, M, N as per spec.
+    // To decode X, Y, Z values map L, M, N directly to them.
+    var X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
+    var Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
+    var Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
 
     // The following calculations are based on this document:
     // http://www.adobe.com/content/dam/Adobe/en/devnet/photoshop/sdk/
@@ -7325,6 +7344,7 @@ var CalRGBCS = (function CalRGBCSClosure() {
     XYZ[1] = Y;
     XYZ[2] = Z;
     var XYZ_Flat = tempConvertMatrix2;
+
     normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
 
     var XYZ_Black = tempConvertMatrix1;

+ 1 - 1
package.json

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