]> git.parisson.com Git - pdf.js.git/commitdiff
Make ColorSpace Separation work as long as no IR form is needed for now
authorJulian Viereck <julian.viereck@gmail.com>
Thu, 8 Sep 2011 19:44:55 +0000 (12:44 -0700)
committerJulian Viereck <julian.viereck@gmail.com>
Thu, 15 Sep 2011 16:03:50 +0000 (09:03 -0700)
pdf.js

diff --git a/pdf.js b/pdf.js
index dde6beb176abf485d3b16a722be6c63784b3e3fc..4c5f4fa4ec892ed66bd4bdb9899fac003725a07d 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -5596,8 +5596,12 @@ var ColorSpace = (function() {
   };
 
   constructor.parse = function colorspace_parse(cs, xref, res) {
-    var IR = constructor.parseToIR(cs, xref, res);
-    return constructor.fromIR(IR);
+    var IR = constructor.parseToIR(cs, xref, res, true);
+    if (!(IR instanceof SeparationCS)) {
+      return constructor.fromIR(IR);
+    } else {
+      return IR
+    }
   };
   
   constructor.fromIR = function(raw) {
@@ -5633,7 +5637,7 @@ var ColorSpace = (function() {
     return null;
   }
   
-  constructor.parseToIR = function colorspace_parse(cs, xref, res) {
+  constructor.parseToIR = function colorspace_parse(cs, xref, res, parseOnly) {
     if (IsName(cs)) {
       var colorSpaces = res.get('ColorSpace');
       if (IsDict(colorSpaces)) {
@@ -5703,13 +5707,15 @@ var ColorSpace = (function() {
         var hiVal = cs[2] + 1;
         var lookup = xref.fetchIfRef(cs[3]);
         return ["IndexedCS", baseCS, hiVal, lookup];
-      case 'Separation':      
-        error("Need to implement IR form for SeparationCS");
-
-        // var name = cs[1];
-        // var alt = ColorSpace.parse(cs[2], xref, res);
-        // var tintFn = new PDFFunction(xref, xref.fetchIfRef(cs[3]));
-        // return new SeparationCS(alt, tintFn);
+      case 'Separation':
+        if (!parseOnly) {
+          error("Need to implement IR form for SeparationCS");
+        } else {
+          var name = cs[1];
+          var alt = ColorSpace.parse(cs[2], xref, res);
+          var tintFn = new PDFFunction(xref, xref.fetchIfRef(cs[3]));
+          return new SeparationCS(alt, tintFn);
+        }
       case 'Lab':
       case 'DeviceN':
       default:
@@ -5756,7 +5762,6 @@ var SeparationCS = (function() {
           baseBuf[pos++] = 255 * tinted[j];
       }
       return base.getRgbBuffer(baseBuf, 8);
-
     }
   };