]> git.parisson.com Git - pdf.js.git/commitdiff
switched to using const enums
authorsbarman <sbarman@L3CWZ5T.(none)>
Mon, 20 Jun 2011 21:22:11 +0000 (14:22 -0700)
committersbarman <sbarman@L3CWZ5T.(none)>
Mon, 20 Jun 2011 21:22:11 +0000 (14:22 -0700)
pdf.js

diff --git a/pdf.js b/pdf.js
index 001784eea95d299e04375b78c86063da6d302fc2..aca7e0b5a97aa86a36b1390ed064a955faade87d 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -2034,7 +2034,7 @@ var CanvasGraphics = (function() {
     const EO_CLIP = {};
 
     // Used for tiling patterns
-    const PAINT_TYPE = [null, "colored", "uncolored"];
+    const PAINT_TYPE_COLORED = 1, PAINT_TYPE_UNCOLORED = 2;
 
     constructor.prototype = {
         translateFont: function(fontDict, xref, resources) {
@@ -2506,12 +2506,15 @@ var CanvasGraphics = (function() {
             var dict = pattern.dict;
             var ctx = this.ctx;
 
-            var paintType = PAINT_TYPE[dict.get("PaintType")];
-            if (paintType == "colored") {
+            var paintType = dict.get("PaintType");
+            switch (paintType) {
+            case PAINT_TYPE_COLORED:
                 // should go to default for color space
                 ctx.fillStyle = this.makeCssRgb(1, 1, 1);
                 ctx.strokeStyle = this.makeCssRgb(0, 0, 0);
-            } else {
+                break;
+            case PAINT_TYPE_UNCOLORED:
+            default:
                 error("Unsupported paint type");
             }