]> git.parisson.com Git - pdf.js.git/commitdiff
return a dummy fill style for NYI shading
authorChris Jones <jones.chris.g@gmail.com>
Sun, 10 Jul 2011 06:30:16 +0000 (23:30 -0700)
committerChris Jones <jones.chris.g@gmail.com>
Sun, 10 Jul 2011 06:30:16 +0000 (23:30 -0700)
pdf.js

diff --git a/pdf.js b/pdf.js
index a40adbec7f4dbcaab24b691b52e7778b6552d270..450ddb0713eec9472dede0262d658318ac5616f7 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -4313,19 +4313,20 @@ var CanvasGraphics = (function() {
     },
     getShading: function(shading) {
       shading = this.xref.fetchIfRef(shading);
+      var dict = IsStream(shading) ? shading.dict : shading;
 
-      var bbox = shading.get('BBox');
+      var bbox = dict.get('BBox');
       if (bbox && IsArray(bbox) && 4 == bbox.length) {
         this.rectangle.apply(this, bbox);
         this.clip();
         this.endPath();
       }
 
-      var background = shading.get('Background');
+      var background = dict.get('Background');
       if (background)
         TODO('handle background colors');
 
-      var cs = shading.get('ColorSpace', 'CS');
+      var cs = dict.get('ColorSpace', 'CS');
       cs = ColorSpace.parse(cs, this.xref, this.res);
 
       var types = [null,
@@ -4333,16 +4334,18 @@ var CanvasGraphics = (function() {
           this.getAxialShading,
           this.getRadialShading];
 
-      var typeNum = shading.get('ShadingType');
+      var typeNum = dict.get('ShadingType');
       var shadingFn = types[typeNum];
 
       // Most likely we will not implement other types of shading
       // unless the browser supports them
-      if (!shadingFn)
-        TODO("Unknown or NYI type of shading '"+ typeNum +"'");
+      if (!shadingFn) {
+        warn("Unknown or NYI type of shading '"+ typeNum +"'");
+        return 'hotpink';
+      }
 
       return shadingFn.call(this, shading, cs);
-                },
+    },
     getAxialShading: function(sh, cs) {
       var coordsArr = sh.get('Coords');
       var x0 = coordsArr[0], y0 = coordsArr[1],