switched to using const enums

This commit is contained in:
sbarman 2011-06-20 14:22:11 -07:00
parent 8ae9b1f3d4
commit 8911f7c6c5

11
pdf.js
View File

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