Add some comments + fix getColorN_IR_Pattern
This commit is contained in:
parent
5543d6f448
commit
5bfa9e4f3b
17
pdf.js
17
pdf.js
@ -4234,21 +4234,22 @@ var PartialEvaluator = (function() {
|
||||
var dict = IsStream(pattern) ? pattern.dict : pattern;
|
||||
var typeNum = dict.get('PatternType');
|
||||
|
||||
// Type1 is TilingPattern, Type2 is ShadingPattern.
|
||||
// Type1 is TilingPattern
|
||||
if (typeNum == 1) {
|
||||
// Create an IR of the pattern code.
|
||||
var codeIR = this.evalRaw(pattern, xref,
|
||||
dict.get('Resources'), fonts);
|
||||
|
||||
args = TilingPattern.getIR(codeIR, dict);
|
||||
|
||||
//patternName.code = this.evalRaw(pattern, xref,
|
||||
// dict.get('Resources'), fonts);
|
||||
} else {
|
||||
}
|
||||
// Type2 is ShadingPattern.
|
||||
else if (typeNum == 2) {
|
||||
var shading = xref.fetchIfRef(dict.get('Shading'));
|
||||
var matrix = dict.get('Matrix');
|
||||
var pattern = Pattern.parseShading(shading, matrix, xref, res, null /*ctx*/);
|
||||
args = pattern.getPatternRaw();
|
||||
} else {
|
||||
error("Unkown PatternType " + typeNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5277,7 +5278,7 @@ var CanvasGraphics = (function() {
|
||||
this.setStrokeColor.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
getColorN_IR_Pattern: function(IR) {
|
||||
getColorN_IR_Pattern: function(IR, cs) {
|
||||
if (IR[0] == "TilingPatternIR") {
|
||||
// First, build the `color` var like it's done in the
|
||||
// Pattern.prototype.parse function.
|
||||
@ -5306,7 +5307,7 @@ var CanvasGraphics = (function() {
|
||||
var cs = this.current.strokeColorSpace;
|
||||
|
||||
if (cs.name == 'Pattern') {
|
||||
this.current.strokeColor = this.getColorN_IR_Pattern(arguments);
|
||||
this.current.strokeColor = this.getColorN_IR_Pattern(arguments, cs);
|
||||
} else {
|
||||
this.setStrokeColor.apply(this, arguments);
|
||||
}
|
||||
@ -5333,7 +5334,7 @@ var CanvasGraphics = (function() {
|
||||
var cs = this.current.fillColorSpace;
|
||||
|
||||
if (cs.name == 'Pattern') {
|
||||
this.current.fillColor = this.getColorN_IR_Pattern(arguments);
|
||||
this.current.fillColor = this.getColorN_IR_Pattern(arguments, cs);
|
||||
} else {
|
||||
this.setFillColor.apply(this, arguments);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user