mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Name all constructors.
This commit is contained in:
parent
f239d01bde
commit
1ef4c94de2
12 changed files with 223 additions and 213 deletions
|
@ -8,13 +8,13 @@ var PatternType = {
|
|||
RADIAL: 3
|
||||
};
|
||||
|
||||
var Pattern = (function patternPattern() {
|
||||
var Pattern = (function PatternClosure() {
|
||||
// Constructor should define this.getPattern
|
||||
function constructor() {
|
||||
function Pattern() {
|
||||
error('should not call Pattern constructor');
|
||||
}
|
||||
|
||||
constructor.prototype = {
|
||||
Pattern.prototype = {
|
||||
// Input: current Canvas context
|
||||
// Output: the appropriate fillStyle or strokeStyle
|
||||
getPattern: function pattern_getStyle(ctx) {
|
||||
|
@ -22,11 +22,11 @@ var Pattern = (function patternPattern() {
|
|||
}
|
||||
};
|
||||
|
||||
constructor.shadingFromIR = function pattern_shadingFromIR(ctx, raw) {
|
||||
Pattern.shadingFromIR = function pattern_shadingFromIR(ctx, raw) {
|
||||
return Shadings[raw[0]].fromIR(ctx, raw);
|
||||
};
|
||||
|
||||
constructor.parseShading = function pattern_shading(shading, matrix, xref,
|
||||
Pattern.parseShading = function pattern_shading(shading, matrix, xref,
|
||||
res, ctx) {
|
||||
|
||||
var dict = isStream(shading) ? shading.dict : shading;
|
||||
|
@ -41,15 +41,15 @@ var Pattern = (function patternPattern() {
|
|||
return new Shadings.Dummy();
|
||||
}
|
||||
};
|
||||
return constructor;
|
||||
return Pattern;
|
||||
})();
|
||||
|
||||
var Shadings = {};
|
||||
|
||||
// Radial and axial shading have very similar implementations
|
||||
// If needed, the implementations can be broken into two classes
|
||||
Shadings.RadialAxial = (function radialAxialShading() {
|
||||
function constructor(dict, matrix, xref, res, ctx) {
|
||||
Shadings.RadialAxial = (function RadialAxialClosure() {
|
||||
function RadialAxial(dict, matrix, xref, res, ctx) {
|
||||
this.matrix = matrix;
|
||||
this.coordsArr = dict.get('Coords');
|
||||
this.shadingType = dict.get('ShadingType');
|
||||
|
@ -102,7 +102,7 @@ Shadings.RadialAxial = (function radialAxialShading() {
|
|||
this.colorStops = colorStops;
|
||||
}
|
||||
|
||||
constructor.fromIR = function radialAxialShadingGetIR(ctx, raw) {
|
||||
RadialAxial.fromIR = function radialAxialShadingGetIR(ctx, raw) {
|
||||
var type = raw[1];
|
||||
var colorStops = raw[2];
|
||||
var p0 = raw[3];
|
||||
|
@ -134,7 +134,7 @@ Shadings.RadialAxial = (function radialAxialShading() {
|
|||
return grad;
|
||||
};
|
||||
|
||||
constructor.prototype = {
|
||||
RadialAxial.prototype = {
|
||||
getIR: function radialAxialShadingGetIR() {
|
||||
var coordsArr = this.coordsArr;
|
||||
var type = this.shadingType;
|
||||
|
@ -162,27 +162,27 @@ Shadings.RadialAxial = (function radialAxialShading() {
|
|||
}
|
||||
};
|
||||
|
||||
return constructor;
|
||||
return RadialAxial;
|
||||
})();
|
||||
|
||||
Shadings.Dummy = (function dummyShading() {
|
||||
function constructor() {
|
||||
Shadings.Dummy = (function DummyClosure() {
|
||||
function Dummy() {
|
||||
this.type = 'Pattern';
|
||||
}
|
||||
|
||||
constructor.fromIR = function dummyShadingFromIR() {
|
||||
Dummy.fromIR = function dummyShadingFromIR() {
|
||||
return 'hotpink';
|
||||
};
|
||||
|
||||
constructor.prototype = {
|
||||
Dummy.prototype = {
|
||||
getIR: function dummyShadingGetIR() {
|
||||
return ['Dummy'];
|
||||
}
|
||||
};
|
||||
return constructor;
|
||||
return Dummy;
|
||||
})();
|
||||
|
||||
var TilingPattern = (function tilingPattern() {
|
||||
var TilingPattern = (function TilingPatternClosure() {
|
||||
var PAINT_TYPE_COLORED = 1, PAINT_TYPE_UNCOLORED = 2;
|
||||
|
||||
function TilingPattern(IR, color, ctx, objs) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue